board: Adafruit MacroPad RP2040

Этот коммит содержится в:
BCG 2022-02-14 00:13:00 -05:00 коммит произвёл Ron Evans
родитель 644356c220
коммит 52ffd6aa98
5 изменённых файлов: 89 добавлений и 1 удалений

Просмотреть файл

@ -465,6 +465,8 @@ endif
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=feather-rp2040 examples/blinky1
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=macropad-rp2040 examples/blinky1
@$(MD5SUM) test.hex
# test pwm
$(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm
@$(MD5SUM) test.hex

Просмотреть файл

@ -43,7 +43,7 @@ See the [getting started instructions](https://tinygo.org/getting-started/) for
You can compile TinyGo programs for microcontrollers, WebAssembly and Linux.
The following 81 microcontroller boards are currently supported:
The following 82 microcontroller boards are currently supported:
* [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
* [Adafruit Circuit Playground Express](https://www.adafruit.com/product/3333)
@ -59,6 +59,7 @@ The following 81 microcontroller boards are currently supported:
* [Adafruit ItsyBitsy M0](https://www.adafruit.com/product/3727)
* [Adafruit ItsyBitsy M4](https://www.adafruit.com/product/3800)
* [Adafruit ItsyBitsy nRF52840](https://www.adafruit.com/product/4481)
* [Adafruit MacroPad RP2040](https://www.adafruit.com/product/5100)
* [Adafruit Matrix Portal M4](https://www.adafruit.com/product/4745)
* [Adafruit Metro M4 Express Airlift](https://www.adafruit.com/product/4000)
* [Adafruit PyBadge](https://www.adafruit.com/product/4200)

66
src/machine/board_macropad-rp2040.go Обычный файл
Просмотреть файл

@ -0,0 +1,66 @@
//go:build macropad_rp2040
// +build macropad_rp2040
package machine
const (
NeopixelCount = 12
// Onboard crystal oscillator frequency, in MHz.
xoscFreq = 12 // MHz
)
const (
SWITCH = GPIO0
KEY1 = GPIO1
KEY2 = GPIO2
KEY3 = GPIO3
KEY4 = GPIO4
KEY5 = GPIO5
KEY6 = GPIO6
KEY7 = GPIO7
KEY8 = GPIO8
KEY9 = GPIO9
KEY10 = GPIO10
KEY11 = GPIO11
KEY12 = GPIO12
LED = GPIO13
SPEAKER_ENABLE = GPIO14
SPEAKER = GPIO16
ROT_A = GPIO18
ROT_B = GPIO17
OLED_CS = GPIO22
OLED_RST = GPIO23
OLED_DC = GPIO24
NEOPIXEL = GPIO19
WS2812 = NEOPIXEL
)
// I2C Default pins on Raspberry Pico.
const (
I2C0_SDA_PIN = GPIO20
I2C0_SCL_PIN = GPIO21
I2C1_SDA_PIN = 31 // not pinned out
I2C1_SCL_PIN = 31 // not pinned out
)
// SPI default pins
const (
// Default Serial Clock Bus 1 for SPI communications
SPI1_SCK_PIN = GPIO26
// Default Serial Out Bus 1 for SPI communications
SPI1_SDO_PIN = GPIO27 // Tx
// Default Serial In Bus 1 for SPI communications
SPI1_SDI_PIN = GPIO28 // Rx
SPI0_SCK_PIN = 31 // not pinned out
SPI0_SDO_PIN = 31 // not pinned out
SPI0_SDI_PIN = 31 // not pinned out
)

Просмотреть файл

@ -88,12 +88,20 @@ const (
PinSPI
)
func (p Pin) PortMaskSet() (*volatile.Register32, uint32) {
return &rp.SIO.GPIO_OUT_SET, 1 << p
}
// set drives the pin high
func (p Pin) set() {
mask := uint32(1) << p
rp.SIO.GPIO_OUT_SET.Set(mask)
}
func (p Pin) PortMaskClear() (*volatile.Register32, uint32) {
return &rp.SIO.GPIO_OUT_CLR, 1 << p
}
// clr drives the pin low
func (p Pin) clr() {
mask := uint32(1) << p

11
targets/macropad-rp2040.json Обычный файл
Просмотреть файл

@ -0,0 +1,11 @@
{
"inherits": [
"rp2040"
],
"build-tags": ["macropad_rp2040"],
"serial": "none",
"linkerscript": "targets/pico.ld",
"extra-files": [
"targets/pico-boot-stage2.S"
]
}