diff options
author | sago35 <[email protected]> | 2023-08-04 21:24:09 +0900 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-08-04 17:53:01 +0200 |
commit | 67ec722a741307cc9565251fd5a18765e79c5977 (patch) | |
tree | fcfc065b1c69e1f93e9db906d99826edf36aad3f /src/machine/board_ae_rp2040.go | |
parent | 62294feb5609e6e39ec09e21469fe166dfbc55e1 (diff) | |
download | tinygo-67ec722a741307cc9565251fd5a18765e79c5977.tar.gz tinygo-67ec722a741307cc9565251fd5a18765e79c5977.zip |
board: add AKIZUKI DENSHI AE-RP2040
Diffstat (limited to 'src/machine/board_ae_rp2040.go')
-rw-r--r-- | src/machine/board_ae_rp2040.go | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/machine/board_ae_rp2040.go b/src/machine/board_ae_rp2040.go new file mode 100644 index 000000000..91432e4b4 --- /dev/null +++ b/src/machine/board_ae_rp2040.go @@ -0,0 +1,111 @@ +//go:build ae_rp2040 + +package machine + +import ( + "device/rp" + "runtime/interrupt" +) + +// GPIO pins +const ( + GP0 Pin = GPIO0 + GP1 Pin = GPIO1 + GP2 Pin = GPIO2 + GP3 Pin = GPIO3 + GP4 Pin = GPIO4 + GP5 Pin = GPIO5 + GP6 Pin = GPIO6 + GP7 Pin = GPIO7 + GP8 Pin = GPIO8 + GP9 Pin = GPIO9 + GP10 Pin = GPIO10 + GP11 Pin = GPIO11 + GP12 Pin = GPIO12 + GP13 Pin = GPIO13 + GP14 Pin = GPIO14 + GP15 Pin = GPIO15 + GP16 Pin = GPIO16 + GP17 Pin = GPIO17 + GP18 Pin = GPIO18 + GP19 Pin = GPIO19 + GP20 Pin = GPIO20 + GP21 Pin = GPIO21 + GP22 Pin = GPIO22 + GP26 Pin = GPIO26 + GP27 Pin = GPIO27 + GP28 Pin = GPIO28 + GP29 Pin = GPIO29 + + // Onboard crystal oscillator frequency, in MHz. + xoscFreq = 12 // MHz +) + +// I2C Default pins on Raspberry Pico. +const ( + I2C0_SDA_PIN = GP4 + I2C0_SCL_PIN = GP5 + + I2C1_SDA_PIN = GP2 + I2C1_SCL_PIN = GP3 +) + +// SPI default pins +const ( + // Default Serial Clock Bus 0 for SPI communications + SPI0_SCK_PIN = GPIO18 + // Default Serial Out Bus 0 for SPI communications + SPI0_SDO_PIN = GPIO19 // Tx + // Default Serial In Bus 0 for SPI communications + SPI0_SDI_PIN = GPIO16 // Rx + + // Default Serial Clock Bus 1 for SPI communications + SPI1_SCK_PIN = GPIO10 + // Default Serial Out Bus 1 for SPI communications + SPI1_SDO_PIN = GPIO11 // Tx + // Default Serial In Bus 1 for SPI communications + SPI1_SDI_PIN = GPIO12 // Rx +) + +// UART pins +const ( + UART0_TX_PIN = GPIO0 + UART0_RX_PIN = GPIO1 + UART1_TX_PIN = GPIO8 + UART1_RX_PIN = GPIO9 + UART_TX_PIN = UART0_TX_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 + +func init() { + UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt) + UART1.Interrupt = interrupt.New(rp.IRQ_UART1_IRQ, _UART1.handleInterrupt) +} + +// USB identifiers +const ( + usb_STRING_PRODUCT = "AE-RP2040" + usb_STRING_MANUFACTURER = "AKIZUKI DENSHI" +) + +var ( + usb_VID uint16 = 0x2E8A + usb_PID uint16 = 0x000A +) |