Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

inclade \"rims.h state BL LedotE 78 4. typedef struet task t 7. unsigned long el

ID: 3852381 • Letter: I

Question

inclade "rims.h state BL LedotE 78 4. typedef struet task t 7. unsigned long elapsedtine: .task 1. task tasks121 default l I Teansitions case i edoff: unsigned long period int rickFct) (iat) 84 avitch(state) break: case BL Ledo: 13. const unsigned char tasksNum2 14. const unsigned long periodnlinkted 1500 5.const unsigned long periodThreeLeds 500 09 90 break: default: 17,const unsigned long tasksPerlodocD-500 3 State actions 94 return state 19. int TickFct BlinkLed (int statela 20. int TickFet TheeeLeds (int state) L State 22- unsigned chaz processingRdyTasks- 23, void 7ierISRO 98enum 71 StatesTL O. TI. TL T2 99 int Tiekret Threeteds tint cate) T unsigned char ii VARIABLES MUST BE DECLARED STATIC 25. f (processingRdytasks) /9e.g., static int 02°/ princt "period too short n variables for state machine go here. 27 20 processingRdyTasks-1 avitch (state) case -1: 103 state TL TO 30 if tasks [1].elapsedrine >. tasks[4]-period } { case TL 20 108. tasksti) state tasks [1].elapsedine 31. state- break tasks(i1-TickFct(tasksti].state) 0: 36. pocessingRdyTasks-0 state - TL 22: state . T1-2; 11S 116 38. int maino 39 40 nsigned char i- 41 tasks().state- -1 42. tasks[41-period- periodBlinkted 43 taska(4)-elapsedrine-tasksI4 Peziod: break: case TL T2 118 it ) t state-TL TO break: tasks(i).TickFct-sTickFct Blinkted default: state .-1; 46 + tasksti].state- avitch (atate) 48 tasks[4]-period periodThzeeLeds: 49 tasks[i)-elapsedrine tasksfil perioda so. tasks[1].tickFct·tickFct ThreeLeds; case TL 70 B5.17 131 54. Tineron case TL 71: 6 le(1)Sleep): 57 6-1 57-0 break: 8 r return 5-02 1. enun BL states BL Ledort, BL Ledon st State: 139 62. int Tickret Blinktednt state) 3 VARTABTES MOST BE DECLARED STATIC/ 64.e.g, static int x-0 65. /.variables tor state machine go here*/ 66 witch (state) 67 87-1: 141 default: 143 return state state Ledoff case Bt Ledofe: break: 76.

Explanation / Answer

1)Option 3 is the answer as it defines state machine's data

2)Line 8 (structure variable point to tick function

3)Line 11 creates an array of tasks.

4)Lines 13-14 initialization has been done for the tasks.

5)Line 23 starts real time for scheduler.

6)Line 56, its moving from main to sleep().

7)Line 25 checks condition for unfinished tasks

8)Line 17 initialize the timer for GCD.

11)Line 56, goes to sleep(), Hence power down.

8)