Browse Source

lgt92: update to new UART structure

pull/1739/head
Kenneth Bell 4 years ago
committed by Ron Evans
parent
commit
aa7c7b7bd9
  1. 14
      src/machine/board_lgt92.go
  2. 4
      src/machine/machine_stm32l0.go

14
src/machine/board_lgt92.go

@ -54,16 +54,18 @@ var (
// Console UART (LPUSART1)
UART0 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.LPUART1,
AltFuncSelector: 6,
Buffer: NewRingBuffer(),
Bus: stm32.LPUART1,
TxAltFuncSelector: 6,
RxAltFuncSelector: 6,
}
// Gps UART
UART1 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART1,
AltFuncSelector: 0,
Buffer: NewRingBuffer(),
Bus: stm32.USART1,
TxAltFuncSelector: 0,
RxAltFuncSelector: 0,
}
// SPI

4
src/machine/machine_stm32l0.go

@ -191,8 +191,8 @@ func enableAltFuncClock(bus unsafe.Pointer) {
// Configure the UART.
func (uart UART) configurePins(config UARTConfig) {
// enable the alternate functions on the TX and RX pins
config.TX.ConfigureAltFunc(PinConfig{Mode: PinModeUARTTX}, uart.AltFuncSelector)
config.RX.ConfigureAltFunc(PinConfig{Mode: PinModeUARTRX}, uart.AltFuncSelector)
config.TX.ConfigureAltFunc(PinConfig{Mode: PinModeUARTTX}, uart.TxAltFuncSelector)
config.RX.ConfigureAltFunc(PinConfig{Mode: PinModeUARTRX}, uart.RxAltFuncSelector)
}
// UART baudrate calc based on the bus and clockspeed

Loading…
Cancel
Save