20
20
#define _VARIANT_PARTICLE_XENON_
21
21
22
22
#define _PINNUM (port , pin ) ((port)*32 + (pin))
23
+ #define NRF52
23
24
24
25
/** Master clock frequency */
25
26
#define VARIANT_MCK (64000000ul)
@@ -69,98 +70,91 @@ extern "C"
69
70
#define PIN_D19 _PINNUM(0, 3)
70
71
#define PIN_D20 _PINNUM(0, 11)
71
72
72
- static const uint8_t D0 = PIN_D0 ;
73
- static const uint8_t D1 = PIN_D1 ;
74
- static const uint8_t D2 = PIN_D2 ;
75
- static const uint8_t D3 = PIN_D4 ;
76
- static const uint8_t D5 = PIN_D5 ;
77
- static const uint8_t D6 = PIN_D6 ;
78
- static const uint8_t D7 = PIN_D7 ;
79
- static const uint8_t D8 = PIN_D8 ;
80
- static const uint8_t D9 = PIN_D9 ;
81
- static const uint8_t D10 = PIN_D10 ;
82
- static const uint8_t D11 = PIN_D11 ;
83
- static const uint8_t D12 = PIN_D12 ;
84
- static const uint8_t D13 = PIN_D13 ;
85
- static const uint8_t D14 = PIN_D14 ;
86
- static const uint8_t D15 = PIN_D15 ;
87
- static const uint8_t D16 = PIN_D16 ;
88
- static const uint8_t D17 = PIN_D17 ;
89
- static const uint8_t D18 = PIN_D18 ;
90
- static const uint8_t D19 = PIN_D19 ;
91
- static const uint8_t D20 = PIN_D20 ;
73
+ static const uint8_t D0 = (0 );
74
+ static const uint8_t D1 = (1 );
75
+ static const uint8_t D2 = (2 );
76
+ static const uint8_t D3 = (3 );
77
+ static const uint8_t D4 = (4 );
78
+ static const uint8_t D5 = (5 );
79
+ static const uint8_t D6 = (6 );
80
+ static const uint8_t D7 = (7 );
81
+ static const uint8_t D8 = (8 );
82
+ static const uint8_t D9 = (9 );
83
+ static const uint8_t D10 = (10 );
84
+ static const uint8_t D11 = (11 );
85
+ static const uint8_t D12 = (12 );
86
+ static const uint8_t D13 = (13 );
87
+ static const uint8_t D14 = (14 );
88
+ static const uint8_t D15 = (15 );
89
+ static const uint8_t D16 = (16 );
90
+ static const uint8_t D17 = (17 );
91
+ static const uint8_t D18 = (18 );
92
+ static const uint8_t D19 = (19 );
93
+ static const uint8_t D20 = (20 );
92
94
93
95
// LEDs
94
96
#define LEDS_NUMBER 1
95
- #define LED_PRIMARY_PIN _PINNUM(1, 12)
96
97
#define LED_STATE_ON 1
97
- #define LED_PRIMARY_IDX 0
98
- #define LED_RGB_RED_IDX 1
99
- #define LED_RGB_GREEN_IDX 2
100
- #define LED_RGB_BLUE_IDX 3
101
-
102
- #define LED_RGB_RED_PIN _PINNUM(0, 13)
103
- #define LED_RGB_GREEN_PIN _PINNUM(0, 14)
104
- #define LED_RGB_BLUE_PIN _PINNUM(0, 15)
98
+
105
99
#define BOARD_RGB_BRIGHTNESS 0x202020
106
100
107
- static const uint8_t LED_BUILTIN = LED_PRIMARY_PIN ;
108
- static const uint8_t LED_RGB_RED = LED_RGB_RED_PIN ;
109
- static const uint8_t LED_RGB_GREEN = LED_RGB_GREEN_PIN ;
110
- static const uint8_t LED_RGB_BLUE = LED_RGB_BLUE_PIN ;
101
+ static const uint8_t LED_BUILTIN = ( 22 ) ;
102
+ static const uint8_t LED_RGB_RED = ( 23 ) ;
103
+ static const uint8_t LED_RGB_GREEN = ( 24 ) ;
104
+ static const uint8_t LED_RGB_BLUE = ( 25 ) ;
111
105
112
106
// Buttons
113
107
#define BUTTONS_NUMBER 2
114
- #define BUTTON_DFU _PINNUM(0, 11 )
115
- #define BUTTON_FRESET _PINNUM(0, 03 ) // A0
108
+ #define BUTTON_DFU (20 )
109
+ #define BUTTON_FRESET (21 ) // A0
116
110
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
117
111
118
- static const uint8_t BUTTON_MODE = PIN_D20 ;
112
+ static const uint8_t BUTTON_MODE = ( 20 ) ;
119
113
120
114
// Antenna
121
- #define ANTENNA_SWITCH_1 _PINNUM(0, 24 )
122
- #define ANTENNA_SWITCH_2 _PINNUM(0, 25 )
115
+ #define ANTENNA_SWITCH_1 (26 )
116
+ #define ANTENNA_SWITCH_2 (27 )
123
117
124
118
// NFC
125
- #define NFC1 _PINNUM(0, 9 )
126
- #define NFC2 _PINNUM(0, 10 )
119
+ #define NFC1 (28 )
120
+ #define NFC2 (29 )
127
121
128
122
/*
129
123
* Analog pins
130
124
*/
131
- #define PIN_A0 _PINNUM(0, 3 )
132
- #define PIN_A1 _PINNUM(0, 4 )
133
- #define PIN_A2 _PINNUM(0, 28 )
134
- #define PIN_A3 _PINNUM(0, 29 )
135
- #define PIN_A4 _PINNUM(0, 30 )
136
- #define PIN_A5 _PINNUM(0, 31 )
137
-
138
- static const uint8_t A0 = PIN_A0 ;
139
- static const uint8_t A1 = PIN_A1 ;
140
- static const uint8_t A2 = PIN_A2 ;
141
- static const uint8_t A3 = PIN_A3 ;
142
- static const uint8_t A4 = PIN_A4 ;
143
- static const uint8_t A5 = PIN_A5 ;
125
+ #define PIN_A0 (30 )
126
+ #define PIN_A1 (31 )
127
+ #define PIN_A2 (32 )
128
+ #define PIN_A3 (33 )
129
+ #define PIN_A4 (34 )
130
+ #define PIN_A5 (35 )
131
+
132
+ static const uint8_t A0 = PIN_A0 ;
133
+ static const uint8_t A1 = PIN_A1 ;
134
+ static const uint8_t A2 = PIN_A2 ;
135
+ static const uint8_t A3 = PIN_A3 ;
136
+ static const uint8_t A4 = PIN_A4 ;
137
+ static const uint8_t A5 = PIN_A5 ;
144
138
#define ADC_RESOLUTION 14
145
139
146
140
/*
147
141
* Serial interfaces
148
142
*/
149
- #define PIN_SERIAL1_RX PIN_D9
150
- #define PIN_SERIAL1_TX PIN_D10
143
+ #define PIN_SERIAL_RX PIN_D9
144
+ #define PIN_SERIAL_TX PIN_D10
151
145
152
146
/*
153
147
* SPI Interfaces
154
148
*/
155
149
#define SPI_INTERFACES_COUNT 2
156
150
157
- #define PIN_SPI_SS PIN_A0
158
- #define PIN_SPI_MISO _PINNUM(1, 14)
159
- #define PIN_SPI_MOSI _PINNUM(1, 13)
160
- #define PIN_SPI_SCK _PINNUM(1, 15)
161
- #define PIN_SPI1_MISO _PINNUM(1, 8)
162
- #define PIN_SPI1_MOSI _PINNUM(1, 2)
163
- #define PIN_SPI1_SCK _PINNUM(1, 1)
151
+ #define PIN_SPI_SS PIN_A0
152
+ #define PIN_SPI_MISO _PINNUM(1, 14)
153
+ #define PIN_SPI_MOSI _PINNUM(1, 13)
154
+ #define PIN_SPI_SCK _PINNUM(1, 15)
155
+ #define PIN_SPI1_MISO _PINNUM(1, 8)
156
+ #define PIN_SPI1_MOSI _PINNUM(1, 2)
157
+ #define PIN_SPI1_SCK _PINNUM(1, 1)
164
158
165
159
static const uint8_t SS = PIN_SPI_SS ;
166
160
static const uint8_t MOSI = PIN_SPI_MOSI ;
@@ -175,10 +169,10 @@ static const uint8_t SCK1 = PIN_SPI1_SCK;
175
169
*/
176
170
#define WIRE_INTERFACES_COUNT 2
177
171
178
- #define PIN_WIRE_SDA _PINNUM(0, 26)
179
- #define PIN_WIRE_SCL _PINNUM(0, 27)
180
- #define PIN_WIRE1_SDA _PINNUM(1, 1)
181
- #define PIN_WIRE1_SCL _PINNUM(1, 2)
172
+ #define PIN_WIRE_SDA _PINNUM(0, 26)
173
+ #define PIN_WIRE_SCL _PINNUM(0, 27)
174
+ #define PIN_WIRE1_SDA _PINNUM(1, 1)
175
+ #define PIN_WIRE1_SCL _PINNUM(1, 2)
182
176
183
177
// On-board QSPI Flash
184
178
#define EXTERNAL_FLASH_DEVICES GD25Q16C
@@ -188,18 +182,6 @@ static const uint8_t SCK1 = PIN_SPI1_SCK;
188
182
189
183
#define EXTERNAL_FLASH_USE_QSPI
190
184
191
- static void switch_antenna (bool useExternal );
192
-
193
- // led pwm
194
- void led_pwm_init (uint32_t led_index , uint32_t led_pin );
195
- void led_pwm_teardown (void );
196
- void led_pwm_duty_cycle (uint32_t led_index , uint16_t duty_cycle );
197
- void pwm_teardown (NRF_PWM_Type * pwm );
198
- void ledWrite (uint32_t led_pin , uint8_t value );
199
- void rgbLedWrite (uint8_t red , uint8_t green , uint8_t blue );
200
- static uint16_t led_duty_cycles [PWM0_CH_NUM ] = { 0 };
201
-
202
-
203
185
#ifdef __cplusplus
204
186
}
205
187
#endif
0 commit comments