2424 *----------------------------------------------------------------------------*/
2525
2626/** Frequency of the board main oscillator */
27- #define VARIANT_MAINOSC (32768ul)
27+ #define VARIANT_MAINOSC (32768ul)
2828
2929/** Master clock frequency */
30- #define VARIANT_MCK (48000000ul)
30+ #define VARIANT_MCK (48000000ul)
3131
3232/*----------------------------------------------------------------------------
3333 * Headers
4141#endif // __cplusplus
4242
4343#ifdef __cplusplus
44- extern "C"
45- {
44+ extern "C" {
4645#endif // __cplusplus
4746
4847/*----------------------------------------------------------------------------
4948 * Pins
5049 *----------------------------------------------------------------------------*/
5150
5251// 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)
5554//#define NUM_ANALOG_INPUTS (6u)
5655//#define NUM_ANALOG_OUTPUTS (1u)
5756
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)
6059//#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)
6566
6667/*
6768 * digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
@@ -73,50 +74,49 @@ extern "C"
7374// #define digitalPinToTimer(P)
7475
7576// Interrupts
76- #define digitalPinToInterrupt (P ) ( g_APinDescription[P].ulExtInt )
77+ #define digitalPinToInterrupt (P ) ( g_APinDescription[P].ulExtInt)
7778
7879// 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)
9999/*
100100 * Analog pins
101101 */
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
116116
117117// Other pins
118118//#define PIN_ATN (38ul)
119- //static const uint8_t ATN = PIN_ATN;
119+ // static const uint8_t ATN = PIN_ATN;
120120
121121/*
122122 * Serial interfaces
@@ -128,52 +128,53 @@ static const uint8_t A5 = PIN_A5 ;
128128//#define PAD_SERIAL_RX (SERCOM_RX_PAD_3)
129129
130130// 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)
135135
136136/*
137137 * SPI Interfaces
138138 */
139139#define SPI_INTERFACES_COUNT 3
140140
141141// 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.
150151static const uint8_t MOSI = PIN_SPI_MOSI ;
151152static 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 ;
153154
154155// SPI1: Connected to W5100
155156#define PIN_SPI1_MISO (22u)
156157#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
161162static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
162163static 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 ;
164165
165166// SPI2: Connected to MysX
166167#define PIN_SPI2_MISO (11u)
167168#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
172173static const uint8_t MOSI2 = PIN_SPI2_MOSI ;
173174static 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 ;
175176
176- #define SPI_ETH SPI1
177+ #define SPI_ETH SPI1
177178#define SPI_USER SPI2
178179
179180/*
@@ -190,7 +191,8 @@ static const uint8_t SCK2 = PIN_SPI2_SCK;
190191#define USR_SPI_SCK (49u)
191192*/
192193
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.
194196/*static const uint8_t MOSI = PIN_SPI_MOSI ;
195197static const uint8_t MISO = PIN_SPI_MISO ;
196198static const uint8_t SCK = PIN_SPI_SCK ;
@@ -200,50 +202,52 @@ static const uint8_t SCK = PIN_SPI_SCK ;
200202 */
201203#define WIRE_INTERFACES_COUNT 1
202204
203- #define PIN_WIRE_SDA (07u)
204- #define PIN_WIRE_SCL (06u)
205+ #define PIN_WIRE_SDA (07u)
206+ #define PIN_WIRE_SCL (06u)
205207
206208/*
207209 * USB
208210 */
209211#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)
212214
213215#ifdef __cplusplus
214216}
215217#endif
216218
217-
218219/*
219220 * MYSX pins
220221 */
221222
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)
241242#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)
247251
248252/*----------------------------------------------------------------------------
249253 * Arduino objects - C++ only
@@ -262,25 +266,32 @@ extern SERCOM sercom3;
262266extern SERCOM sercom4 ;
263267extern SERCOM sercom5 ;
264268
265- //extern Uart Serial;
269+ // extern Uart Serial;
266270extern Uart Serial1 ;
267271
268272#endif
269273
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.
274282//
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
276285//
277286// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
278287//
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
280290//
281291// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
282292//
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
284295// pins are NOT connected to anything by default.
285296//#define SERIAL_PORT_USBVIRTUAL SerialUSB
286297//#define SERIAL_PORT_MONITOR Serial
0 commit comments