-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathev.c
executable file
·56 lines (55 loc) · 1.26 KB
/
ev.c
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
52
53
54
55
56
#include "ev.h"
#include "i2c_machine.h"
#include "thermometer.h"
#include "accel.h"
#include "average.h"
#include "c8051f020.h"
#include "util.h"
#include "display.h"
unsigned int ev_flags = 0;
sbit Led = P1^6;
void dispatch(){
unsigned char asd = 1;
if(!i2c_lock){
IF_EV(ev_init_accel) {
EV_DISABLE(ev_init_accel);
init_accel();
}else IF_EV(ev_rcv_axis){
EV_DISABLE(ev_rcv_axis);
rcv_axis();
} else IF_EV(ev_read_axis){
EV_DISABLE(ev_read_axis);
read_axis();
} else IF_EV(ev_display_clear){
EV_DISABLE(ev_display_clear);
display_clear(ev_display_write_1);
}else IF_EV(ev_thermometer_read){
EV_DISABLE(ev_thermometer_read);
thermometer_read();
}else IF_EV(ev_display_write_1){
EV_DISABLE(ev_display_write_1);
display_write_data_1();
}else IF_EV(ev_display_write_2){
EV_DISABLE(ev_display_write_2);
display_write_data_2();
}else IF_EV(ev_display_cursor_move){
EV_DISABLE(ev_display_cursor_move);
display_go_to_addr(0x40, ev_display_write_2);
}
}
if(SI){
i2c_state_machine();
}
IF_EV(ev_average){
EV_DISABLE(ev_average);
calc_average();
}
IF_EV(ev_thermometer_save){
EV_DISABLE(ev_thermometer_save);
thermometer_save();
}
IF_EV(ev_check_average){
EV_DISABLE(ev_check_average);
check_average();
}
}