8 #include "../cpu/cpu.h"
21 static ledDutyCycles_t ledDutyCycles [] =
23 { (200 / portTICK_RATE_MS), (800 / portTICK_RATE_MS) },
24 { (400 / portTICK_RATE_MS), (600 / portTICK_RATE_MS) },
25 { (600 / portTICK_RATE_MS), (400 / portTICK_RATE_MS) },
26 { (800 / portTICK_RATE_MS), (200 / portTICK_RATE_MS) },
29 xQueueHandle xLEDQueue;
34 portTASK_FUNCTION (vLEDFlashTask, pvParameters __attribute__ ((unused)))
36 portTickType ledTimeOn = 1;
37 portTickType ledTimeOff = 1;
38 portTickType lastTickTime;
42 // Create the queue, turn on LED and die if we can't
44 if ((xLEDQueue = xQueueCreate (1, sizeof (dutyCycle))) == 0)
46 GPIO0_IOSET = GPIO_IO_P10;
53 // Send ourselves a message to init the flash time
55 xQueueSend (xLEDQueue, &dutyCycle, (portTickType) 0);
58 // We need to initialise lastTickTime prior to the first call to vTaskDelayUntil()
60 lastTickTime = xTaskGetTickCount ();
64 vTaskDelayUntil (&lastTickTime, ledTimeOn);
65 GPIO0_IOSET = GPIO_IO_P10;
66 vTaskDelayUntil (&lastTickTime, ledTimeOff);
67 GPIO0_IOCLR = GPIO_IO_P10;
69 if (xQueueReceive (xLEDQueue, &dutyCycle, (portTickType) 0))
71 dutyCycle %= arrsizeof (ledDutyCycles);
73 ledTimeOn = ledDutyCycles [dutyCycle].timeOn;
74 ledTimeOff = ledDutyCycles [dutyCycle].timeOff;