Skip to content

Commit 585c31e

Browse files
authored
Pin definitions for Pimoroni Tiny 2040 (#1699)
Fixes #1696 Additional pin definitions for Pimoroni Tiny 2040, including using the Green LED element of the RGB LED as the default LED. There are only 12 external header pins for GPIO, including 4 ADC pins, so there are less options for assigning pins than on a generic Pico RP2040. In particular, there can only be one SPI, and it can't have an SS pin but I've defined GPIO17, as on the pico, because the definition is used in generic / common.h. BOOTSEL on the Pimoroni Tiny 2040 is connected to GPIO23. I don't know if that has any consequences for implementing reading from BOOTSEL for this board. That may need to be revisited, but it doesn't appear to involve any changes to pins_arduino.h.
1 parent a385a4c commit 585c31e

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed
Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
#pragma once
22

3-
// This is a bare board with no real predefined pins, so use generic
3+
// This is a bare board with few predefined pins, so based on generic
44

5-
#include "../generic/pins_arduino.h"
5+
// Pin definitions taken from:
6+
// https://datasheets.raspberrypi.org/pico/pico-datasheet.pdf
7+
// https://shop.pimoroni.com/products/tiny-2040
8+
9+
// RGB LED on pins 18-20. Use the Green LED element on pin 19 as LED_BUILTIN
10+
#define PIN_LED (19u)
11+
12+
// Serial
13+
#define PIN_SERIAL1_TX (0u)
14+
#define PIN_SERIAL1_RX (1u)
15+
16+
#define PIN_SERIAL2_TX (4u)
17+
#define PIN_SERIAL2_RX (5u)
18+
19+
// SPI = SPI0 only, on GPI0 0-3 or 4-7 (no SS)
20+
#define PIN_SPI0_MISO (4u)
21+
#define PIN_SPI0_MOSI (7u)
22+
#define PIN_SPI0_SCK (6u)
23+
// PIN_SPI0_SS not available on any header pin but needs to be defined for ../generic/common.h so use a dummy
24+
#define PIN_SPI0_SS (17u)
25+
26+
// SPI1 not available - not enough pins
27+
28+
// Wire = WIRE0 on 0-1 or 4-5, WIRE1 on 2-3 or 6-7
29+
#define PIN_WIRE0_SDA (4u)
30+
#define PIN_WIRE0_SCL (5u)
31+
32+
#define PIN_WIRE1_SDA (6u)
33+
#define PIN_WIRE1_SCL (7u)
34+
35+
#define SERIAL_HOWMANY (3u)
36+
#define SPI_HOWMANY (1u)
37+
#define WIRE_HOWMANY (2u)
38+
39+
#include "../generic/common.h"

0 commit comments

Comments
 (0)