mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 05:53:39 +00:00
55 lines
802 B
Go
55 lines
802 B
Go
// +build bluepill
|
|
|
|
package machine
|
|
|
|
import (
|
|
"device/stm32"
|
|
"runtime/interrupt"
|
|
)
|
|
|
|
const (
|
|
LED = PC13
|
|
)
|
|
|
|
var Serial = UART1
|
|
|
|
// UART pins
|
|
const (
|
|
UART_TX_PIN = PA9
|
|
UART_RX_PIN = PA10
|
|
UART_ALT_TX_PIN = PB6
|
|
UART_ALT_RX_PIN = PB7
|
|
)
|
|
|
|
var (
|
|
// USART1 is the first hardware serial port on the STM32.
|
|
UART1 = &_UART1
|
|
_UART1 = UART{
|
|
Buffer: NewRingBuffer(),
|
|
Bus: stm32.USART1,
|
|
}
|
|
UART2 = &_UART2
|
|
_UART2 = UART{
|
|
Buffer: NewRingBuffer(),
|
|
Bus: stm32.USART2,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
UART1.Interrupt = interrupt.New(stm32.IRQ_USART1, _UART1.handleInterrupt)
|
|
UART2.Interrupt = interrupt.New(stm32.IRQ_USART2, _UART2.handleInterrupt)
|
|
}
|
|
|
|
// SPI pins
|
|
const (
|
|
SPI0_SCK_PIN = PA5
|
|
SPI0_SDO_PIN = PA7
|
|
SPI0_SDI_PIN = PA6
|
|
)
|
|
|
|
// I2C pins
|
|
const (
|
|
I2C0_SDA_PIN = PB7
|
|
I2C0_SCL_PIN = PB6
|
|
)
|