-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
60 lines (44 loc) · 1.19 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef _COMMON_H
#define _COMMON_H
#include <Time.h>
#define IDLE_TIMEOUT_TIMER 0
#define IDLE_TIMEOUT_MS 60000
#define LED_TIMER 1
#define LED_FLASH_ON_MS 10
#define LED_FLASH_OFF_MS 200
#define LOCAL_TIME_OFFSET (3 * SECS_PER_HOUR)
#define localtime2utc(time) ((time) - LOCAL_TIME_OFFSET)
#define BT_EN_POWEROFF_TIMEOUT_MS 10000
#define ARRAY_SIZE(_a) (sizeof(_a) / sizeof((_a)[0]))
#define NUM_CHANNELS 2
#define THRESHOLD 25
#define HYSTERESIS 6
#define MAX_HITS 32
#define LED_PIN 4
#define PRESSURE_SENS_EN_PIN 3
#define PWR_ON_PIN 8
#define BT_EN_PIN 17
#define BT_STATE_PIN 9
#define BT_START_PIN 2
#define BATT_MEASURE_PIN A6
enum bt_mode {
BT_AUTO,
BT_PERMANENT,
};
struct hit {
uint8_t channel;
uint16_t time;
};
/* 50 cm between two parallel sensors */
const float sensors_spacing = 0.5;
extern bool raw_measuring;
extern enum bt_mode bluetooth_mode;
extern volatile bool bt_enabled;
extern uint8_t idle_sleep_mode;
unsigned short readBattery_mV();
char *itoa_10lz(char *buf, uint16_t val, uint8_t digits);
#define STRBUF_TIME_SIZE 20
char *sprintf_time(char *buf, time_t time);
void printTime(time_t time);
void set_bluetooth_mode(enum bt_mode mode);
#endif /* _COMMON_H */