Skip to content

Commit

Permalink
Create a pico2 specific target
Browse files Browse the repository at this point in the history
* Remove board-specific defines from rp2350 machine file
* Add pico2-specific target
  • Loading branch information
cibomahto committed Nov 22, 2024
1 parent 56cc0da commit 1c22895
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 12 deletions.
88 changes: 88 additions & 0 deletions src/machine/board_pico2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//go:build pico2

package machine

// 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

// Onboard LED
LED Pin = GPIO25

// 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
)

var DefaultUART = UART0

// USB identifiers
const (
usb_STRING_PRODUCT = "Pico2"
usb_STRING_MANUFACTURER = "Raspberry Pi"
)

var (
usb_VID uint16 = 0x2E8A
usb_PID uint16 = 0x000A
)
12 changes: 0 additions & 12 deletions src/machine/machine_rp2_2350.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import (
)

const (
LED = GPIO25
_NUMBANK0_GPIOS = 48
_NUMBANK0_IRQS = 6
xoscFreq = 12 // Pico 2 Crystal oscillator Abracon ABM8-272-T3 frequency in MHz
rp2350ExtraReg = 1
notimpl = "rp2350: not implemented"
initUnreset = rp.RESETS_RESET_ADC |
Expand All @@ -22,16 +20,6 @@ const (
rp.RESETS_RESET_USBCTRL
)

// 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
)

const (
PinOutput PinMode = iota
PinInput
Expand Down

0 comments on commit 1c22895

Please sign in to comment.