Skip to content

Commit 29d65cb

Browse files
authored
machine/itsybitsy-nrf52840: add support for Adafruit Itsybitsy nrf52840 (#1243)
* machine/itsybitsy-nrf52840: add support for Adafruit Itsybitsy nrf52840 Express board
1 parent 6300562 commit 29d65cb

File tree

4 files changed

+114
-1
lines changed

4 files changed

+114
-1
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ smoketest:
315315
@$(MD5SUM) test.hex
316316
$(TINYGO) build -size short -o test.hex -target=feather-nrf52840 examples/blinky1
317317
@$(MD5SUM) test.hex
318+
$(TINYGO) build -size short -o test.hex -target=itsybitsy-nrf52840 examples/blinky1
319+
@$(MD5SUM) test.hex
318320
ifneq ($(AVR), 0)
319321
$(TINYGO) build -size short -o test.hex -target=atmega1284p examples/serial
320322
@$(MD5SUM) test.hex

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ See the [getting started instructions](https://tinygo.org/getting-started/) for
4343

4444
You can compile TinyGo programs for microcontrollers, WebAssembly and Linux.
4545

46-
The following 39 microcontroller boards/devices are currently supported:
46+
The following 40 microcontroller boards are currently supported:
4747

4848
* [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
4949
* [Adafruit Circuit Playground Express](https://www.adafruit.com/product/3333)
@@ -53,6 +53,7 @@ The following 39 microcontroller boards/devices are currently supported:
5353
* [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
5454
* [Adafruit ItsyBitsy M0](https://www.adafruit.com/product/3727)
5555
* [Adafruit ItsyBitsy M4](https://www.adafruit.com/product/3800)
56+
* [Adafruit ItsyBitsy nRF52840](https://www.adafruit.com/product/4481)
5657
* [Adafruit Metro M4 Express Airlift](https://www.adafruit.com/product/4000)
5758
* [Adafruit PyBadge](https://www.adafruit.com/product/4200)
5859
* [Adafruit PyGamer](https://www.adafruit.com/product/4242)
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// +build itsybitsy_nrf52840
2+
3+
package machine
4+
5+
const HasLowFrequencyCrystal = true
6+
7+
// GPIO Pins
8+
const (
9+
D0 = P0_25 // UART TX
10+
D1 = P0_24 // UART RX
11+
D2 = P1_02
12+
D3 = P0_06 // LED1
13+
D4 = P0_29 // Button
14+
D5 = P0_27
15+
D6 = P1_09 // DotStar Clock
16+
D7 = P1_08
17+
D8 = P0_08 // DotStar Data
18+
D9 = P0_07
19+
D10 = P0_05
20+
D11 = P0_26
21+
D12 = P0_11
22+
D13 = P0_12
23+
D14 = P0_04 // A0
24+
D15 = P0_30 // A1
25+
D16 = P0_28 // A2
26+
D17 = P0_31 // A3
27+
D18 = P0_02 // A4
28+
D19 = P0_03 // A5
29+
D20 = P0_05 // A6
30+
D21 = P0_16 // I2C SDA
31+
D22 = P0_14 // I2C SCL
32+
D23 = P0_20 // SPI SDI
33+
D24 = P0_15 // SPI SDO
34+
D25 = P0_13 // SPI SCK
35+
D26 = P0_19 // QSPI SCK
36+
D27 = P0_23 // QSPI CS
37+
D28 = P0_21 // QSPI Data 0
38+
D29 = P0_22 // QSPI Data 1
39+
D30 = P1_00 // QSPI Data 2
40+
D31 = P0_17 // QSPI Data 3
41+
)
42+
43+
// Analog Pins
44+
const (
45+
A0 = D14
46+
A1 = D15
47+
A2 = D16
48+
A3 = D17
49+
A4 = D18
50+
A5 = D19
51+
A6 = D20
52+
)
53+
54+
const (
55+
LED = D3
56+
LED1 = LED
57+
BUTTON = D4
58+
59+
QSPI_SCK = D26
60+
QSPI_CS = D27
61+
QSPI_DATA0 = D28
62+
QSPI_DATA1 = D29
63+
QSPI_DATA2 = D30
64+
QSPI_DATA3 = D31
65+
)
66+
67+
// UART0 pins (logical UART1)
68+
const (
69+
UART_RX_PIN = D0
70+
UART_TX_PIN = D1
71+
)
72+
73+
// UART0 is the USB device
74+
var (
75+
UART0 = USB
76+
)
77+
78+
// I2C pins
79+
const (
80+
SDA_PIN = D21 // I2C0 external
81+
SCL_PIN = D22 // I2C0 external
82+
)
83+
84+
// SPI pins
85+
const (
86+
SPI0_SCK_PIN = D25
87+
SPI0_SDO_PIN = D24
88+
SPI0_SDI_PIN = D23
89+
)
90+
91+
// USB CDC identifiers
92+
const (
93+
usb_STRING_PRODUCT = "Adafruit ItsyBitsy nRF52840 Express"
94+
usb_STRING_MANUFACTURER = "Adafruit"
95+
)
96+
97+
var (
98+
usb_VID uint16 = 0x239A
99+
usb_PID uint16 = 0x8051
100+
)

targets/itsybitsy-nrf52840.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"inherits": ["nrf52840"],
3+
"build-tags": ["itsybitsy_nrf52840","nrf52840_reset_uf2"],
4+
"flash-1200-bps-reset": "true",
5+
"flash-method": "msd",
6+
"msd-volume-name": "ITSY840BOOT",
7+
"msd-firmware-name": "firmware.uf2",
8+
"uf2-family-id": "0xADA52840",
9+
"linkerscript": "targets/circuitplay-bluefruit.ld"
10+
}

0 commit comments

Comments
 (0)