Answered step by step
Verified Expert Solution
Question
1 Approved Answer
67. nt TickFct BlinkLed (int state) 68. /YARIABLES MUST BE DECLARED STATIC/ 69. /e.g, static int x0/ 70. /Def ine user variables for this state
67. nt TickFct BlinkLed (int state) 68. /YARIABLES MUST BE DECLARED STATIC/ 69. /e.g, static int x0/ 70. /Def ine user variables for this state sachine here 2. This code vas aut onat ically ene rated using the Riverside-Irvine State nachine Bui l der tool 3. Version 2.5 10/18/2012 10:2:14 PST 6. tinclude rins.h sitch(state) II case1 break; case BL Ledoff: 9. /*This code vill be shared beteen state machines./ 10. typedef struct task 1 int state: 12. unsigned long period; 13. unsined long elapsedTine 14. int (TickFct)(int) 15. 1 task: 75 76 state BL LedOn; break; if (1) 78 79 case BL Ledon: state BL Ledoff: break: state-1: 17. task tasks(21: 19. const unsigned char tasksNun 2; 20. const unsigned long periodBl inkLed 1500; 21 cnst unsigned long period default ThreeLeds 500; I I Transitions 23. const unsi gned long tasksPeriodGCD 500; 89. sritch(state) I/ case BL LedOff: 25. int TickFct BlinkLed (int state) 26. int Tickfct ThreeLeds (int state); 27 28. unsigned char process ingRdyTasks 0; 29. void TISR 30 unsi aned chari; 3 (processin RdyTasks) BO-0; break case BL Ledon 94. break: default: /i break: printf( Period too short to complete tasksVn) 34. processi ngRdy Tasks1; 35. for (i 0; i tasksNun; ++i) 36 98. /I State actions 99. BL State state; 100 return state; if (tasks[i].elapsedTie tasksi].period) I tasks[il.state tasks[il.TickFct (t asks[i].state); 102 38 tasks [i].elapsedT ine0; 104. enum TL States TL TO, TLTI, TL T2 TL State; 105. int TickFet Threeleds(int state) 106 VARIABLES MUST BE DECLARED STATIC/ 107. e-., static int x0; 108. /Define user variables for this state nachine here. 109 sritch state) II tasks [i].elapsedTine tasksPeriodGCD 42. pracessi naRdy Tasks 0; 44. int ain) I 45. I/ Priority assined to lover position tasks in array 46. unsigned char iD; 47. tasks[i].state1 48. taskslil.period periodBl inkLed 4 tasks[i].elapsedTi netasks [i].period; 50, tasks[i].rickFet=&Tickfct_BI inkLed; case -1: reak: case TL TO: state TL TI break: case TL TI: 52. Hi 53 tasks[i].state1 54. tasks[i].period periodThreeleds 55 tasks[i].elapsedinetasksi.period 56. tasks[i].TickFctTickFct ThreeLeds; 120 121 122 123 124 state TL T2: break case TL T2: 58 ; 59. Tineret (tasksPer i odGCD) 60 TinerOn) 62. while(I) Sleep: 64. return 0 Text I: Program Listing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started