mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-20 20:39:06 +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
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GPIO pins
|
// GPIO pins
|
||||||
const (
|
const (
|
||||||
GP0 Pin = GPIO0
|
GP0 Pin = GPIO0
|
||||||
@@ -77,28 +72,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
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,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "AE-RP2040"
|
usb_STRING_PRODUCT = "AE-RP2040"
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
// - Badger 2040 schematic: https://cdn.shopify.com/s/files/1/0174/1800/files/badger_2040_schematic.pdf?v=1645702148
|
// - Badger 2040 schematic: https://cdn.shopify.com/s/files/1/0174/1800/files/badger_2040_schematic.pdf?v=1645702148
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LED Pin = GPIO25
|
LED Pin = GPIO25
|
||||||
|
|
||||||
@@ -92,17 +87,4 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
|
||||||
var (
|
|
||||||
UART0 = &_UART0
|
|
||||||
_UART0 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART0,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
var DefaultUART = UART0
|
||||||
|
|
||||||
func init() {
|
|
||||||
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LED = GPIO24
|
LED = GPIO24
|
||||||
|
|
||||||
@@ -84,28 +79,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
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,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "Challenger 2040 LoRa"
|
usb_STRING_PRODUCT = "Challenger 2040 LoRa"
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Onboard crystal oscillator frequency, in MHz.
|
// Onboard crystal oscillator frequency, in MHz.
|
||||||
const xoscFreq = 12 // MHz
|
const xoscFreq = 12 // MHz
|
||||||
|
|
||||||
@@ -73,28 +68,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
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,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "Feather RP2040"
|
usb_STRING_PRODUCT = "Feather RP2040"
|
||||||
|
|||||||
@@ -5,11 +5,6 @@
|
|||||||
// For more information, see: https://gopherbadge.com/
|
// For more information, see: https://gopherbadge.com/
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
/*ADC0 Pin = GPIO26
|
/*ADC0 Pin = GPIO26
|
||||||
ADC1 Pin = GPIO27
|
ADC1 Pin = GPIO27
|
||||||
@@ -92,17 +87,4 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
|
||||||
var (
|
|
||||||
UART1 = &_UART1
|
|
||||||
_UART1 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART1,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART1
|
var DefaultUART = UART1
|
||||||
|
|
||||||
func init() {
|
|
||||||
UART1.Interrupt = interrupt.New(rp.IRQ_UART1_IRQ, _UART1.handleInterrupt)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Onboard crystal oscillator frequency, in MHz.
|
// Onboard crystal oscillator frequency, in MHz.
|
||||||
const xoscFreq = 12 // MHz
|
const xoscFreq = 12 // MHz
|
||||||
|
|
||||||
@@ -75,28 +70,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
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,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "KB2040"
|
usb_STRING_PRODUCT = "KB2040"
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
NeopixelCount = 12
|
NeopixelCount = 12
|
||||||
|
|
||||||
@@ -78,21 +73,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
|
||||||
var (
|
|
||||||
UART0 = &_UART0
|
|
||||||
_UART0 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART0,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
var DefaultUART = UART0
|
||||||
|
|
||||||
func init() {
|
|
||||||
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "MacroPad RP2040"
|
usb_STRING_PRODUCT = "MacroPad RP2040"
|
||||||
|
|||||||
@@ -11,11 +11,6 @@
|
|||||||
// - Nano RP2040 Connect technical reference: https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-01-technical-reference
|
// - Nano RP2040 Connect technical reference: https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-01-technical-reference
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Digital Pins
|
// Digital Pins
|
||||||
const (
|
const (
|
||||||
D2 Pin = GPIO25
|
D2 Pin = GPIO25
|
||||||
@@ -125,27 +120,7 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
// UART_NINA on the Arduino Nano RP2040 connects to the NINA HCI.
|
||||||
var (
|
var UART_NINA = UART1
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GPIO pins
|
// GPIO pins
|
||||||
const (
|
const (
|
||||||
GP0 Pin = GPIO0
|
GP0 Pin = GPIO0
|
||||||
@@ -79,28 +74,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
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,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "Pico"
|
usb_STRING_PRODUCT = "Pico"
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Onboard crystal oscillator frequency, in MHz.
|
// Onboard crystal oscillator frequency, in MHz.
|
||||||
const xoscFreq = 12 // MHz
|
const xoscFreq = 12 // MHz
|
||||||
|
|
||||||
@@ -84,28 +79,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
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,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "QT Py RP2040"
|
usb_STRING_PRODUCT = "QT Py RP2040"
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
|
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Onboard crystal oscillator frequency, in MHz.
|
// Onboard crystal oscillator frequency, in MHz.
|
||||||
const xoscFreq = 12 // MHz
|
const xoscFreq = 12 // MHz
|
||||||
|
|
||||||
@@ -90,21 +85,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
|
||||||
var (
|
|
||||||
UART0 = &_UART0
|
|
||||||
_UART0 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART0,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
var DefaultUART = UART0
|
||||||
|
|
||||||
func init() {
|
|
||||||
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB identifiers
|
// USB identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "Thing Plus RP2040"
|
usb_STRING_PRODUCT = "Thing Plus RP2040"
|
||||||
|
|||||||
@@ -5,11 +5,6 @@
|
|||||||
// https://thumby.us/
|
// https://thumby.us/
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
THUMBY_SCK_PIN = I2C1_SDA_PIN
|
THUMBY_SCK_PIN = I2C1_SDA_PIN
|
||||||
THUMBY_SDA_PIN = I2C1_SCL_PIN
|
THUMBY_SDA_PIN = I2C1_SCL_PIN
|
||||||
@@ -78,17 +73,4 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the Thumby
|
|
||||||
var (
|
|
||||||
UART0 = &_UART0
|
|
||||||
_UART0 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART0,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
var DefaultUART = UART0
|
||||||
|
|
||||||
func init() {
|
|
||||||
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
// - Tufty 2040 schematic: https://cdn.shopify.com/s/files/1/0174/1800/files/tufty_schematic.pdf?v=1655385675
|
// - Tufty 2040 schematic: https://cdn.shopify.com/s/files/1/0174/1800/files/tufty_schematic.pdf?v=1655385675
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LED Pin = GPIO25
|
LED Pin = GPIO25
|
||||||
|
|
||||||
@@ -87,17 +82,4 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
|
||||||
var (
|
|
||||||
UART0 = &_UART0
|
|
||||||
_UART0 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART0,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
var DefaultUART = UART0
|
||||||
|
|
||||||
func init() {
|
|
||||||
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
// - https://www.waveshare.com/wiki/RP2040-Zero
|
// - https://www.waveshare.com/wiki/RP2040-Zero
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Digital Pins
|
// Digital Pins
|
||||||
const (
|
const (
|
||||||
D0 Pin = GPIO0
|
D0 Pin = GPIO0
|
||||||
@@ -94,27 +89,8 @@ const (
|
|||||||
UART1_RX_PIN = GPIO9
|
UART1_RX_PIN = GPIO9
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
|
||||||
var (
|
|
||||||
UART0 = &_UART0
|
|
||||||
_UART0 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART0,
|
|
||||||
}
|
|
||||||
UART1 = &_UART1
|
|
||||||
_UART1 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART1,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB CDC identifiers
|
// USB CDC identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "RP2040-Zero"
|
usb_STRING_PRODUCT = "RP2040-Zero"
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
// - https://wiki.seeedstudio.com/XIAO-RP2040/
|
// - https://wiki.seeedstudio.com/XIAO-RP2040/
|
||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
|
||||||
"device/rp"
|
|
||||||
"runtime/interrupt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Digital Pins
|
// Digital Pins
|
||||||
const (
|
const (
|
||||||
D0 Pin = GPIO26
|
D0 Pin = GPIO26
|
||||||
@@ -81,21 +76,8 @@ const (
|
|||||||
UART_RX_PIN = UART0_RX_PIN
|
UART_RX_PIN = UART0_RX_PIN
|
||||||
)
|
)
|
||||||
|
|
||||||
// UART on the RP2040
|
|
||||||
var (
|
|
||||||
UART0 = &_UART0
|
|
||||||
_UART0 = UART{
|
|
||||||
Buffer: NewRingBuffer(),
|
|
||||||
Bus: rp.UART0,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var DefaultUART = UART0
|
var DefaultUART = UART0
|
||||||
|
|
||||||
func init() {
|
|
||||||
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB CDC identifiers
|
// USB CDC identifiers
|
||||||
const (
|
const (
|
||||||
usb_STRING_PRODUCT = "XIAO RP2040"
|
usb_STRING_PRODUCT = "XIAO RP2040"
|
||||||
|
|||||||
@@ -331,3 +331,23 @@ func (p Pin) ioIntBit(change PinChange) uint32 {
|
|||||||
func getIntChange(p Pin, status uint32) PinChange {
|
func getIntChange(p Pin, status uint32) PinChange {
|
||||||
return PinChange(status>>(4*(p%8))) & 0xf
|
return PinChange(status>>(4*(p%8))) & 0xf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UART on the RP2040
|
||||||
|
var (
|
||||||
|
UART0 = &_UART0
|
||||||
|
_UART0 = UART{
|
||||||
|
Buffer: NewRingBuffer(),
|
||||||
|
Bus: rp.UART0,
|
||||||
|
}
|
||||||
|
|
||||||
|
UART1 = &_UART1
|
||||||
|
_UART1 = UART{
|
||||||
|
Buffer: NewRingBuffer(),
|
||||||
|
Bus: rp.UART1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
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