sam: simplify definition of SERCOM UART peripherals

Instead of defining them separately for each board, define them once in
the chip definition and later simply use &sercomUART1 etc. to refer to
them. This is simpler and less error-prone.

I found two bugs while working on this:

  - The P1AM-100 board mixed SERCOM 5 and SERCOM 3. It looks like SERCOM
    5 was intended, based on the used pins.
  - The Adafruit Matrix Portal appears to have configured the wrong
    interrupt.

Unfortunately, I can't test these fixes. However, they make it clear
that such a change is important to avoid bugs.

I tested this commit on the PyBadge and the Circuit Playground Express.
This commit is contained in:
Ayke van Laethem
2021-10-15 21:20:45 +02:00
committed by Ron Evans
parent 478dd3a28d
commit e50885a6f2
35 changed files with 156 additions and 402 deletions
+10
View File
@@ -160,6 +160,16 @@ const (
UART_TX_PIN = UART1_TX_PIN //
)
// UART on the Grand Central M4
var (
UART1 = &sercomUSART0
UART2 = &sercomUSART4
UART3 = &sercomUSART1
UART4 = &sercomUSART5
DefaultUART = UART1
)
// SPI pins
const (
SPI0_SCK_PIN = D66 // (PD09), also on D52