-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.h
42 lines (36 loc) · 823 Bytes
/
common.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
#ifndef __COMMON_H__
#define __COMMON_H__
/* ========== DEFINEs ============ */
/*
D0 = 16;
D1 = 5;
D2 = 4;
D3 = 0;
D4 = 2;
D5 = 14;
D6 = 12;
D7 = 13;
D8 = 15;
D9 = 3;
D10 = 1;
A0 = 17
*/
#define MQ_PIN A0
#define OPERATIONAL_VOLTAGE (5.0)
#define ADC_MAX (10)
#define MAX_ADC_VALUE (1 << ADC_MAX) // MAX value for Analog -> Digital Convertor (ADC)
/* ========== ENUMs ============ */
typedef enum rc {
RC_SUCCESS_E = 0,
RC_FAILURE_E = 1,
RC_UNSUPPORTED,
} rc_t;
/* ========== STRUCTs ============ */
typedef struct graph_dots {
float x;
float y;
} graph_dots_t;
/* ========== FUNCTIONs ============ */
char *rc2str(rc_t rc);
bool is_time_expired(float period, unsigned long &prev_time);
#endif /* __COMMON_H__ */