Skip to content

Commit

Permalink
Merge pull request #1 from facts-engineering/add-serial2
Browse files Browse the repository at this point in the history
Add Serial2 and bump platform revision
  • Loading branch information
AdamCummick authored May 9, 2023
2 parents 407ae13 + be71d81 commit d38d5be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification

name=P1AM-100
version=1.6.20
version=1.6.21

# Compile variables
# -----------------
Expand Down
11 changes: 9 additions & 2 deletions variants/P1AM-100/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const PinDescription g_APinDescription[] = {
| 07 | D7 | PA21 | | *05 | | | X09 | | 5/03 | 3/03 | |*TCC0/7 | I2S/FS0 | GCLK_IO5 |
+------------+------------------+--------+-----------------+--------+-----+-----+-----+-----+---------+---------+--------+--------+----------+----------+
*/
{ PORTA, 22, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM4_CH0, TC4_CH0, EXTERNAL_INT_6 },
{ PORTA, 23, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM4_CH1, TC4_CH1, EXTERNAL_INT_7 },
{ PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM4_CH0, TC4_CH0, EXTERNAL_INT_6 },
{ PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM4_CH1, TC4_CH1, EXTERNAL_INT_7 },
{ PORTA, 10, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel18, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_NONE },
{ PORTA, 11, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), ADC_Channel19, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_NONE },
{ PORTB, 10, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER ), No_ADC_Channel, PWM5_CH0, TC5_CH0, EXTERNAL_INT_10 },
Expand Down Expand Up @@ -177,3 +177,10 @@ void SERCOM5_Handler()
Serial1.IrqHandler();
}

// Serial2
Uart Serial2 (&sercom3, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);

void SERCOM3_Handler()
{
Serial2.IrqHandler();
}
11 changes: 11 additions & 0 deletions variants/P1AM-100/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ static const uint8_t SCK1 = PIN_SPI1_SCK;
#define PIN_I2S_SCK (2u)
#define PIN_I2S_FS (3u)

#define P1AM100

// Serial ports
// ------------
#ifdef __cplusplus
Expand All @@ -170,6 +172,13 @@ extern Uart Serial1;
#define PIN_SERIAL1_TX (14ul)
#define PAD_SERIAL1_TX (UART_TX_PAD_2)
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)

// Serial 2
extern Uart Serial2;
#define PIN_SERIAL2_RX (1ul)
#define PIN_SERIAL2_TX (0ul)
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_1)
#define PAD_SERIAL2_TX (UART_TX_PAD_0)
#endif // __cplusplus

// These serial port names are intended to allow libraries and architecture-neutral
Expand All @@ -191,6 +200,8 @@ extern Uart Serial1;
#define SERIAL_PORT_MONITOR SerialUSB
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial1
#define SERIAL2_PORT_HARDWARE Serial2
#define SERIAL2_PORT_HARDWARE_OPEN Serial2

// Alias Serial to SerialUSB
#define Serial SerialUSB
Expand Down

0 comments on commit d38d5be

Please sign in to comment.