summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/Common/Minimal/flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Demo/Common/Minimal/flash.c')
-rw-r--r--FreeRTOS/Demo/Common/Minimal/flash.c101
1 files changed, 50 insertions, 51 deletions
diff --git a/FreeRTOS/Demo/Common/Minimal/flash.c b/FreeRTOS/Demo/Common/Minimal/flash.c
index c65ae57ac..43935ab43 100644
--- a/FreeRTOS/Demo/Common/Minimal/flash.c
+++ b/FreeRTOS/Demo/Common/Minimal/flash.c
@@ -49,12 +49,12 @@
#include "partest.h"
#include "flash.h"
-#define ledSTACK_SIZE configMINIMAL_STACK_SIZE
-#define ledNUMBER_OF_LEDS ( 3 )
-#define ledFLASH_RATE_BASE ( ( TickType_t ) 333 )
+#define ledSTACK_SIZE configMINIMAL_STACK_SIZE
+#define ledNUMBER_OF_LEDS ( 3 )
+#define ledFLASH_RATE_BASE ( ( TickType_t ) 333 )
/* Variable used by the created tasks to calculate the LED number to use, and
-the rate at which they should flash the LED. */
+ * the rate at which they should flash the LED. */
static volatile UBaseType_t uxFlashTaskNumber = 0;
/* The task that is created three times. */
@@ -64,56 +64,55 @@ static portTASK_FUNCTION_PROTO( vLEDFlashTask, pvParameters );
void vStartLEDFlashTasks( UBaseType_t uxPriority )
{
-BaseType_t xLEDTask;
-
- /* Create the three tasks. */
- for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
- {
- /* Spawn the task. */
- xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
- }
+ BaseType_t xLEDTask;
+
+ /* Create the three tasks. */
+ for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
+ {
+ /* Spawn the task. */
+ xTaskCreate( vLEDFlashTask, "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( TaskHandle_t * ) NULL );
+ }
}
/*-----------------------------------------------------------*/
static portTASK_FUNCTION( vLEDFlashTask, pvParameters )
{
-TickType_t xFlashRate, xLastFlashTime;
-UBaseType_t uxLED;
-
- /* The parameters are not used. */
- ( void ) pvParameters;
-
- /* Calculate the LED and flash rate. */
- portENTER_CRITICAL();
- {
- /* See which of the eight LED's we should use. */
- uxLED = uxFlashTaskNumber;
-
- /* Update so the next task uses the next LED. */
- uxFlashTaskNumber++;
- }
- portEXIT_CRITICAL();
-
- xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( TickType_t ) uxLED );
- xFlashRate /= portTICK_PERIOD_MS;
-
- /* We will turn the LED on and off again in the delay period, so each
- delay is only half the total period. */
- xFlashRate /= ( TickType_t ) 2;
-
- /* We need to initialise xLastFlashTime prior to the first call to
- vTaskDelayUntil(). */
- xLastFlashTime = xTaskGetTickCount();
-
- for(;;)
- {
- /* Delay for half the flash period then turn the LED on. */
- vTaskDelayUntil( &xLastFlashTime, xFlashRate );
- vParTestToggleLED( uxLED );
-
- /* Delay for half the flash period then turn the LED off. */
- vTaskDelayUntil( &xLastFlashTime, xFlashRate );
- vParTestToggleLED( uxLED );
- }
+ TickType_t xFlashRate, xLastFlashTime;
+ UBaseType_t uxLED;
+
+ /* The parameters are not used. */
+ ( void ) pvParameters;
+
+ /* Calculate the LED and flash rate. */
+ portENTER_CRITICAL();
+ {
+ /* See which of the eight LED's we should use. */
+ uxLED = uxFlashTaskNumber;
+
+ /* Update so the next task uses the next LED. */
+ uxFlashTaskNumber++;
+ }
+ portEXIT_CRITICAL();
+
+ xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( TickType_t ) uxLED );
+ xFlashRate /= portTICK_PERIOD_MS;
+
+ /* We will turn the LED on and off again in the delay period, so each
+ * delay is only half the total period. */
+ xFlashRate /= ( TickType_t ) 2;
+
+ /* We need to initialise xLastFlashTime prior to the first call to
+ * vTaskDelayUntil(). */
+ xLastFlashTime = xTaskGetTickCount();
+
+ for( ; ; )
+ {
+ /* Delay for half the flash period then turn the LED on. */
+ vTaskDelayUntil( &xLastFlashTime, xFlashRate );
+ vParTestToggleLED( uxLED );
+
+ /* Delay for half the flash period then turn the LED off. */
+ vTaskDelayUntil( &xLastFlashTime, xFlashRate );
+ vParTestToggleLED( uxLED );
+ }
} /*lint !e715 !e818 !e830 Function definition must be standard for task creation. */
-