Standardize SAMD51 UART settings (#1155)

* machine/samd51: standardize samd51 uart settings
This commit is contained in:
sago35
2020-06-05 15:14:31 +09:00
committed by GitHub
parent 64d51b215f
commit 0c880ec44c
11 changed files with 238 additions and 154 deletions
+37
View File
@@ -0,0 +1,37 @@
// +build sam,atsamd51,pyportal
package machine
import (
"device/sam"
"runtime/interrupt"
)
var (
UART1 = UART{
Buffer: NewRingBuffer(),
Bus: sam.SERCOM4_USART_INT,
SERCOM: 4,
}
)
func init() {
UART1.Interrupt = interrupt.New(sam.IRQ_SERCOM4_2, UART1.handleInterrupt)
}
// I2C on the PyPortal.
var (
I2C0 = I2C{
Bus: sam.SERCOM5_I2CM,
SERCOM: 5,
}
)
// SPI on the PyPortal.
var (
SPI0 = SPI{
Bus: sam.SERCOM2_SPIM,
SERCOM: 2,
}
NINA_SPI = SPI0
)