X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FCORTEX_R4F_RZ_T_GCC_IAR%2Fsrc%2FBlinky_Demo%2Fmain_blinky.c;fp=FreeRTOS%2FDemo%2FCORTEX_R4F_RZ_T_GCC_IAR%2Fsrc%2FBlinky_Demo%2Fmain_blinky.c;h=d56487778fca4aede36195b5b1d634535ae70f2f;hb=7a0d4022a11aa7adcc64d3705dc99fbb73065ed7;hp=83d88be71d8f02f0767063459cc16d4fd7973f68;hpb=c6f0bc2af416b9c9db82534d9d47e8bc2568d114;p=freertos diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c index 83d88be71..d56487778 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c @@ -84,24 +84,14 @@ * * The Queue Send Task: * The queue send task is implemented by the prvQueueSendTask() function in - * this file. prvQueueSendTask() sits in a loop that causes it to repeatedly - * block for 200 milliseconds, before sending the value 100 to the queue that - * was created within main_blinky(). Once the value is sent, the task loops - * back around to block for another 200 milliseconds...and so on. + * this file. It sends the value 100 to the queue every 200 milliseconds. * * The Queue Receive Task: * The queue receive task is implemented by the prvQueueReceiveTask() function - * in this file. prvQueueReceiveTask() sits in a loop where it repeatedly - * blocks on attempts to read data from the queue that was created within - * main_blinky(). When data is received, the task checks the value of the - * data, and if the value equals the expected 100, toggles an LED. The 'block - * time' parameter passed to the queue receive function specifies that the - * task should be held in the Blocked state indefinitely to wait for data to - * be available on the queue. The queue receive task will only leave the - * Blocked state when the queue send task writes to the queue. As the queue - * send task writes to the queue every 200 milliseconds, the queue receive - * task leaves the Blocked state every 200 milliseconds, and therefore toggles - * the LED every 200 milliseconds. + * in this file. It blocks on the queue to wait for data to arrive from the + * queue send task - toggling the LED each time it receives the value 100. The + * queue send task writes to the queue every 200ms, so the LED should toggle + * every 200ms. */ /* Kernel includes. */ @@ -119,7 +109,7 @@ /* The rate at which data is sent to the queue. The 200ms value is converted to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) +#define mainQUEUE_SEND_FREQUENCY_MS ( pdMS_TO_TICKS( 200UL ) ) /* The number of items the queue can hold. This is 1 as the receive task will remove items as they are added, meaning the send task should always find @@ -225,7 +215,7 @@ const unsigned long ulExpectedValue = 100UL; is it the expected value? If it is, toggle the LED. */ if( ulReceivedValue == ulExpectedValue ) { - LED2 = !LED2; + LED0 = !LED0; ulReceivedValue = 0U; } }