mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 23:13:40 +00:00
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:
committed by
Ron Evans
parent
478dd3a28d
commit
e50885a6f2
@@ -165,3 +165,14 @@ func uartRead(bus uint8, buf *byte, bufLen int) int
|
||||
|
||||
//export __tinygo_uart_write
|
||||
func uartWrite(bus uint8, buf *byte, bufLen int) int
|
||||
|
||||
// Some objects used by Atmel SAM D chips (samd21, samd51).
|
||||
// Defined here (without build tag) for convenience.
|
||||
var (
|
||||
sercomUSART0 = UART{0}
|
||||
sercomUSART1 = UART{1}
|
||||
sercomUSART2 = UART{2}
|
||||
sercomUSART3 = UART{3}
|
||||
sercomUSART4 = UART{4}
|
||||
sercomUSART5 = UART{5}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user