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
-20
View File
@@ -903,28 +903,8 @@ type UART struct {
var (
// UART0 is actually a USB CDC interface.
UART0 = USBCDC{Buffer: NewRingBuffer()}
// The first hardware serial port on the SAMD51. Uses the SERCOM3 interface.
UART1 = UART{
Buffer: NewRingBuffer(),
Bus: sam.SERCOM3_USART_INT,
SERCOM: 3,
}
// The second hardware serial port on the SAMD51. Uses the SERCOM0 interface.
UART2 = UART{
Buffer: NewRingBuffer(),
Bus: sam.SERCOM0_USART_INT,
SERCOM: 0,
}
)
func init() {
// Register RXC interrupts.
UART1.Interrupt = interrupt.New(sam.IRQ_SERCOM3_2, UART1.handleInterrupt)
UART2.Interrupt = interrupt.New(sam.IRQ_SERCOM0_2, UART2.handleInterrupt)
}
const (
sampleRate16X = 16
lsbFirst = 1