VS Arduino
Visual Micro >> General Board >> Cannot open Source file "rtos.h", identifier is undefined
https://www.visualmicro.com/forums/YaBB.pl?num=1650651097

Message started by rs 77tmp on Apr 22nd, 2022 at 6:11pm

Title: Cannot open Source file "rtos.h", identifier is undefined
Post by rs 77tmp on Apr 22nd, 2022 at 6:11pm
I get red squiggly lines under #include "rtos.h"

I also get a red line under
SHTC3 mySHTC3;

The header is included appropriately.

Arduino IDE 2.0 does not show any error.

The code compiles and runs OK - with both Arduino IDE, and Visual Micro

The error list says the variable names are ambiguous. The rtos.h include error - says error active in severity, and cannot open source file (which it obviously does when compiling)

Any ideas?

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by Tim@Visual Micro on Apr 22nd, 2022 at 6:31pm
Hi

This is an intellisense issue that can differ for each board. Please post or send the info in the yellow box above so that we can replicate and help resolve.

Thanks


Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by rs 77tmp on Apr 23rd, 2022 at 12:42am
Here is the sample code - for Portenta H7 M7 core. If you load it into Visual Studio - you should see #include rtos underlined (the include part), as well as SHTC3 references, and I2C_Mutex calls.

Thanks


Code (c++):
#include "arduino.h"
#include "mbed.h"
#include "rtos.h"
#include "ThreadDebug.h"

// Check we are using GDB Debugging and include the additional code
#ifdef VM_DEBUG_GDB
#include "ThreadDebug.h"
UsbDebugCommInterface  debugComm(&SerialUSB);
ThreadDebug            threadDebug(&debugComm, DEBUG_BREAK_IN_SETUP);
// Set to DEBUG_NO_BREAK_IN_SETUP to prevent automatic stop in setup
#endif

#include "SparkFun_SHTC3.h" // Click here to get the library: http://librarymanager/All#SparkFun_SHTC3
#include <Wire.h>
SHTC3 mySHTC3;              // Declare an instance of the SHTC3 class


using namespace mbed;
using namespace rtos;

Mutex I2C_Mutex;  // Required each time I2C bus will be used

Thread sensorThread;

const int LED_ON = LOW; // Voltage level is inverted
const int LED_OFF = HIGH;



void loop() {
  // put your main code here, to run repeatedly:
  ThisThread::sleep_for(osWaitForever);
}


void task_sensor() {
    int i = 0;
    int j = 0;

    float Temp, RH;

  // Setup I2C port
  // Will need a mutex on I2C



  for (;;) {
   
    I2C_Mutex.lock();
    mySHTC3.update();

    RH = mySHTC3.toPercent();
    Temp = mySHTC3.toDegC();

    //Read SHCT3 sensor in here
//    Serial.print("RH = ");
//    Serial.print(mySHTC3.toPercent());                        // "toPercent" returns the percent humidity as a floating point number
//    Serial.print("%, T = ");
//    Serial.print(mySHTC3.toDegC());                           // "toDegF" and "toDegC" return the temperature as a flaoting point number in deg F and deg C respectively
//    Serial.println(" deg C");





    I2C_Mutex.unlock();



    digitalWrite(LEDR, LED_ON); // Turn green LED on
    ThisThread::sleep_for(1000);
    digitalWrite(LEDR, LED_OFF); // Turn green LED off
    ThisThread::sleep_for(1000);
    ThisThread::sleep_for(10);

    i++;
    j += 2;

  }
}



void setup() {
  // put your setup code here, to run once:

  // Function for device
  //  Modbus Server (slave)
  // Web Server - show only data one way
  // Bluetooth communication with Android / iOS / .NET - for device confguration
  // Sensor Interfaces - multiple I2C sensors read by device
  //    Sensor average data =- 1 minute interval per sensor, and 60 minute interval per sensor
  // LCD panel display to display data - press any sensor and maybe will show a graph  - maybe

  //Serial.begin(115200);

  //Serial.print("Program Start\n");

  Wire.begin();

  mySHTC3.begin();

  pinMode(LEDR, OUTPUT); // Set green LED as output

  delay(5000);

  sensorThread.start(task_sensor);

}

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by Simon@Visual Micro on Apr 25th, 2022 at 10:18am
Thanks for the detail, we have a fix for this intellisense issue, and will update when this is released for download.

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by rs 77tmp on Apr 26th, 2022 at 12:06am
Thanks

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by Simon@Visual Micro on Apr 28th, 2022 at 9:43am
The rtos.h issue should be resolved in the latest release 22.04.26-0 which is available from the top of the board below:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by rs 77tmp on Apr 30th, 2022 at 10:56pm
I downloaded the latest version from the website (04 29 datecode), and the mbed.h and rtos.h are recognized OK, but I get other underlines with using namespace mbed etc

I will attach a screen capture to show them.

It compiles OK.

Thanks
Untitled_015.png ( 74 KB | 3 Downloads )

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by rs 77tmp on May 6th, 2022 at 4:49pm
Any update on this one?

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by Simon@Visual Micro on May 6th, 2022 at 5:37pm
Apologies for the delayed update on this issue, we will release an update in the coming days which should resolve these issues, and we will update this thread when it is available.

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by rs 77tmp on May 7th, 2022 at 2:46pm
Thanks

Title: Re: Cannot open Source file "rtos.h", identifier is undefined
Post by Simon@Visual Micro on May 12th, 2022 at 1:08pm
The latest release (22.04.29-2) should resolve this issue which is available from the top of the board below:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

I have found with some slight modifications to the sketch this all works as expected (see screenshot below)

FreeRtosLibTest.png ( 153 KB | 1 Download )

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.