croutine.
croutine.
h
);
void(* crCOROUTINE_CODE)(CoRoutineHandle_t, UBaseType_t)
BaseType_t xCoRoutineCreate(crCOROUTINE_CODE pxCoRoutineCode, UBaseType_t uxPriority, UBaseType_t uxIndex)
unsigned long UBaseType_t
Create a new co-routine and add it to the list of co-routines that are ready to run.
- Parameters
-
| pxCoRoutineCode | Pointer to the co-routine function. Co-routine functions require special syntax - see the co-routine section of the WEB documentation for more information. |
| uxPriority | The priority with respect to other co-routines at which the co-routine will run. |
| uxIndex | Used to distinguish between different co-routines that execute the same function. See the example below and the co-routine section of the WEB documentation for further information. |
- Returns
- pdPASS if the co-routine was successfully created and added to a ready list, otherwise an error code defined with ProjDefs.h.
Example usage:
{
static const char cLedToFlash[ 2 ] = { 5, 6 };
static const TickType_t uxFlashRates[ 2 ] = { 200, 400 };
for( ;; )
{
vParTestToggleLED( cLedToFlash[ uxIndex ] );
crDELAY( xHandle, uxFlashRates[ uxIndex ] );
}
}
void vOtherFunction( void )
{
uint8_t ucParameterToPass;
for( uxIndex = 0; uxIndex < 2; uxIndex++ )
{
}
}
#define crDELAY(xHandle, xTicksToDelay)
struct tskTaskControlBlock * TaskHandle_t