You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
///
/// @brief main setup function
/// @note rtosSetup() is called before all other tasks
/// * Optional declaration
/// * Defined in main sketch or in rtosGlobals
/// @warning No delay() in rtosSetup()!
///
void rtosSetup() __attribute__((weak));
///
/// @brief Proxy function for Task_create()
/// @note Task_create() requires non-weak functions
///
void rtos_Setup() { rtosSetup(); };
///
/// @brief Proxy function for Task_create()
/// @note Task_create() requires non-weak functions
///
void rtos_Loop() { ; }
The function rtosSetup() is declared —or not— on main sketch —or the optional rtosGloblas.h. Here, in file MainSetup.ino.
// Optional rtosSetup function
// defined in main sketch or in rtosGlobals
// no delay() in rtosSetup()!
void rtosSetup()
{
Serial.begin(115200);
Serial.print("rtosSetup...");
pinMode(BLUE_LED, OUTPUT);
digitalWrite(BLUE_LED, HIGH);
Serial.println("done");
}
From @rei-vilo on June 15, 2015 8:25
The
setup()
functions in the Energia MT examples often initiliase the GPIOs, ports and objects as many times as sketches, e.g.Serial.begin(115200);
.This raises two issues.
setup()
functions in the sketches isn't known, so we don't know in which sketch to initiliase GPIOs, ports and objects.The idea is to have a specific
setup()
function namesrtosSetup()
called before all the othersetup()
functions of the sketches.main.cpp
and
just before
BIOS_start();
rtosSetup()
in the main sketch.Because
rtosSetup()
is weak, the declaration of the functionrtosSetup()
can be omitted.Copied from original issue: energia/Energia#631
The text was updated successfully, but these errors were encountered: