blob: 6f82d71cbb695b87420e5a52e2577e1734b182b9 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 | #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;
}
 |