forked from multiwii/multiwii-firmware
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Alarms.h
104 lines (96 loc) · 1.88 KB
/
Alarms.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef ALARMS_H_
#define ALARMS_H_
void blinkLED(uint8_t num, uint8_t ontime,uint8_t repeat);
uint8_t isBuzzerON(void);
void alarmHandler(void);
void vario_signaling(void);
void i2CLedRingState(void);
void blinkLedRing(void);
void auto_switch_led_flasher();
void init_led_flasher();
void led_flasher_set_sequence(uint8_t s);
void led_flasher_autoselect_sequence();
void init_landing_lights(void);
void auto_switch_landing_lights(void);
void PilotLamp(uint8_t count);
/*
AlarmArray
0: toggle
1: failsafe
2: noGPS
3: beeperOn
4: pMeter
5: runtime
6: vBat
7: confirmation
8: Acc
9: I2C Error
*/
enum alrm_fac {
ALRM_FAC_TOGGLE = 0,
ALRM_FAC_FAILSAFE,
ALRM_FAC_GPS,
ALRM_FAC_BEEPERON,
ALRM_FAC_PMETER,
ALRM_FAC_RUNTIME,
ALRM_FAC_VBAT,
ALRM_FAC_CONFIRM,
ALRM_FAC_ACC,
ALRM_FAC_I2CERROR,
ALRM_FAC_SIZE, // MUST be LAST - used for size of array alarmArray
};
/*
Resources:
0: onboard LED
1: Buzzer
2: PL GREEN
3: PL BLUE
4: PL RED
*/
enum alrm_res {
ALRM_RES_LED = 0,
ALRM_RES_BUZZER,
ALRM_RES_PL_GREEN,
ALRM_RES_PL_BLUE,
ALRM_RES_PL_RED,
ALRM_RES_PL ,
ALRM_RES_ANY ,
};
enum alrm_lvl_onoff {
ALRM_LVL_OFF = 0,
ALRM_LVL_ON = 1,
};
enum alrm_lvl_failsafe {
ALRM_LVL_FAILSAFE_FINDME = 1,
ALRM_LVL_FAILSAFE_PANIC,
};
enum alrm_lvl_toggle {
ALRM_LVL_TOGGLE_1 = 1,
ALRM_LVL_TOGGLE_2 ,
ALRM_LVL_TOGGLE_ELSE ,
};
#if GPS
enum alrm_lvl_gps {
ALRM_LVL_GPS_NOFIX = 2,
};
#endif
#ifdef VBAT
enum alrm_lvl_vbat {
ALRM_LVL_VBAT_INFO = 1,
ALRM_LVL_VBAT_WARN ,
ALRM_LVL_VBAT_CRIT ,
};
#endif
enum alrm_lvl_confirm {
ALRM_LVL_CONFIRM_1 = 1,
ALRM_LVL_CONFIRM_2 ,
ALRM_LVL_CONFIRM_ELSE ,
};
#define SET_ALARM(fac, level) alarmArray[fac] = level
#ifdef BUZZER
#define SET_ALARM_BUZZER(fac, level) SET_ALARM( fac, level)
#else
#define SET_ALARM_BUZZER(fac, level)
#endif
#define IS_ALARM_SET(fac, level) ( alarmArray[fac] == level )
#endif /* ALARMS_H_ */