Skip to content

Commit 7506ded

Browse files
PyPortal variant work
1 parent 3580fc5 commit 7506ded

File tree

2 files changed

+43
-68
lines changed

2 files changed

+43
-68
lines changed

variants/pyportal/variant.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ const PinDescription g_APinDescription[]=
102102
{ PORTA, 23, PIO_DIGITAL , PIN_ATTR_PWM_G , No_ADC_Channel, TCC0_CH3 , TC4_CH1 , EXTERNAL_INT_7 }, // LCD_DATA7
103103

104104
// 42..47 QSPI
105+
{ PORTB, 10, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, TC5_CH0 , TC5_CH0 , EXTERNAL_INT_10 }, // QSPI_SCK
106+
{ PORTB, 11, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, TC5_CH1 , TC5_CH1 , EXTERNAL_INT_11 }, // QSPI_CS
105107
{ PORTA, 8, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NMI }, // QSPI_DATA0
106108
{ PORTA, 9, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // QSPI_DATA1
107109
{ PORTA, 10, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 }, // QSPI_DATA2
108110
{ PORTA, 11, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // QSPI_DATA3
109-
{ PORTB, 10, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, TC5_CH0 , TC5_CH0 , EXTERNAL_INT_10 }, // QSPI_SCK
110-
{ PORTB, 11, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, TC5_CH1 , TC5_CH1 , EXTERNAL_INT_11 }, // QSPI_CS
111111

112112
// 48..49 USB
113113
{ PORTA, 24, PIO_COM , PIN_ATTR_NONE , No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB D-
@@ -131,21 +131,21 @@ SERCOM sercom3( SERCOM3 ) ;
131131
SERCOM sercom4( SERCOM4 ) ;
132132
SERCOM sercom5( SERCOM5 ) ;
133133

134-
Uart Serial1( &sercom3, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;
134+
Uart Serial1( &sercom4, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;
135135

136-
void SERCOM3_0_Handler()
136+
void SERCOM4_0_Handler()
137137
{
138138
Serial1.IrqHandler();
139139
}
140-
void SERCOM3_1_Handler()
140+
void SERCOM4_1_Handler()
141141
{
142142
Serial1.IrqHandler();
143143
}
144-
void SERCOM3_2_Handler()
144+
void SERCOM4_2_Handler()
145145
{
146146
Serial1.IrqHandler();
147147
}
148-
void SERCOM3_3_Handler()
148+
void SERCOM4_3_Handler()
149149
{
150150
Serial1.IrqHandler();
151151
}

variants/pyportal/variant.h

Lines changed: 36 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ extern "C"
5757
*----------------------------------------------------------------------------*/
5858

5959
// Number of pins defined in PinDescription array
60-
#define PINS_COUNT (26u)
61-
#define NUM_DIGITAL_PINS (20u)
62-
#define NUM_ANALOG_INPUTS (8u)
63-
#define NUM_ANALOG_OUTPUTS (2u)
64-
#define analogInputToDigitalPin(p) ((p < 6u) ? (p) + 14u : -1)
60+
#define PINS_COUNT (52u)
61+
#define NUM_DIGITAL_PINS (42u)
62+
#define NUM_ANALOG_INPUTS (9u)
63+
#define NUM_ANALOG_OUTPUTS (1u)
64+
#define analogInputToDigitalPin(p) ((p < 10u) ? (p) + 14u : -1)
6565

6666
#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) )
6767
#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin )
@@ -82,11 +82,11 @@ extern "C"
8282

8383
// LEDs
8484
#define PIN_LED_13 (13u)
85-
#define PIN_LED_RXL (27u)
86-
#define PIN_LED_TXL (28u)
85+
//#define PIN_LED_RXL (27u)
86+
//#define PIN_LED_TXL (28u)
8787
#define PIN_LED PIN_LED_13
88-
#define PIN_LED2 PIN_LED_RXL
89-
#define PIN_LED3 PIN_LED_TXL
88+
//#define PIN_LED2 PIN_LED_RXL
89+
//#define PIN_LED3 PIN_LED_TXL
9090
#define LED_BUILTIN PIN_LED_13
9191

9292
/*
@@ -100,25 +100,29 @@ extern "C"
100100
#define PIN_A5 (PIN_A0 + 5)
101101
#define PIN_A6 (PIN_A0 + 6)
102102
#define PIN_A7 (PIN_A0 + 7)
103+
#define PIN_A8 (PIN_A0 + 8)
104+
#define PIN_A9 (PIN_A0 + 9)
105+
#define PIN_DAC PIN_A0
103106
#define PIN_DAC0 PIN_A0
104-
#define PIN_DAC1 PIN_A1
105107

106108
static const uint8_t A0 = PIN_A0;
107109
static const uint8_t A1 = PIN_A1;
108110
static const uint8_t A2 = PIN_A2;
109111
static const uint8_t A3 = PIN_A3;
110112
static const uint8_t A4 = PIN_A4;
111113
static const uint8_t A5 = PIN_A5;
112-
static const uint8_t A6 = PIN_A6 ;
113-
static const uint8_t A7 = PIN_A7 ;
114+
static const uint8_t A6 = PIN_A6;
115+
static const uint8_t A7 = PIN_A7;
116+
static const uint8_t A8 = PIN_A8;
117+
static const uint8_t A9 = PIN_A9;
114118

119+
static const uint8_t DAC = PIN_DAC;
115120
static const uint8_t DAC0 = PIN_DAC0;
116-
static const uint8_t DAC1 = PIN_DAC1;
117121

118122
#define ADC_RESOLUTION 12
119123

120124
// Other pins
121-
#define PIN_ATN (39ul)
125+
#define PIN_ATN (39ul) // ???
122126
static const uint8_t ATN = PIN_ATN;
123127

124128
/*
@@ -136,26 +140,26 @@ static const uint8_t ATN = PIN_ATN;
136140
*/
137141
#define SPI_INTERFACES_COUNT 1
138142

139-
#define PIN_SPI_MISO (24u)
140-
#define PIN_SPI_MOSI (26u)
141-
#define PIN_SPI_SCK (25u)
143+
#define PIN_SPI_MISO (31u)
144+
#define PIN_SPI_MOSI (29u)
145+
#define PIN_SPI_SCK (30u)
142146
#define PERIPH_SPI sercom2
143147
#define PAD_SPI_TX SPI_PAD_0_SCK_1
144148
#define PAD_SPI_RX SERCOM_RX_PAD_2
145149

146-
static const uint8_t SS = PIN_A2 ;
147-
static const uint8_t MOSI = PIN_SPI_MOSI ;
148-
static const uint8_t MISO = PIN_SPI_MISO ;
149-
static const uint8_t SCK = PIN_SPI_SCK ;
150+
static const uint8_t SS = PIN_A2; // ???
151+
static const uint8_t MOSI = PIN_SPI_MOSI;
152+
static const uint8_t MISO = PIN_SPI_MISO;
153+
static const uint8_t SCK = PIN_SPI_SCK;
150154

151155

152156
/*
153157
* Wire Interfaces
154158
*/
155159
#define WIRE_INTERFACES_COUNT 1
156160

157-
#define PIN_WIRE_SDA (22u)
158-
#define PIN_WIRE_SCL (23u)
161+
#define PIN_WIRE_SDA (27u)
162+
#define PIN_WIRE_SCL (28u)
159163
#define PERIPH_WIRE sercom5
160164
#define WIRE_IT_HANDLER SERCOM5_Handler
161165

@@ -165,46 +169,17 @@ static const uint8_t SCL = PIN_WIRE_SCL;
165169
/*
166170
* USB
167171
*/
168-
#define PIN_USB_HOST_ENABLE (29ul)
169-
#define PIN_USB_DM (30ul)
170-
#define PIN_USB_DP (31ul)
171-
172-
/*
173-
* I2S Interfaces
174-
*/
175-
#define I2S_INTERFACES_COUNT 1
176-
177-
#define I2S_DEVICE 0
178-
#define I2S_CLOCK_GENERATOR 3
179-
180-
#define PIN_I2S_SDO (8u)
181-
#define PIN_I2S_SDI (1u)
182-
#define PIN_I2S_SCK (3u)
183-
#define PIN_I2S_FS (9u)
184-
#define PIN_I2S_MCK (2u)
172+
#define PIN_USB_HOST_ENABLE (29ul) // ???
173+
#define PIN_USB_DM (48ul)
174+
#define PIN_USB_DP (49ul)
185175

186176
//QSPI Pins
187-
#define PIN_QSPI_SCK (41u)
188-
#define PIN_QSPI_CS (42u)
189-
#define PIN_QSPI_IO0 (43u)
190-
#define PIN_QSPI_IO1 (44u)
191-
#define PIN_QSPI_IO2 (45u)
192-
#define PIN_QSPI_IO3 (46u)
193-
194-
//PCC Pins
195-
#define PIN_PCC_DEN1 (PIN_SPI_MOSI)
196-
#define PIN_PCC_DEN2 (PIN_SPI_SCK)
197-
#define PIN_PCC_CLK (PIN_SPI_MISO)
198-
#define PIN_PCC_D0 (13u)
199-
#define PIN_PCC_D1 (12u)
200-
#define PIN_PCC_D2 (10u)
201-
#define PIN_PCC_D3 (11u)
202-
#define PIN_PCC_D4 (9u)
203-
#define PIN_PCC_D5 (8u)
204-
#define PIN_PCC_D6 (1u)
205-
#define PIN_PCC_D7 (0u)
206-
#define PIN_PCC_D8 (5u)
207-
#define PIN_PCC_D9 (6u)
177+
#define PIN_QSPI_SCK (42u)
178+
#define PIN_QSPI_CS (43u)
179+
#define PIN_QSPI_IO0 (44u)
180+
#define PIN_QSPI_IO1 (45u)
181+
#define PIN_QSPI_IO2 (46u)
182+
#define PIN_QSPI_IO3 (47u)
208183

209184
//TODO: meaningful value for this
210185
#define VARIANT_QSPI_BAUD_DEFAULT 5000000

0 commit comments

Comments
 (0)