mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 20:14:04 +00:00
e50885a6f2
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.
30 lines
374 B
Go
30 lines
374 B
Go
// +build sam,atsamd51,matrixportal_m4
|
|
|
|
package machine
|
|
|
|
import (
|
|
"device/sam"
|
|
)
|
|
|
|
// I2C on the MatrixPortal M4
|
|
var (
|
|
I2C0 = &I2C{
|
|
Bus: sam.SERCOM5_I2CM,
|
|
SERCOM: 5,
|
|
}
|
|
)
|
|
|
|
// SPI on the MatrixPortal M4
|
|
var (
|
|
SPI0 = SPI{
|
|
Bus: sam.SERCOM3_SPIM,
|
|
SERCOM: 3, // BUG: SDO on SERCOM1!
|
|
}
|
|
NINA_SPI = SPI0
|
|
|
|
SPI1 = SPI{
|
|
Bus: sam.SERCOM0_SPIM,
|
|
SERCOM: 0,
|
|
}
|
|
)
|