Skip to content

Commit 67ec722

Browse files
sago35deadprogram
authored andcommitted
board: add AKIZUKI DENSHI AE-RP2040
1 parent 62294fe commit 67ec722

File tree

3 files changed

+127
-0
lines changed

3 files changed

+127
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ endif
648648
@$(MD5SUM) test.hex
649649
$(TINYGO) build -size short -o test.hex -target=gopher-badge examples/blinky1
650650
@$(MD5SUM) test.hex
651+
$(TINYGO) build -size short -o test.hex -target=ae-rp2040 examples/echo
652+
@$(MD5SUM) test.hex
651653
# test pwm
652654
$(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm
653655
@$(MD5SUM) test.hex

src/machine/board_ae_rp2040.go

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//go:build ae_rp2040
2+
3+
package machine
4+
5+
import (
6+
"device/rp"
7+
"runtime/interrupt"
8+
)
9+
10+
// GPIO pins
11+
const (
12+
GP0 Pin = GPIO0
13+
GP1 Pin = GPIO1
14+
GP2 Pin = GPIO2
15+
GP3 Pin = GPIO3
16+
GP4 Pin = GPIO4
17+
GP5 Pin = GPIO5
18+
GP6 Pin = GPIO6
19+
GP7 Pin = GPIO7
20+
GP8 Pin = GPIO8
21+
GP9 Pin = GPIO9
22+
GP10 Pin = GPIO10
23+
GP11 Pin = GPIO11
24+
GP12 Pin = GPIO12
25+
GP13 Pin = GPIO13
26+
GP14 Pin = GPIO14
27+
GP15 Pin = GPIO15
28+
GP16 Pin = GPIO16
29+
GP17 Pin = GPIO17
30+
GP18 Pin = GPIO18
31+
GP19 Pin = GPIO19
32+
GP20 Pin = GPIO20
33+
GP21 Pin = GPIO21
34+
GP22 Pin = GPIO22
35+
GP26 Pin = GPIO26
36+
GP27 Pin = GPIO27
37+
GP28 Pin = GPIO28
38+
GP29 Pin = GPIO29
39+
40+
// Onboard crystal oscillator frequency, in MHz.
41+
xoscFreq = 12 // MHz
42+
)
43+
44+
// I2C Default pins on Raspberry Pico.
45+
const (
46+
I2C0_SDA_PIN = GP4
47+
I2C0_SCL_PIN = GP5
48+
49+
I2C1_SDA_PIN = GP2
50+
I2C1_SCL_PIN = GP3
51+
)
52+
53+
// SPI default pins
54+
const (
55+
// Default Serial Clock Bus 0 for SPI communications
56+
SPI0_SCK_PIN = GPIO18
57+
// Default Serial Out Bus 0 for SPI communications
58+
SPI0_SDO_PIN = GPIO19 // Tx
59+
// Default Serial In Bus 0 for SPI communications
60+
SPI0_SDI_PIN = GPIO16 // Rx
61+
62+
// Default Serial Clock Bus 1 for SPI communications
63+
SPI1_SCK_PIN = GPIO10
64+
// Default Serial Out Bus 1 for SPI communications
65+
SPI1_SDO_PIN = GPIO11 // Tx
66+
// Default Serial In Bus 1 for SPI communications
67+
SPI1_SDI_PIN = GPIO12 // Rx
68+
)
69+
70+
// UART pins
71+
const (
72+
UART0_TX_PIN = GPIO0
73+
UART0_RX_PIN = GPIO1
74+
UART1_TX_PIN = GPIO8
75+
UART1_RX_PIN = GPIO9
76+
UART_TX_PIN = UART0_TX_PIN
77+
UART_RX_PIN = UART0_RX_PIN
78+
)
79+
80+
// UART on the RP2040
81+
var (
82+
UART0 = &_UART0
83+
_UART0 = UART{
84+
Buffer: NewRingBuffer(),
85+
Bus: rp.UART0,
86+
}
87+
88+
UART1 = &_UART1
89+
_UART1 = UART{
90+
Buffer: NewRingBuffer(),
91+
Bus: rp.UART1,
92+
}
93+
)
94+
95+
var DefaultUART = UART0
96+
97+
func init() {
98+
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
99+
UART1.Interrupt = interrupt.New(rp.IRQ_UART1_IRQ, _UART1.handleInterrupt)
100+
}
101+
102+
// USB identifiers
103+
const (
104+
usb_STRING_PRODUCT = "AE-RP2040"
105+
usb_STRING_MANUFACTURER = "AKIZUKI DENSHI"
106+
)
107+
108+
var (
109+
usb_VID uint16 = 0x2E8A
110+
usb_PID uint16 = 0x000A
111+
)

targets/ae-rp2040.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"inherits": [
3+
"rp2040"
4+
],
5+
"build-tags": ["ae_rp2040"],
6+
"serial-port": ["2e8a:000A"],
7+
"ldflags": [
8+
"--defsym=__flash_size=2048K"
9+
],
10+
"extra-files": [
11+
"targets/pico-boot-stage2.S"
12+
]
13+
}
14+

0 commit comments

Comments
 (0)