From 4755bd8fe252ffdc07de99e11ef049402f875108 Mon Sep 17 00:00:00 2001 From: Nis Sarup Date: Tue, 21 Jun 2011 17:02:06 +0200 Subject: FreeRTOS: Added FreeRTOS 7.0.1, including hook in libmaple/systick.c and example blinky. --- examples/freertos-blinky.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 examples/freertos-blinky.cpp (limited to 'examples') 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; +} -- cgit v1.2.3