18
18
19
19
#pragma once
20
20
21
- #include "WVariant.h"
21
+ // The definitions here needs a SAMD core >=1.6.3
22
+ #define ARDUINO_SAMD_VARIANT_COMPLIANCE 10603
22
23
23
- /*----------------------------------------------------------------------------
24
- * Definitions
25
- *----------------------------------------------------------------------------*/
24
+ #include <WVariant.h>
25
+
26
+ // General definitions
27
+ // -------------------
26
28
27
29
// Frequency of the board main oscillator
28
30
#define VARIANT_MAINOSC (32768ul)
29
31
30
32
// Master clock frequency
31
33
#define VARIANT_MCK (48000000ul)
32
34
33
- //#ifdef __cplusplus
34
- //extern "C"
35
- //{
36
- //#endif // __cplusplus
37
-
38
- /*----------------------------------------------------------------------------
39
- * Pins
40
- *----------------------------------------------------------------------------*/
35
+ // Pins
36
+ // ----
41
37
42
38
// Number of pins defined in PinDescription array
43
39
#define PINS_COUNT (26u)
44
40
#define NUM_DIGITAL_PINS (15u)
45
41
#define NUM_ANALOG_INPUTS (7u)
46
42
#define NUM_ANALOG_OUTPUTS (1u)
47
43
48
- #define digitalPinToPort (P ) (&(PORT->Group[g_APinDescription[P].ulPort]))
49
- #define digitalPinToBitMask (P ) (1 << g_APinDescription[P].ulPin)
50
- //#define analogInPinToBit(P) ()
51
- #define portOutputRegister (port ) (&(port->OUT.reg))
52
- #define portInputRegister (port ) (&(port->IN.reg))
53
- #define portModeRegister (port ) (&(port->DIR.reg))
54
- #define digitalPinHasPWM (P ) (g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER)
55
- #define digitalPinToInterrupt (P ) (g_APinDescription[P].ulExtInt)
44
+ // Low-level pin register query macros
45
+ // -----------------------------------
46
+ #define digitalPinToPort (P ) (&(PORT->Group[g_APinDescription[P].ulPort]))
47
+ #define digitalPinToBitMask (P ) (1 << g_APinDescription[P].ulPin)
48
+ //#define analogInPinToBit(P) ()
49
+ #define portOutputRegister (port ) (&(port->OUT.reg))
50
+ #define portInputRegister (port ) (&(port->IN.reg))
51
+ #define portModeRegister (port ) (&(port->DIR.reg))
52
+ #define digitalPinHasPWM (P ) (g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER)
53
+ #define digitalPinToInterrupt (P ) (g_APinDescription[P].ulExtInt)
56
54
57
55
/*
58
56
* digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
63
61
*/
64
62
// #define digitalPinToTimer(P)
65
63
66
-
67
64
// LEDs
68
65
// ----
69
- #define PIN_LED (7u)
70
- #define LED_BUILTIN PIN_LED
66
+ #define PIN_LED (7u)
67
+ #define LED_BUILTIN PIN_LED
71
68
72
69
// Analog pins
73
70
// -----------
74
- #define PIN_A0 (15u)
75
- #define PIN_A1 (16u)
76
- #define PIN_A2 (17u)
77
- #define PIN_A3 (18u)
78
- #define PIN_A4 (19u)
79
- #define PIN_A5 (20u)
80
- #define PIN_A6 (21u)
71
+ #define PIN_A0 (15u)
72
+ #define PIN_A1 (16u)
73
+ #define PIN_A2 (17u)
74
+ #define PIN_A3 (18u)
75
+ #define PIN_A4 (19u)
76
+ #define PIN_A5 (20u)
77
+ #define PIN_A6 (21u)
81
78
static const uint8_t A0 = PIN_A0 ;
82
79
static const uint8_t A1 = PIN_A1 ;
83
80
static const uint8_t A2 = PIN_A2 ;
84
81
static const uint8_t A3 = PIN_A3 ;
85
82
static const uint8_t A4 = PIN_A4 ;
86
83
static const uint8_t A5 = PIN_A5 ;
87
84
static const uint8_t A6 = PIN_A6 ;
88
- #define ADC_RESOLUTION 12
85
+ #define ADC_RESOLUTION 12
89
86
90
87
// SPI Interfaces
91
88
// --------------
92
89
#define SPI_INTERFACES_COUNT 2
93
90
94
91
// SPI
95
- #define PIN_SPI_MISO (10u)
96
- #define PIN_SPI_MOSI (8u)
97
- #define PIN_SPI_SCK (9u)
98
- #define PIN_SPI_SS (24u)
99
- #define PERIPH_SPI sercom1
100
- #define PAD_SPI_TX SPI_PAD_0_SCK_1
101
- #define PAD_SPI_RX SERCOM_RX_PAD_3
92
+ #define PIN_SPI_MISO (10u)
93
+ #define PIN_SPI_MOSI (8u)
94
+ #define PIN_SPI_SCK (9u)
95
+ #define PIN_SPI_SS (24u)
96
+ #define PERIPH_SPI sercom1
97
+ #define PAD_SPI_TX SPI_PAD_0_SCK_1
98
+ #define PAD_SPI_RX SERCOM_RX_PAD_3
102
99
static const uint8_t SS = PIN_SPI_SS ; // SPI Slave SS not used. Set here only for reference.
103
100
static const uint8_t MOSI = PIN_SPI_MOSI ;
104
101
static const uint8_t MISO = PIN_SPI_MISO ;
105
102
static const uint8_t SCK = PIN_SPI_SCK ;
106
103
107
104
// SPI1: Connected to WINC1501B
108
- #define PIN_SPI1_MISO (29u)
109
- #define PIN_SPI1_MOSI (26u)
110
- #define PIN_SPI1_SCK (27u)
111
- #define PIN_SPI1_SS (28u)
112
- #define PERIPH_SPI1 sercom2
113
- #define PAD_SPI1_TX SPI_PAD_0_SCK_1
114
- #define PAD_SPI1_RX SERCOM_RX_PAD_3
105
+ #define PIN_SPI1_MISO (29u)
106
+ #define PIN_SPI1_MOSI (26u)
107
+ #define PIN_SPI1_SCK (27u)
108
+ #define PIN_SPI1_SS (28u)
109
+ #define PERIPH_SPI1 sercom2
110
+ #define PAD_SPI1_TX SPI_PAD_0_SCK_1
111
+ #define PAD_SPI1_RX SERCOM_RX_PAD_3
115
112
static const uint8_t SS1 = PIN_SPI1_SS ;
116
113
static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
117
114
static const uint8_t MISO1 = PIN_SPI1_MISO ;
@@ -133,10 +130,6 @@ static const uint8_t SCK1 = PIN_SPI1_SCK;
133
130
#define PIN_USB_DP (23ul)
134
131
#define PIN_USB_HOST_ENABLE (24ul)
135
132
136
- //#ifdef __cplusplus
137
- //}
138
- //#endif
139
-
140
133
// Needed for WINC1501B (WiFi101) library
141
134
// --------------------------------------
142
135
#define WINC1501_RESET_PIN (30u)
@@ -145,10 +138,9 @@ static const uint8_t SCK1 = PIN_SPI1_SCK;
145
138
#define WINC1501_SPI SPI1
146
139
#define WINC1501_SPI_CS_PIN PIN_SPI1_SS
147
140
148
- /*----------------------------------------------------------------------------
149
- * Arduino objects - C++ only
150
- *----------------------------------------------------------------------------*/
151
141
142
+ // Serial ports
143
+ // ------------
152
144
#ifdef __cplusplus
153
145
#include "SERCOM.h"
154
146
#include "Uart.h"
@@ -163,11 +155,11 @@ extern SERCOM sercom5;
163
155
164
156
// Serial1
165
157
extern Uart Serial1 ;
166
- #define PIN_SERIAL1_RX (13ul)
167
- #define PIN_SERIAL1_TX (14ul)
168
- #define PAD_SERIAL1_TX (UART_TX_PAD_2)
169
- #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)
170
- #endif
158
+ #define PIN_SERIAL1_RX (13ul)
159
+ #define PIN_SERIAL1_TX (14ul)
160
+ #define PAD_SERIAL1_TX (UART_TX_PAD_2)
161
+ #define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)
162
+ #endif // __cplusplus
171
163
172
164
// These serial port names are intended to allow libraries and architecture-neutral
173
165
// sketches to automatically default to the correct port name for a particular type
0 commit comments