Skip to content

Commit ca155a0

Browse files
committed
Fix some more pins
1 parent 190e470 commit ca155a0

File tree

2 files changed

+62
-28
lines changed

2 files changed

+62
-28
lines changed

variants/dynalora_usb/variant.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,35 @@ const PinDescription g_APinDescription[]=
3131
{ PORTA, 30, PIO_SERCOM_ALT, (PIN_ATTR_PWM|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH0, NOT_ON_TIMER, EXTERNAL_INT_10 }, // D3 - SWCLK
3232
{ PORTA, 31, PIO_SERCOM_ALT, (PIN_ATTR_PWM|PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, PWM1_CH1, NOT_ON_TIMER, EXTERNAL_INT_11 }, // D4 - SWDIO
3333

34-
{ PORTA, 15, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // BUTTON
35-
{ PORTA, 3, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SD_CS
36-
{ PORTA, 9, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // RF_INT
37-
{ PORTA, 10, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // RF_RESET
38-
{ PORTA, 11, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // RF_CS
34+
{ PORTA, 15, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // D5 - BUTTON
35+
{ PORTA, 9, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_EXTINT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // D6 - RF_INT
36+
{ PORTA, 10, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // D7 - RF_RESET
37+
{ PORTA, 11, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // D8 - RF_CS
38+
{ PORTA, 3, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // D9 - SD_CS
3939

4040
// 10..11 (LEDs)
4141
// ----------------------
4242
{ PORTA, 27, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // LED
4343
{ PORTA, 19, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH1, TCC0_CH2, EXTERNAL_INT_NONE }, // Neopixel RGB
4444

45-
// 12 - Alternate use of A0 (DAC output)
45+
// ----------------------
46+
// 12..14 - SPI Radio and SD
47+
{ PORTA, 18, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SDI: SERCOM3/PAD[2]
48+
{ PORTA, 16, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SDO: SERCOM3/PAD[0]
49+
{ PORTA, 17, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCK: SERCOM3/PAD[1]
50+
51+
// 15 - Alternate use of A0 (DAC output)
4652
// ----------------------
4753
{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, DAC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // VOUT
4854

49-
// 13..15 - USB
55+
// 16..18 - USB
5056
// --------------------
5157
{ NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB Host enable DOES NOT EXIST ON THIS BOARD
5258
{ PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM
5359
{ PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP
5460

5561
// ----------------------
56-
// 16..19 - SPI Flash
62+
// 19..22 - SPI Flash
5763
{ PORTA, 5, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SDI: SERCOM0/PAD[1]
5864
{ PORTA, 4, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SDO: SERCOM0/PAD[0]
5965
{ PORTA, 7, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SCK: SERCOM0/PAD[3]
@@ -66,6 +72,7 @@ const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, T
6672
// Multi-serial objects instantiation
6773
SERCOM sercom0( SERCOM0 ) ;
6874
SERCOM sercom1( SERCOM1 ) ;
75+
SERCOM sercom3( SERCOM3 ) ;
6976

7077
Uart Serial1( &sercom1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;
7178

variants/dynalora_usb/variant.h

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ extern "C"
5353
*----------------------------------------------------------------------------*/
5454

5555
// Number of pins defined in PinDescription array
56-
#define PINS_COUNT (20u)
57-
#define NUM_DIGITAL_PINS (2u)
56+
#define PINS_COUNT (22u)
57+
#define NUM_DIGITAL_PINS (21u)
5858
#define NUM_ANALOG_INPUTS (1u)
5959
#define NUM_ANALOG_OUTPUTS (1u)
6060
#define analogInputToDigitalPin(p) ((p < 1u) ? (p) + (PIN_A0) : -1)
@@ -83,10 +83,12 @@ extern "C"
8383
#define NEOPIXEL_BUILTIN (11u)
8484
#define PIN_NEOPIXEL NEOPIXEL_BUILTIN
8585

86+
static const uint8_t D13 = PIN_LED_13;
87+
8688
/*
8789
* Analog pins
8890
*/
89-
#define PIN_A0 (3ul)
91+
#define PIN_A0 (2u)
9092

9193
static const uint8_t A0 = PIN_A0;
9294

@@ -119,11 +121,17 @@ static const uint8_t D7 = PIN_D7;
119121
static const uint8_t D8 = PIN_D8;
120122
static const uint8_t D9 = PIN_D9;
121123

124+
static const uint8_t PA00 = PIN_D0;
125+
static const uint8_t PA01 = PIN_D1;
126+
static const uint8_t PA02 = PIN_D2;
127+
static const uint8_t SWCLK = PIN_D3;
128+
static const uint8_t SWDIO = PIN_D4;
129+
122130
static const uint8_t BUTTON = PIN_D5;
123-
static const uint8_t SD_CS = PIN_D6;
124-
static const uint8_t RADIO_INT = PIN_D7;
125-
static const uint8_t RADIO_RESET = PIN_D8;
126-
static const uint8_t RADIO_CS = PIN_D9;
131+
static const uint8_t RADIO_INT = PIN_D6;
132+
static const uint8_t RADIO_RESET = PIN_D7;
133+
static const uint8_t RADIO_CS = PIN_D8;
134+
static const uint8_t SD_CS = PIN_D9;
127135

128136
// On-board SPI Flash
129137
#define EXTERNAL_FLASH_DEVICES GD25Q32C
@@ -146,31 +154,33 @@ static const uint8_t RX = PIN_SERIAL1_RX;
146154
/*
147155
* SPI Interfaces
148156
*/
149-
#define SPI_INTERFACES_COUNT 2
157+
#define SPI_INTERFACES_COUNT 3
150158

151-
#define PIN_SPI_MISO PIN_D2
152-
#define PIN_SPI_MOSI PIN_D0
153-
#define PIN_SPI_SCK PIN_D1
154-
#define PERIPH_SPI sercom1
159+
#define PIN_SPI_MISO (12u)
160+
#define PIN_SPI_MOSI (13u)
161+
#define PIN_SPI_SCK (14u)
162+
#define PERIPH_SPI sercom3
155163
#define PAD_SPI_TX SPI_PAD_0_SCK_1
156164
#define PAD_SPI_RX SERCOM_RX_PAD_2
157165

158-
//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.
166+
static const uint8_t SS = (-1) ; // SERCOM4 last PAD is present on A2 but HW SS isn't used. Set here only for reference.
159167
static const uint8_t MOSI = PIN_SPI_MOSI ;
160168
static const uint8_t MISO = PIN_SPI_MISO ;
161169
static const uint8_t SCK = PIN_SPI_SCK ;
162170

163171
static const uint8_t SDO = PIN_SPI_MOSI ;
164172
static const uint8_t SDI = PIN_SPI_MISO ;
165173

166-
#define PIN_SPI1_MISO (16u)
167-
#define PIN_SPI1_MOSI (17u)
168-
#define PIN_SPI1_SCK (18u)
174+
// Flash memory SPI
175+
176+
#define PIN_SPI1_MISO (19u)
177+
#define PIN_SPI1_MOSI (20u)
178+
#define PIN_SPI1_SCK (21u)
169179
#define PERIPH_SPI1 sercom0
170180
#define PAD_SPI1_TX SPI_PAD_0_SCK_3
171181
#define PAD_SPI1_RX SERCOM_RX_PAD_1
172182

173-
static const uint8_t SS1 = 19 ;
183+
static const uint8_t SS1 = 22 ;
174184
static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
175185
static const uint8_t MISO1 = PIN_SPI1_MISO ;
176186
static const uint8_t SCK1 = PIN_SPI1_SCK ;
@@ -183,6 +193,22 @@ static const uint8_t FLASH_SDI = PIN_SPI1_MISO ;
183193
static const uint8_t FLASH_SCK = PIN_SPI1_SCK ;
184194
static const uint8_t FLASH_CS = SS1 ;
185195

196+
// External header SPI interface
197+
198+
#define PIN_SPI2_MISO PIN_D2
199+
#define PIN_SPI2_MOSI PIN_D0
200+
#define PIN_SPI2_SCK PIN_D1
201+
#define PERIPH_SPI2 sercom1
202+
#define PAD_SPI2_TX SPI_PAD_0_SCK_1
203+
#define PAD_SPI2_RX SERCOM_RX_PAD_2
204+
205+
static const uint8_t MOSI2 = PIN_SPI2_MOSI ;
206+
static const uint8_t MISO2 = PIN_SPI2_MISO ;
207+
static const uint8_t SCK2 = PIN_SPI2_SCK ;
208+
209+
static const uint8_t SDO2 = PIN_SPI2_MOSI ;
210+
static const uint8_t SDI2 = PIN_SPI2_MISO ;
211+
186212
/*
187213
* Wire Interfaces
188214
*/
@@ -199,9 +225,9 @@ static const uint8_t SCL = PIN_WIRE_SCL;
199225
/*
200226
* USB
201227
*/
202-
#define PIN_USB_HOST_ENABLE (13ul)
203-
#define PIN_USB_DM (14ul)
204-
#define PIN_USB_DP (15ul)
228+
#define PIN_USB_HOST_ENABLE (16ul)
229+
#define PIN_USB_DM (17ul)
230+
#define PIN_USB_DP (18ul)
205231

206232
#ifdef __cplusplus
207233
}
@@ -219,6 +245,7 @@ static const uint8_t SCL = PIN_WIRE_SCL;
219245
*/
220246
extern SERCOM sercom0;
221247
extern SERCOM sercom1;
248+
extern SERCOM sercom3;
222249

223250
extern Uart Serial1;
224251

0 commit comments

Comments
 (0)