Skip to content

2. API: Main Controller

waiweng83 edited this page Aug 11, 2015 · 7 revisions

These are the common function for the rero main controller.

LED Control

The LED on the rero main controller is a RGB LED and can be controlled independently.

LED Register:
LEDR = Red LED
LEDG = Green LED
LEDB = Blue LED

State:
1 = ON
0 = OFF

Example:

// Set the LED to yellow colour.
LEDR = 0;
LEDG = 1;
LEDB = 1;

Function: vTaskDelay

/*******************************************************************************
 * FUNCTION: vTaskDelay
 *
 * PARAMETERS:
 * ~ xTicksToDelay - The amount of time in tick periods to delay.
 *
 * RETURN:
 * ~ void
 *
 * DESCRIPTIONS:
 * Pause for the given period.
 *
 *******************************************************************************/
void vTaskDelay(const TickType_t xTicksToDelay);

Example:

while (1) {
    // Toggle blue LED every 500ms.
    LEDB ^= 1;
    vTaskDelay(500 / portTICK_RATE_MS);
}

Clone this wiki locally