24
24
*----------------------------------------------------------------------------*/
25
25
26
26
/** Frequency of the board main oscillator */
27
- #define VARIANT_MAINOSC (32768ul)
27
+ #define VARIANT_MAINOSC (32768ul)
28
28
29
29
/** Master clock frequency */
30
- #define VARIANT_MCK (48000000ul)
30
+ #define VARIANT_MCK (48000000ul)
31
31
32
32
/*----------------------------------------------------------------------------
33
33
* Headers
41
41
#endif // __cplusplus
42
42
43
43
#ifdef __cplusplus
44
- extern "C"
45
- {
44
+ extern "C" {
46
45
#endif // __cplusplus
47
46
48
47
/*----------------------------------------------------------------------------
49
48
* Pins
50
49
*----------------------------------------------------------------------------*/
51
50
52
51
// Number of pins defined in PinDescription array
53
- #define PINS_COUNT (39u)
54
- #define NUM_DIGITAL_PINS (16u)
52
+ #define PINS_COUNT (39u)
53
+ #define NUM_DIGITAL_PINS (16u)
55
54
//#define NUM_ANALOG_INPUTS (6u)
56
55
//#define NUM_ANALOG_OUTPUTS (1u)
57
56
58
- #define digitalPinToPort (P ) ( &(PORT->Group[g_APinDescription[P].ulPort]) )
59
- #define digitalPinToBitMask (P ) ( 1 << g_APinDescription[P].ulPin )
57
+ #define digitalPinToPort (P ) ( &(PORT->Group[g_APinDescription[P].ulPort]))
58
+ #define digitalPinToBitMask (P ) ( 1 << g_APinDescription[P].ulPin)
60
59
//#define analogInPinToBit(P) ( )
61
- #define portOutputRegister (port ) ( &(port->OUT.reg) )
62
- #define portInputRegister (port ) ( &(port->IN.reg) )
63
- #define portModeRegister (port ) ( &(port->DIR.reg) )
64
- #define digitalPinHasPWM (P ) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER )
60
+ #define portOutputRegister (port ) (&(port->OUT.reg))
61
+ #define portInputRegister (port ) (&(port->IN.reg))
62
+ #define portModeRegister (port ) (&(port->DIR.reg))
63
+ #define digitalPinHasPWM (P ) \
64
+ (g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || \
65
+ g_APinDescription[P].ulTCChannel != NOT_ON_TIMER)
65
66
66
67
/*
67
68
* digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
@@ -73,50 +74,49 @@ extern "C"
73
74
// #define digitalPinToTimer(P)
74
75
75
76
// Interrupts
76
- #define digitalPinToInterrupt (P ) ( g_APinDescription[P].ulExtInt )
77
+ #define digitalPinToInterrupt (P ) ( g_APinDescription[P].ulExtInt)
77
78
78
79
// LEDs
79
- #define PIN_LED_13 (7u)
80
- #define PIN_LED_RXL (6u)
81
- #define PIN_LED_TXL (12u)
82
- #define PIN_LED LED_BLUE
83
- #define PIN_LED2 LED_RED
84
- #define PIN_LED4 LED_GREEN
85
- #define LED_BUILTIN LED_YELLOW
86
-
87
-
88
- #define LED_1 (16u)
89
- #define LED_2 (17u)
90
- #define LED_3 (18u)
91
- #define LED_4 (19u)
92
- #define LED_5 (20u)
93
-
94
- #define LED_BLUE (16u)
95
- #define LED_RED (17u)
96
- #define LED_GREEN (18u)
97
- #define LED_YELLOW (19u)
98
- #define LED_ORANGE (20u)
80
+ #define PIN_LED_13 (7u)
81
+ #define PIN_LED_RXL (6u)
82
+ #define PIN_LED_TXL (12u)
83
+ #define PIN_LED LED_BLUE
84
+ #define PIN_LED2 LED_RED
85
+ #define PIN_LED4 LED_GREEN
86
+ #define LED_BUILTIN LED_YELLOW
87
+
88
+ #define LED_1 (16u)
89
+ #define LED_2 (17u)
90
+ #define LED_3 (18u)
91
+ #define LED_4 (19u)
92
+ #define LED_5 (20u)
93
+
94
+ #define LED_BLUE (16u)
95
+ #define LED_RED (17u)
96
+ #define LED_GREEN (18u)
97
+ #define LED_YELLOW (19u)
98
+ #define LED_ORANGE (20u)
99
99
/*
100
100
* Analog pins
101
101
*/
102
- #define PIN_A0 (14ul)
103
- #define PIN_A1 (15ul)
104
- #define PIN_A2 ( 8ul)
105
- #define PIN_A3 ( 9ul)
106
- #define PIN_A4 (36ul)
107
- #define PIN_A5 (37ul)
108
-
109
- static const uint8_t A0 = PIN_A0 ;
110
- static const uint8_t A1 = PIN_A1 ;
111
- static const uint8_t A2 = PIN_A2 ;
112
- static const uint8_t A3 = PIN_A3 ;
113
- static const uint8_t A4 = PIN_A4 ;
114
- static const uint8_t A5 = PIN_A5 ;
115
- #define ADC_RESOLUTION 12
102
+ #define PIN_A0 (14ul)
103
+ #define PIN_A1 (15ul)
104
+ #define PIN_A2 ( 8ul)
105
+ #define PIN_A3 ( 9ul)
106
+ #define PIN_A4 (36ul)
107
+ #define PIN_A5 (37ul)
108
+
109
+ static const uint8_t A0 = PIN_A0 ;
110
+ static const uint8_t A1 = PIN_A1 ;
111
+ static const uint8_t A2 = PIN_A2 ;
112
+ static const uint8_t A3 = PIN_A3 ;
113
+ static const uint8_t A4 = PIN_A4 ;
114
+ static const uint8_t A5 = PIN_A5 ;
115
+ #define ADC_RESOLUTION 12
116
116
117
117
// Other pins
118
118
//#define PIN_ATN (38ul)
119
- //static const uint8_t ATN = PIN_ATN;
119
+ // static const uint8_t ATN = PIN_ATN;
120
120
121
121
/*
122
122
* Serial interfaces
@@ -128,52 +128,53 @@ static const uint8_t A5 = PIN_A5 ;
128
128
//#define PAD_SERIAL_RX (SERCOM_RX_PAD_3)
129
129
130
130
// Serial1
131
- #define PIN_SERIAL1_RX (0ul)
132
- #define PIN_SERIAL1_TX (1ul)
133
- #define PAD_SERIAL1_TX (UART_TX_PAD_2)
134
- #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)
131
+ #define PIN_SERIAL1_RX (0ul)
132
+ #define PIN_SERIAL1_TX (1ul)
133
+ #define PAD_SERIAL1_TX (UART_TX_PAD_2)
134
+ #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)
135
135
136
136
/*
137
137
* SPI Interfaces
138
138
*/
139
139
#define SPI_INTERFACES_COUNT 3
140
140
141
141
// SPI
142
- #define PIN_SPI_MISO (27u)
143
- #define PIN_SPI_MOSI (26u)
144
- #define PIN_SPI_SCK (28u)
145
- #define PIN_SPI_SS (PIN_A2)
146
- #define PERIPH_SPI sercom1
147
- #define PAD_SPI_TX SPI_PAD_0_SCK_1
148
- #define PAD_SPI_RX SERCOM_RX_PAD_2
149
- static const uint8_t SS = PIN_SPI_SS ; // SPI Slave SS not used. Set here only for reference.
142
+ #define PIN_SPI_MISO (27u)
143
+ #define PIN_SPI_MOSI (26u)
144
+ #define PIN_SPI_SCK (28u)
145
+ #define PIN_SPI_SS (PIN_A2)
146
+ #define PERIPH_SPI sercom1
147
+ #define PAD_SPI_TX SPI_PAD_0_SCK_1
148
+ #define PAD_SPI_RX SERCOM_RX_PAD_2
149
+ static const uint8_t SS =
150
+ PIN_SPI_SS ; // SPI Slave SS not used. Set here only for reference.
150
151
static const uint8_t MOSI = PIN_SPI_MOSI ;
151
152
static const uint8_t MISO = PIN_SPI_MISO ;
152
- static const uint8_t SCK = PIN_SPI_SCK ;
153
+ static const uint8_t SCK = PIN_SPI_SCK ;
153
154
154
155
// SPI1: Connected to W5100
155
156
#define PIN_SPI1_MISO (22u)
156
157
#define PIN_SPI1_MOSI (21u)
157
- #define PIN_SPI1_SCK (23u)
158
- #define PERIPH_SPI1 sercom4
159
- #define PAD_SPI1_TX SPI_PAD_0_SCK_1
160
- #define PAD_SPI1_RX SERCOM_RX_PAD_2
158
+ #define PIN_SPI1_SCK (23u)
159
+ #define PERIPH_SPI1 sercom4
160
+ #define PAD_SPI1_TX SPI_PAD_0_SCK_1
161
+ #define PAD_SPI1_RX SERCOM_RX_PAD_2
161
162
static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
162
163
static const uint8_t MISO1 = PIN_SPI1_MISO ;
163
- static const uint8_t SCK1 = PIN_SPI1_SCK ;
164
+ static const uint8_t SCK1 = PIN_SPI1_SCK ;
164
165
165
166
// SPI2: Connected to MysX
166
167
#define PIN_SPI2_MISO (11u)
167
168
#define PIN_SPI2_MOSI (10u)
168
- #define PIN_SPI2_SCK (12u)
169
- #define PERIPH_SPI2 sercom2
170
- #define PAD_SPI2_TX SPI_PAD_0_SCK_1
171
- #define PAD_SPI2_RX SERCOM_RX_PAD_2
169
+ #define PIN_SPI2_SCK (12u)
170
+ #define PERIPH_SPI2 sercom2
171
+ #define PAD_SPI2_TX SPI_PAD_0_SCK_1
172
+ #define PAD_SPI2_RX SERCOM_RX_PAD_2
172
173
static const uint8_t MOSI2 = PIN_SPI2_MOSI ;
173
174
static const uint8_t MISO2 = PIN_SPI2_MISO ;
174
- static const uint8_t SCK2 = PIN_SPI2_SCK ;
175
+ static const uint8_t SCK2 = PIN_SPI2_SCK ;
175
176
176
- #define SPI_ETH SPI1
177
+ #define SPI_ETH SPI1
177
178
#define SPI_USER SPI2
178
179
179
180
/*
@@ -190,7 +191,8 @@ static const uint8_t SCK2 = PIN_SPI2_SCK;
190
191
#define USR_SPI_SCK (49u)
191
192
*/
192
193
193
- //static const uint8_t SS = PIN_A2 ; // SERCOM4 last PAD is present on A2 but HW SS isn't used. Set here only for reference.
194
+ // static const uint8_t SS = PIN_A2 ; // SERCOM4 last PAD is present
195
+ // on A2 but HW SS isn't used. Set here only for reference.
194
196
/*static const uint8_t MOSI = PIN_SPI_MOSI ;
195
197
static const uint8_t MISO = PIN_SPI_MISO ;
196
198
static const uint8_t SCK = PIN_SPI_SCK ;
@@ -200,50 +202,52 @@ static const uint8_t SCK = PIN_SPI_SCK ;
200
202
*/
201
203
#define WIRE_INTERFACES_COUNT 1
202
204
203
- #define PIN_WIRE_SDA (07u)
204
- #define PIN_WIRE_SCL (06u)
205
+ #define PIN_WIRE_SDA (07u)
206
+ #define PIN_WIRE_SCL (06u)
205
207
206
208
/*
207
209
* USB
208
210
*/
209
211
#define PIN_USB_HOST_ENABLE (27ul)
210
- #define PIN_USB_DM (28ul)
211
- #define PIN_USB_DP (29ul)
212
+ #define PIN_USB_DM (28ul)
213
+ #define PIN_USB_DP (29ul)
212
214
213
215
#ifdef __cplusplus
214
216
}
215
217
#endif
216
218
217
-
218
219
/*
219
220
* MYSX pins
220
221
*/
221
222
222
- #define MYSX_D1_DFM (00ul)
223
- #define MYSX_D2_DTM (01ul)
224
- #define MYSX_D3_INT (02ul)
225
- #define MYSX_D4_INT (03ul)
226
- #define MYSX_D5_PWM (04ul)
227
- #define MYSX_D6_PWM (05ul)
228
- #define MYSX_D7_SCL (06ul)
229
- #define MYSX_D8_SDA (07ul)
230
- #define MYSX_D9_A3 (08ul)
231
- #define MYSX_D10_A4 (09ul)
232
- #define MYSX_D11_MOSI (10ul)
233
- #define MYSX_D12_MISO (11ul)
234
- #define MYSX_D13_SCK (12ul)
235
- #define MYSX_D14_CS (13ul)
236
- #define MYSX_A1 (14ul)
237
- #define MYSX_A2 (15ul)
238
- #define MYSX_SPI SPI2
239
-
240
- #define MY_SIGNING_ATSHA204_PIN 17
223
+ #define MYSX_D1_DFM (00ul)
224
+ #define MYSX_D2_DTM (01ul)
225
+ #define MYSX_D3_INT (02ul)
226
+ #define MYSX_D4_INT (03ul)
227
+ #define MYSX_D5_PWM (04ul)
228
+ #define MYSX_D6_PWM (05ul)
229
+ #define MYSX_D7_SCL (06ul)
230
+ #define MYSX_D8_SDA (07ul)
231
+ #define MYSX_D9_A3 (08ul)
232
+ #define MYSX_D10_A4 (09ul)
233
+ #define MYSX_D11_MOSI (10ul)
234
+ #define MYSX_D12_MISO (11ul)
235
+ #define MYSX_D13_SCK (12ul)
236
+ #define MYSX_D14_CS (13ul)
237
+ #define MYSX_A1 (14ul)
238
+ #define MYSX_A2 (15ul)
239
+ #define MYSX_SPI SPI2
240
+
241
+ #define MY_SIGNING_ATSHA204_PIN (17ul)
241
242
#define MY_HW_ERR_LED_PIN LED_RED
242
- #define MY_HW_RX_LED_PIN LED_YELLOW
243
- #define MY_HW_TX_LED_PIN LED_GREEN
244
- #define MY_RF69_SPI_CS 30
245
- #define MY_RF69_IRQ_PIN 32
246
- #define MY_RF69_IRQ_NUM 32
243
+ #define MY_HW_RX_LED_PIN LED_YELLOW
244
+ #define MY_HW_TX_LED_PIN LED_GREEN
245
+ #define MY_RF69_SPI_CS (30ul)
246
+ #define MY_RF69_IRQ_PIN (32ul)
247
+ #define MY_RF69_IRQ_NUM (32ul)
248
+ #define MY_RF24_CE_PIN (34ul)
249
+ #define MY_RF24_CS_PIN (29ul)
250
+ #define MY_RF24_IRQ_PIN (31ul)
247
251
248
252
/*----------------------------------------------------------------------------
249
253
* Arduino objects - C++ only
@@ -262,25 +266,32 @@ extern SERCOM sercom3;
262
266
extern SERCOM sercom4 ;
263
267
extern SERCOM sercom5 ;
264
268
265
- //extern Uart Serial;
269
+ // extern Uart Serial;
266
270
extern Uart Serial1 ;
267
271
268
272
#endif
269
273
270
- // These serial port names are intended to allow libraries and architecture-neutral
271
- // sketches to automatically default to the correct port name for a particular type
272
- // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
273
- // the first hardware serial port whose RX/TX pins are not dedicated to another use.
274
+ // These serial port names are intended to allow libraries and
275
+ // architecture-neutral
276
+ // sketches to automatically default to the correct port name for a particular
277
+ // type
278
+ // of use. For example, a GPS module would normally connect to
279
+ // SERIAL_PORT_HARDWARE_OPEN,
280
+ // the first hardware serial port whose RX/TX pins are not dedicated to another
281
+ // use.
274
282
//
275
- // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
283
+ // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial
284
+ // Monitor
276
285
//
277
286
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
278
287
//
279
- // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
288
+ // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge
289
+ // library
280
290
//
281
291
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
282
292
//
283
- // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
293
+ // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use.
294
+ // Their RX & TX
284
295
// pins are NOT connected to anything by default.
285
296
//#define SERIAL_PORT_USBVIRTUAL SerialUSB
286
297
//#define SERIAL_PORT_MONITOR Serial
0 commit comments