Question: #include #include tm4c_switches.h #include tm4c_leds.h // Defined in display.s extern uint32_t get_next_index0(uint32_t); extern uint32_t get_next_index1(uint32_t); extern uint32_t get_next_index2(uint32_t); void delay(void); int main(void) { uint8_t pattern[]

#include #include "tm4c_switches.h" #include "tm4c_leds.h" // Defined in display.s extern uint32_t get_next_index0(uint32_t); extern uint32_t get_next_index1(uint32_t); extern uint32_t get_next_index2(uint32_t); void delay(void); int main(void) { uint8_t pattern[] = {0, 1, 3, 2, 6, 7, 5, 4}; uint32_t pattern_index = 0; tm4c_sw_init(); tm4c_leds_init(); for(;;){ bool sw1 = tm4c_sw1_is_pressed(); bool sw2 = tm4c_sw2_is_pressed(); bool both = sw1 && sw2; if( both ){ pattern_index = get_next_index0(pattern_index); } else if( sw1 ){ pattern_index = get_next_index1(pattern_index); } else if( sw2 ){ pattern_index = get_next_index2(pattern_index); } else{ pattern_index = 0; } if( pattern_index >=8 ){ // If your project ends up here, you did not ensure // the index is in the range 0-7 (three bits). while(1); } tm4c_set_leds(pattern[pattern_index]); delay(); } } void delay(void){ for(int i = 2000000; i>0; --i); }

Create three flowcharts that describe your implementation of the get_next_index0, get_next_index1, and get_next_index2 functions. In C, the functions are defined on lines 6-8 of the main.c file (ignore the extern keyword). For the flowcharts, you can think of a uint32_t as a number.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!