Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* traffic light FSM */
- void vTask2(void *pvParameters) {
- const char *pcTaskName = "Task 2 is running\n";
- int *pxPedestrianMessage;
- int pedestrianVal;
- current_state = STATE_0;
- /* As per most tasks, this task is implemented in an infinite loop. */
- for (;;) {
- /* Print out the name of this task. */
- vPrintString(pcTaskName);
- /* here we are in STATE_0 */
- long_delay();
- FSM(EVENT_FOR_STATE_1);
- short_delay();
- FSM(EVENT_FOR_STATE_2);
- short_delay();
- FSM(EVENT_FOR_STATE_3);
- short_delay();
- FSM(EVENT_FOR_STATE_4);
- long_delay();
- FSM(EVENT_FOR_STATE_5);
- short_delay();
- FSM(EVENT_FOR_STATE_6);
- short_delay();
- #if 0
- /* don't block on message */
- if (xQueueReceive( xQPedestrian, &( pxPedestrianMessage ), ( portTickType ) 0 )) {
- /* pxPedestrianMessage either enables or disables
- * the pedestrian functionality
- */
- if ((int) pxPedestrianMessage == 1) {
- FSM(EVENT_FOR_STATE_8);
- long_delay();
- FSM(EVENT_FOR_STATE_9);
- short_delay();
- }
- }
- #endif
- FSM(EVENT_FOR_STATE_7);
- short_delay();
- FSM(EVENT_FOR_STATE_0);
- /* here we are back to STATE_0
- * let's re-enable the shell in case it was disabled before
- */
- if (GetUseInputVal() == 0) {
- SetUseInputVal(1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement