Skip to content

Commit 32a5d46

Browse files
authored
nice!nano board support (#1499)
machine/nice\!nano: add board support
1 parent d8cc48b commit 32a5d46

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

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 44 microcontroller boards are currently supported:
46+
The following 45 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)
@@ -71,6 +71,7 @@ The following 44 microcontroller boards are currently supported:
7171
* [ESP8266](https://www.espressif.com/en/products/socs/esp8266)
7272
* [Game Boy Advance](https://en.wikipedia.org/wiki/Game_Boy_Advance)
7373
* [Makerdiary nRF52840-MDK](https://wiki.makerdiary.com/nrf52840-mdk/)
74+
* [nice!nano](https://docs.nicekeyboards.com/#/nice!nano/)
7475
* [Nintendo Switch](https://www.nintendo.com/switch/)
7576
* [Nordic Semiconductor PCA10031](https://www.nordicsemi.com/eng/Products/nRF51-Dongle)
7677
* [Nordic Semiconductor PCA10040](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK)

src/machine/board_nicenano.go

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// +build nicenano
2+
3+
package machine
4+
5+
const HasLowFrequencyCrystal = true
6+
7+
// GPIO Pins
8+
const (
9+
D006 = P0_06
10+
D008 = P0_08
11+
D017 = P0_17
12+
D020 = P0_20
13+
D022 = P0_22
14+
D024 = P0_24
15+
D100 = P1_00
16+
D011 = P0_11
17+
D104 = P1_04
18+
D106 = P1_06
19+
20+
D004 = P0_04 // AIN2; P0.04 (AIN2) is used to read the voltage of the battery via ADC. It can’t be used for any other function.
21+
D013 = P0_13 // VCC 3.3V; P0.13 on VCC shuts off the power to VCC when you set it to high; This saves on battery immensely for LEDs of all kinds that eat power even when off
22+
D115 = P1_15
23+
D113 = P1_13
24+
D031 = P0_31 // AIN7
25+
D029 = P0_29 // AIN5
26+
D002 = P0_02 // AIN0
27+
28+
D111 = P1_11
29+
D010 = P0_10 // NFC2
30+
D009 = P0_09 // NFC1
31+
32+
D026 = P0_26
33+
D012 = P0_12
34+
D101 = P1_01
35+
D102 = P1_02
36+
D107 = P1_07
37+
)
38+
39+
// Analog Pins
40+
const (
41+
AIN2 = P0_04 // Battery
42+
AIN7 = P0_31
43+
AIN5 = P0_29
44+
AIN0 = P0_02
45+
)
46+
47+
const (
48+
LED = P0_15
49+
)
50+
51+
// UART0 pins (logical UART1)
52+
const (
53+
UART_RX_PIN = P0_06
54+
UART_TX_PIN = P0_08
55+
)
56+
57+
// UART0 is the USB device
58+
var (
59+
UART0 = USB
60+
)
61+
62+
// I2C pins
63+
const (
64+
SDA_PIN = P0_17 // I2C0 external
65+
SCL_PIN = P0_20 // I2C0 external
66+
)
67+
68+
// SPI pins
69+
const (
70+
SPI0_SCK_PIN = P0_22 // SCK
71+
SPI0_SDO_PIN = P0_24 // SDO
72+
SPI0_SDI_PIN = P1_00 // SDI
73+
)
74+
75+
// USB CDC identifiers
76+
const (
77+
usb_STRING_PRODUCT = "nice!nano"
78+
usb_STRING_MANUFACTURER = "Nice Keyboards"
79+
)
80+
81+
var (
82+
usb_VID uint16 = 0x239A
83+
usb_PID uint16 = 0x0029
84+
)

targets/nicenano.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": ["nicenano","nrf52840_reset_uf2", "softdevice", "s140v6"],
4+
"flash-1200-bps-reset": "true",
5+
"flash-method": "msd",
6+
"msd-volume-name": "NICENANO",
7+
"msd-firmware-name": "firmware.uf2",
8+
"uf2-family-id": "0xADA52840",
9+
"linkerscript": "targets/circuitplay-bluefruit.ld"
10+
}

0 commit comments

Comments
 (0)