diff options
| author | Nis Sarup <nis@sarup.dk> | 2011-06-21 17:02:06 +0200 |
|---|---|---|
| committer | Nis Sarup <nis@sarup.dk> | 2011-06-21 17:02:06 +0200 |
| commit | 496875dc83003ca33b99494a6606fd7744e43b30 (patch) | |
| tree | 6823c2549f27c160f6f49fd5ea87cb4573d2d027 /examples | |
| parent | c1a7fa7aadb73c26ddac76a5eb3ffad4d6526d92 (diff) | |
FreeRTOS: Added FreeRTOS 7.0.1, including hook in libmaple/systick.c and example blinky.
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/freertos-blinky.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/freertos-blinky.cpp b/examples/freertos-blinky.cpp new file mode 100755 index 0000000..acdfc0f --- /dev/null +++ b/examples/freertos-blinky.cpp @@ -0,0 +1,38 @@ +#include "wirish.h" +#include "libraries/FreeRTOS/MapleFreeRTOS.h" + +static void vLEDFlashTask( void *pvParameters ) { + for(;;) { + vTaskDelay(1000); + digitalWrite(BOARD_LED_PIN, HIGH); + vTaskDelay(50); + digitalWrite(BOARD_LED_PIN, LOW); + } +} + +void setup() { + // initialize the digital pin as an output: + pinMode(BOARD_LED_PIN, OUTPUT); + + xTaskCreate( vLEDFlashTask, ( signed portCHAR * ) "Task1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 2, NULL ); + vTaskStartScheduler(); +} + +void loop() { + // Insert background code here +} + +// Force init to be called *first*, i.e. before static object allocation. +// Otherwise, statically allocated objects that need libmaple may fail. +__attribute__((constructor)) void premain() { + init(); +} + +int main(void) { + setup(); + + while (true) { + loop(); + } + return 0; +} |
