mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 19:23:25 +00:00
Create "pico2-ice" target board (#5062)
* Create "pico2-ice" target board This board has an rp2350b chip on it, as well as a Lattice Semiconductor iCE40UP5K FPGA. More details of this open hardware board here: https://pico2-ice.tinyvision.ai/ Tested on a pico2-ice board with: ~/go/bin/tinygo flash -target=pico2-ice src/examples/blinky1/blinky1.go which blinks the GREEN LED (connected to GPIO0) on this board. Signed-off-by: Tinkerer <tinkerer@zappem.net> * More silkscreen labels for pico2-ice board Reading the schematic and the rev2 board viewer: https://raw.githubusercontent.com/tinyvision-ai-inc/pico2-ice/refs/heads/main/Board/Rev2/bom/ibom.html concluded that the RP2350B GPIO pins are not labeled with these pin numbers in the silkscreen. Instead, the silkscreen refers to uses of the GPIOs or the ICE numbered pins. RP2340B devoted pins map to the A1..4 B1..4 pins on the RP PMOD connector. Also silkscreen "~0".."~6" are labeled as pins N0..N6. Signed-off-by: Tinkerer <tinkerer@zappem.net> * Added a smoketest for pico2-ice board and tidied up GPIO defs Addresses review comments from aykevl. Signed-off-by: Tinkerer <tinkerer@zappem.net>
This commit is contained in:
@@ -124,6 +124,31 @@ const (
|
||||
fnXIP pinFunc = 0
|
||||
)
|
||||
|
||||
// validPins confirms that the SPI pin selection is a legitimate one
|
||||
// for the the 2040 chip.
|
||||
func (spi *SPI) validPins(config SPIConfig) error {
|
||||
var okSDI, okSDO, okSCK bool
|
||||
switch spi.Bus {
|
||||
case rp.SPI0:
|
||||
okSDI = config.SDI == 0 || config.SDI == 4 || config.SDI == 16 || config.SDI == 20
|
||||
okSDO = config.SDO == 3 || config.SDO == 7 || config.SDO == 19 || config.SDO == 23
|
||||
okSCK = config.SCK == 2 || config.SCK == 6 || config.SCK == 18 || config.SCK == 22
|
||||
case rp.SPI1:
|
||||
okSDI = config.SDI == 8 || config.SDI == 12 || config.SDI == 24 || config.SDI == 28
|
||||
okSDO = config.SDO == 11 || config.SDO == 15 || config.SDO == 27
|
||||
okSCK = config.SCK == 10 || config.SCK == 14 || config.SCK == 26
|
||||
}
|
||||
switch {
|
||||
case !okSDI:
|
||||
return errSPIInvalidSDI
|
||||
case !okSDO:
|
||||
return errSPIInvalidSDO
|
||||
case !okSCK:
|
||||
return errSPIInvalidSCK
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Configure configures the gpio pin as per mode.
|
||||
func (p Pin) Configure(config PinConfig) {
|
||||
if p == NoPin {
|
||||
|
||||
Reference in New Issue
Block a user