-
Notifications
You must be signed in to change notification settings - Fork 0
/
fifo.h
51 lines (36 loc) · 1.05 KB
/
fifo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* fifo.h
* Data Structure Implementation
* Created on: Nov 4, 2022
* Author: Sonal Tamrakar
*/
#ifndef FIFO_H_
#define FIFO_H_
#include <stdio.h>
#include <stdlib.h>
struct fifo_t {
// Task information
int fifo_size;
struct node_t *head;
};
//Create the FIFO data structure and accessor function to store the state transitions of each button.
struct node_t{
int btn; // 0 or 1
struct node_t *next;
};
//Create the FIFO data structure and accessor function to store the state transitions of each button.
//Create the data structure to store the Vehicle Speed Data.
struct speed_t{
int current_speed;
};
//Create the data structure to store the Vehicle Speed Data.
//Create the data structure to store the Vehicle Direction Data.
struct direction_t{
int current_direction;
};
//Create the data structure to store the Vehicle Direction Data.
struct node_t* create_new_node(int button);
struct node_t* peek(struct node_t* list_head);
void pop(struct node_t** head);
void push(struct node_t**head, int button);
#endif /* FIFO_H_ */