mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-23 05:49:01 +00:00
rp2040: move UART0 and UART1 to common file
This is makes it easier to use these in simulation, plus it avoids duplication. The only downside I see is that more UARTs get defined than a board supports, but no existing code should break (no UARTs get renamed for example).
This commit is contained in:
committed by
Ron Evans
parent
2733e376bd
commit
c55ac9f28e
@@ -11,11 +11,6 @@
|
||||
// - Nano RP2040 Connect technical reference: https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-01-technical-reference
|
||||
package machine
|
||||
|
||||
import (
|
||||
"device/rp"
|
||||
"runtime/interrupt"
|
||||
)
|
||||
|
||||
// Digital Pins
|
||||
const (
|
||||
D2 Pin = GPIO25
|
||||
@@ -125,27 +120,7 @@ const (
|
||||
UART_RX_PIN = UART0_RX_PIN
|
||||
)
|
||||
|
||||
// UART on the RP2040
|
||||
var (
|
||||
UART0 = &_UART0
|
||||
_UART0 = UART{
|
||||
Buffer: NewRingBuffer(),
|
||||
Bus: rp.UART0,
|
||||
}
|
||||
|
||||
UART1 = &_UART1
|
||||
_UART1 = UART{
|
||||
Buffer: NewRingBuffer(),
|
||||
Bus: rp.UART1,
|
||||
}
|
||||
|
||||
// UART_NINA on the Arduino Nano RP2040 connects to the NINA HCI.
|
||||
UART_NINA = UART1
|
||||
)
|
||||
// UART_NINA on the Arduino Nano RP2040 connects to the NINA HCI.
|
||||
var UART_NINA = UART1
|
||||
|
||||
var DefaultUART = UART0
|
||||
|
||||
func init() {
|
||||
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
|
||||
UART1.Interrupt = interrupt.New(rp.IRQ_UART1_IRQ, _UART1.handleInterrupt)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user