RTduino Source Code Reference Manual
Macros | Functions
MultiThread

Multi-threading support. More...

Macros

#define RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO_INITLEVEL(name, setup, loop, stack_size, priority, init_level)
 Macro to define an RTduino loader with specified stack size, priority, and initialization level. More...
 
#define RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO(name, setup, loop, stack_size, priority)    RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO_INITLEVEL(name, setup, loop, stack_size, priority, INIT_APP_EXPORT)
 Macro to define an RTduino loader with specified stack size and priority. More...
 
#define RTDUINO_SKETCH_LOADER(name, setup, loop)    RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO(name, setup, loop, RTDUINO_THREAD_SIZE, RTDUINO_THREAD_PRIO)
 Macro to define an RTduino loader with default stack size and priority. More...
 
#define RTDUINO_SKETCH_LOADER_PRIO(name, setup, loop, priority)    RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO(name, setup, loop, RTDUINO_THREAD_SIZE, priority)
 Macro to define an RTduino loader with specified priority. More...
 
#define RTDUINO_SKETCH_LOADER_STACKSIZE(name, setup, loop, stack_size)    RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO(name, setup, loop, stack_size, RTDUINO_THREAD_PRIO)
 Macro to define an RTduino loader with specified stack size. More...
 

Functions

rt_err_t rtduino_sketch_loader_delete (rtduino_loader_t loader)
 Deletes an RTduino loader. More...
 
rtduino_loader_t rtduino_sketch_loader_create_stacksize_prio (const char *name, void(*setup)(void), void(*loop)(void), rt_uint32_t stack_size, rt_uint8_t priority)
 Creates an RTduino loader with specified stack size and priority. More...
 
rt_inline rtduino_loader_t rtduino_sketch_loader_create (const char *name, void(*setup)(void), void(*loop)(void))
 Creates an RTduino loader with default stack size and priority. More...
 
rt_inline rtduino_loader_t rtduino_sketch_loader_create_prio (const char *name, void(*setup)(void), void(*loop)(void), rt_uint8_t priority)
 Creates an RTduino loader with specified priority. More...
 
rt_inline rtduino_loader_t rtduino_sketch_loader_create_stacksize (const char *name, void(*setup)(void), void(*loop)(void), rt_uint32_t stack_size)
 Creates an RTduino loader with specified stack size. More...
 

Detailed Description

Multi-threading support.

Macro Definition Documentation

◆ RTDUINO_SKETCH_LOADER

#define RTDUINO_SKETCH_LOADER (   name,
  setup,
  loop 
)     RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO(name, setup, loop, RTDUINO_THREAD_SIZE, RTDUINO_THREAD_PRIO)

Macro to define an RTduino loader with default stack size and priority.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.

◆ RTDUINO_SKETCH_LOADER_PRIO

#define RTDUINO_SKETCH_LOADER_PRIO (   name,
  setup,
  loop,
  priority 
)     RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO(name, setup, loop, RTDUINO_THREAD_SIZE, priority)

Macro to define an RTduino loader with specified priority.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
priorityPriority of the loader thread.

◆ RTDUINO_SKETCH_LOADER_STACKSIZE

#define RTDUINO_SKETCH_LOADER_STACKSIZE (   name,
  setup,
  loop,
  stack_size 
)     RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO(name, setup, loop, stack_size, RTDUINO_THREAD_PRIO)

Macro to define an RTduino loader with specified stack size.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
stack_sizeStack size of the loader thread.

◆ RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO

#define RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO (   name,
  setup,
  loop,
  stack_size,
  priority 
)     RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO_INITLEVEL(name, setup, loop, stack_size, priority, INIT_APP_EXPORT)

Macro to define an RTduino loader with specified stack size and priority.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
stack_sizeStack size of the loader thread.
priorityPriority of the loader thread.

◆ RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO_INITLEVEL

#define RTDUINO_SKETCH_LOADER_STACKSIZE_PRIO_INITLEVEL (   name,
  setup,
  loop,
  stack_size,
  priority,
  init_level 
)
Value:
static int _sketch_loader(void) \
{ \
rtduino_sketch_loader_create_stacksize_prio(name, setup, loop, stack_size, priority);\
return 0; \
} \
init_level(_sketch_loader)
void loop(void)
Main loop function for the Arduino program.
void setup(void)
Initialization function for the Arduino environment.

Macro to define an RTduino loader with specified stack size, priority, and initialization level.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
stack_sizeStack size of the loader thread.
priorityPriority of the loader thread.
init_levelInitialization level macro.

Function Documentation

◆ rtduino_sketch_loader_create()

rt_inline rtduino_loader_t rtduino_sketch_loader_create ( const char *  name,
void(*)(void)  setup,
void(*)(void)  loop 
)

Creates an RTduino loader with default stack size and priority.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
Returns
Pointer to the created RTduino loader.

◆ rtduino_sketch_loader_create_prio()

rt_inline rtduino_loader_t rtduino_sketch_loader_create_prio ( const char *  name,
void(*)(void)  setup,
void(*)(void)  loop,
rt_uint8_t  priority 
)

Creates an RTduino loader with specified priority.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
priorityPriority of the loader thread.
Returns
Pointer to the created RTduino loader.

◆ rtduino_sketch_loader_create_stacksize()

rt_inline rtduino_loader_t rtduino_sketch_loader_create_stacksize ( const char *  name,
void(*)(void)  setup,
void(*)(void)  loop,
rt_uint32_t  stack_size 
)

Creates an RTduino loader with specified stack size.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
stack_sizeStack size of the loader thread.
Returns
Pointer to the created RTduino loader.

◆ rtduino_sketch_loader_create_stacksize_prio()

rtduino_loader_t rtduino_sketch_loader_create_stacksize_prio ( const char *  name,
void(*)(void)  setup,
void(*)(void)  loop,
rt_uint32_t  stack_size,
rt_uint8_t  priority 
)

Creates an RTduino loader with specified stack size and priority.

Parameters
nameName of the loader.
setupSetup function.
loopLoop function.
stack_sizeStack size of the loader thread.
priorityPriority of the loader thread.
Returns
Pointer to the created RTduino loader, or RT_NULL if the creation failed.

◆ rtduino_sketch_loader_delete()

rt_err_t rtduino_sketch_loader_delete ( rtduino_loader_t  loader)

Deletes an RTduino loader.

Parameters
loaderPointer to the RTduino loader to be deleted.
Returns
RT_EOK on success, negative value on failure.