forked from TTK4145/Project-resources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelevator.h
36 lines (27 loc) · 887 Bytes
/
elevator.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
#pragma once
#include "elevator_io_types.h"
typedef enum {
EB_Idle,
EB_DoorOpen,
EB_Moving
} ElevatorBehaviour;
typedef enum {
// Assume everyone waiting for the elevator gets on the elevator, even if
// they will be traveling in the "wrong" direction for a while
CV_All,
// Assume that only those that want to travel in the current direction
// enter the elevator, and keep waiting outside otherwise
CV_InDirn,
} ClearRequestVariant;
typedef struct {
int floor;
Dirn dirn;
int requests[N_FLOORS][N_BUTTONS];
ElevatorBehaviour behaviour;
struct {
ClearRequestVariant clearRequestVariant;
double doorOpenDuration_s;
} config;
} Elevator;
void elevator_print(Elevator es);
Elevator elevator_uninitialized(void);