-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcustom_board.h
161 lines (132 loc) · 3.71 KB
/
custom_board.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/**
*
* @file custom_board.h
*
* @date May 24, 2017
* @author hamster
*
* This is the custom board defines for the LEDs and etc on the DC25 badge
*
*/
#ifndef DC801_H
#define DC801_H
#ifdef __cplusplus
extern "C" {
#endif
// LEDs definitions
// Low is active
#define LEDS_ACTIVE_STATE 0
// LED Pins
// Helmet Wings
// Right, from center
#define LED_WING_RIGHT_RED_1 1
#define LED_WING_RIGHT_RED_2 2
#define LED_WING_RIGHT_RED_3 6
// Left, from center
#define LED_WING_LEFT_RED_1 7
#define LED_WING_LEFT_RED_2 8
#define LED_WING_LEFT_RED_3 9
// Helmet
#define LED_HELMET_YELLOW_1 25
#define LED_HELMET_YELLOW_2 26
#define LED_HELMET_YELLOW_3 27
#define LED_HELMET_YELLOW_4 28
#define LED_HELMET_YELLOW_5 30
#define LED_HELMET_YELLOW_6 31
#define LED_HELMET_YELLOW_7 0
// Eyes
// Right
#define LED_EYE_RIGHT_RED 15
#define LED_EYE_RIGHT_GREEN 14
//#define LED_EYE_RIGHT_BLUE 12 // only on proto boards
#define LED_EYE_RIGHT_BLUE 13
// Left
#define LED_EYE_LEFT_RED 16
#define LED_EYE_LEFT_GREEN 17
#define LED_EYE_LEFT_BLUE 18
// Arrays to make iteration easy
// The Nordic SDK uses LEDS_LIST internally
#define LEDS_LIST { \
LED_WING_RIGHT_RED_1, \
LED_WING_RIGHT_RED_2, \
LED_WING_RIGHT_RED_3, \
LED_WING_LEFT_RED_1, \
LED_WING_LEFT_RED_2, \
LED_WING_LEFT_RED_3, \
LED_HELMET_YELLOW_1, \
LED_HELMET_YELLOW_2, \
LED_HELMET_YELLOW_3, \
LED_HELMET_YELLOW_4, \
LED_HELMET_YELLOW_5, \
LED_HELMET_YELLOW_6, \
LED_HELMET_YELLOW_7, \
LED_EYE_RIGHT_RED, \
LED_EYE_RIGHT_GREEN, \
LED_EYE_RIGHT_BLUE, \
LED_EYE_LEFT_RED, \
LED_EYE_LEFT_GREEN, \
LED_EYE_LEFT_BLUE }
#define LEDS_NUMBER 19
// LEDs in the helmet
#define HELMET_LEDS { \
LED_HELMET_YELLOW_1, \
LED_HELMET_YELLOW_2, \
LED_HELMET_YELLOW_3, \
LED_HELMET_YELLOW_4, \
LED_HELMET_YELLOW_5, \
LED_HELMET_YELLOW_6, \
LED_HELMET_YELLOW_7 }
#define HELMET_LEDS_NUMBER 7
static const uint32_t helmet_led_list[HELMET_LEDS_NUMBER] = HELMET_LEDS;
// LEDs in the helmet wings
#define WING_LEDS { \
LED_WING_RIGHT_RED_1, \
LED_WING_RIGHT_RED_2, \
LED_WING_RIGHT_RED_3, \
LED_WING_LEFT_RED_1, \
LED_WING_LEFT_RED_2, \
LED_WING_LEFT_RED_3 }
#define WING_LEDS_NUMBER 6
static const uint32_t wing_led_list[WING_LEDS_NUMBER] = WING_LEDS;
// Push buttons
#define BUTTONS_NUMBER 6
#define USER_BUTTON_1 3
#define USER_BUTTON_2 4
#define USER_BUTTON_3 10
#define USER_BUTTON_4 11
#define TAIL_TOUCH 5
#define EAR_TOUCH 29
#define LONG_PRESS_MASK 0x8000
#define USER_BUTTON_1_LONG (3 | LONG_PRESS_MASK)
#define USER_BUTTON_2_LONG (4 | LONG_PRESS_MASK)
#define USER_BUTTON_3_LONG (10 | LONG_PRESS_MASK)
#define USER_BUTTON_4_LONG (11 | LONG_PRESS_MASK)
#define TAIL_TOUCH_LONG (5 | LONG_PRESS_MASK)
#define EAR_TOUCH_LONG (29 | LONG_PRESS_MASK)
#define BUTTONS_LIST { \
USER_BUTTON_1, \
USER_BUTTON_2, \
USER_BUTTON_3, \
USER_BUTTON_4, \
TAIL_TOUCH, \
EAR_TOUCH }
// Low is active
#define BUTTONS_ACTIVE_STATE 0
// Don't need a pull up
#define BUTTON_PULL 0
// Just one speaker
#define SPEAKER 19
// LCD
// The SPI ports are defined in the config/sdk_config.h
#define LCD_RESET 23
// Clock
// Low frequency clock source to be used by the SoftDevice
// We're using the internal RC osc
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_RC, \
.rc_ctiv = 1, \
.rc_temp_ctiv = 2, \
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
#ifdef __cplusplus
}
#endif
#endif // DC801_H