Question: The Queue is declared in event.h. Implement the four functions of Queue in event.c. main.c (source code provided below) Copy your code in event.c to

The Queue is declared in event.h. Implement the four functions of Queue in event.c. main.c (source code provided below)

Copy your code in event.c to your report and comment your code.

*************************Event.c*************************

#include "event.h" // same event only exists once in que // initialize all elements in Queue to END void initQueue(Queue* que) { } // test if Queue has pending events bool isEmpty(Queue* que) { } // return the current pending event and replace the current with the next event uint8_t pop(Queue* que) { } // add a new event to Queue. // if ev is not in que, alway append ev to the end of que // if ev is in que already, do not append ev void append(Queue* que, uint8_t ev) { } 

*************************Main.c*************************

#include "event.h" Queue queue; int main() { // initialize scheduler initQueue(&queue); while (1) { // queue loop while (!isEmpty(&queue)) { // get the event in queue uint8_t event = pop(&queue); // run state machine on the event // could use any state machine implementation handleEvent(event); } } return 0; } 

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 Programming Questions!