RobertBerger icon

Untitled

RobertBerger | PRO | 07/25/24 01:29:36 PM UTC | 0 ⭐ | 463 👁️ | Never ⏰ | []
text |

1.22 KB

|

None

|

0 👍

/

0 👎

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();
		/* 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();
			}
		}
 		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);
		}
	}
}
 

Comments