Skip to content

Commit

Permalink
machine: update boards and machines to use UARTCommon
Browse files Browse the repository at this point in the history
  • Loading branch information
xudongzheng committed Nov 16, 2023
1 parent 12d60a2 commit 27f2fb3
Show file tree
Hide file tree
Showing 45 changed files with 157 additions and 156 deletions.
8 changes: 4 additions & 4 deletions src/machine/board_ae_rp2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}

UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART1,
UARTCommon: NewUARTCommon(),
Bus: rp.UART1,
}
)

Expand Down
6 changes: 3 additions & 3 deletions src/machine/board_arduino_mega2560.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const (
var (
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),

dataReg: avr.UDR1,
baudRegH: avr.UBRR1H,
Expand All @@ -136,7 +136,7 @@ var (
}
UART2 = &_UART2
_UART2 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),

dataReg: avr.UDR2,
baudRegH: avr.UBRR2H,
Expand All @@ -147,7 +147,7 @@ var (
}
UART3 = &_UART3
_UART3 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),

dataReg: avr.UDR3,
baudRegH: avr.UBRR3H,
Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_badger2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}
)

Expand Down
8 changes: 4 additions & 4 deletions src/machine/board_bluepill.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ var (
// USART1 is the first hardware serial port on the STM32.
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART1,
UARTCommon: NewUARTCommon(),
Bus: stm32.USART1,
}
UART2 = &_UART2
_UART2 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART2,
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
}
)

Expand Down
8 changes: 4 additions & 4 deletions src/machine/board_challenger_rp2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}

UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART1,
UARTCommon: NewUARTCommon(),
Bus: rp.UART1,
}
)

Expand Down
6 changes: 3 additions & 3 deletions src/machine/board_feather-stm32f405.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,21 @@ const (
var (
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART3,
TxAltFuncSelector: AF7_USART1_2_3,
RxAltFuncSelector: AF7_USART1_2_3,
}
UART2 = &_UART2
_UART2 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART6,
TxAltFuncSelector: AF8_USART4_5_6,
RxAltFuncSelector: AF8_USART4_5_6,
}
UART3 = &_UART3
_UART3 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART1,
TxAltFuncSelector: AF7_USART1_2_3,
RxAltFuncSelector: AF7_USART1_2_3,
Expand Down
8 changes: 4 additions & 4 deletions src/machine/board_feather_rp2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}

UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART1,
UARTCommon: NewUARTCommon(),
Bus: rp.UART1,
}
)

Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_gnse.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var (
// STM32 UART2 is connected to the embedded STLINKV3 Virtual Com Port
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
TxAltFuncSelector: 7,
RxAltFuncSelector: 7,
Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_gopher-badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const (
var (
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART1,
UARTCommon: NewUARTCommon(),
Bus: rp.UART1,
}
)

Expand Down
8 changes: 4 additions & 4 deletions src/machine/board_kb2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}

UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART1,
UARTCommon: NewUARTCommon(),
Bus: rp.UART1,
}
)

Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_lgt92.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var (
// Console UART (LPUSART1)
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.LPUART1,
TxAltFuncSelector: 6,
RxAltFuncSelector: 6,
Expand All @@ -70,7 +70,7 @@ var (
// Gps UART
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART1,
TxAltFuncSelector: 0,
RxAltFuncSelector: 0,
Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_lorae5.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var (
// Console UART
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART1,
TxAltFuncSelector: AF7_USART1_2,
RxAltFuncSelector: AF7_USART1_2,
Expand All @@ -69,7 +69,7 @@ var (
// UART2
UART2 = &_UART2
_UART2 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
TxAltFuncSelector: AF7_USART1_2,
RxAltFuncSelector: AF7_USART1_2,
Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_macropad-rp2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}
)

Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_nano-rp2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}
)

Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_nucleof103rb.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ var (
// debugger to be exposed as virtual COM port over USB on Nucleo boards.
UART2 = &_UART2
_UART2 = UART{
Buffer: NewRingBuffer(),
Bus: stm32.USART2,
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
}
DefaultUART = UART2
)
Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_nucleof722ze.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
// debugger to be exposed as virtual COM port over USB on Nucleo boards.
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART3,
TxAltFuncSelector: UART_ALT_FN,
RxAltFuncSelector: UART_ALT_FN,
Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_nucleol031k6.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var (
// debugger to be exposed as virtual COM port over USB on Nucleo boards.
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
TxAltFuncSelector: 4,
RxAltFuncSelector: 4,
Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_nucleol432kc.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var (
// debugger to be exposed as virtual COM port over USB on Nucleo boards.
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
TxAltFuncSelector: 7,
RxAltFuncSelector: 3,
Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_nucleol552ze.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
// debugger to be exposed as virtual COM port over USB on Nucleo boards.
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.LPUART1,
TxAltFuncSelector: UART_ALT_FN,
RxAltFuncSelector: UART_ALT_FN,
Expand Down
4 changes: 2 additions & 2 deletions src/machine/board_nucleowl55jc.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
// STM32 UART2 is connected to the embedded STLINKV3 Virtual Com Port
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
TxAltFuncSelector: 7,
RxAltFuncSelector: 7,
Expand All @@ -64,7 +64,7 @@ var (
// UART1 is free
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART1,
TxAltFuncSelector: 7,
RxAltFuncSelector: 7,
Expand Down
8 changes: 4 additions & 4 deletions src/machine/board_pico.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}

UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART1,
UARTCommon: NewUARTCommon(),
Bus: rp.UART1,
}
)

Expand Down
8 changes: 4 additions & 4 deletions src/machine/board_qtpy_rp2040.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ const (
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
UARTCommon: NewUARTCommon(),
Bus: rp.UART0,
}

UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART1,
UARTCommon: NewUARTCommon(),
Bus: rp.UART1,
}
)

Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_stm32f469disco.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
var (
UART3 = &_UART3
_UART3 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART3,
TxAltFuncSelector: AF7_USART1_2_3,
RxAltFuncSelector: AF7_USART1_2_3,
Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_stm32f4disco.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
var (
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART2,
TxAltFuncSelector: AF7_USART1_2_3,
RxAltFuncSelector: AF7_USART1_2_3,
Expand Down
2 changes: 1 addition & 1 deletion src/machine/board_swan.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var (
// USART1 is connected to the TX/RX pins
UART1 = &_UART1
_UART1 = UART{
Buffer: NewRingBuffer(),
UARTCommon: NewUARTCommon(),
Bus: stm32.USART1,
TxAltFuncSelector: 7,
RxAltFuncSelector: 7,
Expand Down
Loading

0 comments on commit 27f2fb3

Please sign in to comment.