Skip to content

Commit e9857ae

Browse files
committed
DM: update pwms for samd51
1 parent 6f6a90f commit e9857ae

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

cores/arduino/wiring_analog.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,13 @@ void analogWrite(uint32_t pin, uint32_t value)
421421
} else
422422
#endif
423423
{
424+
425+
#if defined(__SAMD51__)
426+
//on SAMD51 we are only using TCC for timers
427+
pinPeripheral(pin, PIO_TCC_PDEC);
428+
#else
424429
pinPeripheral(pin, PIO_TIMER);
430+
#endif
425431
}
426432
} else {
427433
// We suppose that attr has PIN_ATTR_TIMER_ALT bit set...

variants/metro_m4/variant.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ const PinDescription g_APinDescription[]=
3131

3232
// 2..12
3333
// Digital Low
34-
{ PORTB, 17, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH5, NOT_ON_TIMER, NOT_AN_INTERRUPT },
35-
{ PORTB, 16, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH4, NOT_ON_TIMER, EXTERNAL_INT_10 },
36-
{ PORTB, 13, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH1, NOT_ON_TIMER, EXTERNAL_INT_12 },
37-
{ PORTB, 14, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH2, NOT_ON_TIMER, EXTERNAL_INT_14 },
38-
{ PORTB, 15, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH3, NOT_ON_TIMER, EXTERNAL_INT_15 },
39-
{ PORTB, 12, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM0_CH0, NOT_ON_TIMER, EXTERNAL_INT_14 },
34+
{ PORTB, 17, PIO_TCC_PDEC, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH5, NOT_ON_TIMER, NOT_AN_INTERRUPT },
35+
{ PORTB, 16, PIO_TCC_PDEC, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH4, NOT_ON_TIMER, EXTERNAL_INT_10 },
36+
{ PORTB, 13, PIO_TCC_PDEC, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH1, NOT_ON_TIMER, EXTERNAL_INT_12 },
37+
{ PORTB, 14, PIO_TCC_PDEC, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH2, NOT_ON_TIMER, EXTERNAL_INT_14 },
38+
{ PORTB, 15, PIO_TCC_PDEC, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH3, NOT_ON_TIMER, EXTERNAL_INT_15 },
39+
{ PORTB, 12, PIO_TCC_PDEC, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM0_CH0, NOT_ON_TIMER, EXTERNAL_INT_14 },
4040

4141
// Digital High
4242
{ PORTA, 21, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM1_CH5, NOT_ON_TIMER, EXTERNAL_INT_0 },

variants/metro_m4/variant.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ static const uint8_t SCL = PIN_WIRE_SCL;
189189
#define I2S_DEVICE 0
190190
#define I2S_CLOCK_GENERATOR 3
191191

192-
//TODO: these
193192
#define PIN_I2S_SDO (8u)
194193
#define PIN_I2S_SDI (1u)
195194
#define PIN_I2S_SCK (3u)
@@ -204,6 +203,21 @@ static const uint8_t SCL = PIN_WIRE_SCL;
204203
#define PIN_QSPI_IO2 (44u)
205204
#define PIN_QSPI_IO3 (45u)
206205

206+
//PCC Pins
207+
#define PIN_PCC_DEN1 (13u)
208+
#define PIN_PCC_DEN2 (PIN_SPI_SCK)
209+
#define PIN_PCC_CLK (PIN_SPI_MISO)
210+
#define PIN_PCC_D0 (13u)
211+
#define PIN_PCC_D1 (12u)
212+
#define PIN_PCC_D2 (10u)
213+
#define PIN_PCC_D3 (11u)
214+
#define PIN_PCC_D4 (9u)
215+
#define PIN_PCC_D5 (8u)
216+
#define PIN_PCC_D6 (1u)
217+
#define PIN_PCC_D7 (0u)
218+
#define PIN_PCC_D8 (5u)
219+
#define PIN_PCC_D9 (6u)
220+
207221
//TODO: meaningful value for this
208222
#define VARIANT_QSPI_BAUD_DEFAULT 5000000
209223

0 commit comments

Comments
 (0)