mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 15:03:41 +00:00
aa5b8d0df7
This means that machine.UART0, machine.UART1, etc are of type *machine.UART, not machine.UART. This makes them easier to pass around and avoids surprises when they are passed around by value while they should be passed around by reference. There is a small code size impact in some cases, but it is relatively minor.
49 lines
739 B
Go
49 lines
739 B
Go
// +build sam,atsamd21,p1am_100
|
|
|
|
package machine
|
|
|
|
import (
|
|
"device/sam"
|
|
"runtime/interrupt"
|
|
)
|
|
|
|
// UART1 on the P1AM-100 connects to the normal TX/RX pins.
|
|
var (
|
|
UART1 = &_UART1
|
|
_UART1 = UART{
|
|
Buffer: NewRingBuffer(),
|
|
Bus: sam.SERCOM3_USART,
|
|
SERCOM: 5,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
UART1.Interrupt = interrupt.New(sam.IRQ_SERCOM5, _UART1.handleInterrupt)
|
|
}
|
|
|
|
// I2C on the P1AM-100.
|
|
var (
|
|
I2C0 = &I2C{
|
|
Bus: sam.SERCOM0_I2CM,
|
|
SERCOM: 0,
|
|
}
|
|
)
|
|
|
|
// SPI on the P1AM-100 is used for Base Controller.
|
|
var (
|
|
SPI0 = SPI{
|
|
Bus: sam.SERCOM1_SPI,
|
|
SERCOM: 1,
|
|
}
|
|
BASE_CONTROLLER_SPI = SPI0
|
|
)
|
|
|
|
// SPI1 is connected to the SD card slot on the P1AM-100
|
|
var (
|
|
SPI1 = SPI{
|
|
Bus: sam.SERCOM2_SPI,
|
|
SERCOM: 2,
|
|
}
|
|
SDCARD_SPI = SPI1
|
|
)
|