machine/nice\!nano: add board support
Этот коммит содержится в:
Přemek Vyhnal 2021-01-24 16:46:21 +01:00 коммит произвёл GitHub
родитель d8cc48b09b
коммит 32a5d46c57
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 96 добавлений и 1 удалений

Просмотреть файл

@ -43,7 +43,7 @@ See the [getting started instructions](https://tinygo.org/getting-started/) for
You can compile TinyGo programs for microcontrollers, WebAssembly and Linux. You can compile TinyGo programs for microcontrollers, WebAssembly and Linux.
The following 44 microcontroller boards are currently supported: The following 45 microcontroller boards are currently supported:
* [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333) * [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
* [Adafruit Circuit Playground Express](https://www.adafruit.com/product/3333) * [Adafruit Circuit Playground Express](https://www.adafruit.com/product/3333)
@ -71,6 +71,7 @@ The following 44 microcontroller boards are currently supported:
* [ESP8266](https://www.espressif.com/en/products/socs/esp8266) * [ESP8266](https://www.espressif.com/en/products/socs/esp8266)
* [Game Boy Advance](https://en.wikipedia.org/wiki/Game_Boy_Advance) * [Game Boy Advance](https://en.wikipedia.org/wiki/Game_Boy_Advance)
* [Makerdiary nRF52840-MDK](https://wiki.makerdiary.com/nrf52840-mdk/) * [Makerdiary nRF52840-MDK](https://wiki.makerdiary.com/nrf52840-mdk/)
* [nice!nano](https://docs.nicekeyboards.com/#/nice!nano/)
* [Nintendo Switch](https://www.nintendo.com/switch/) * [Nintendo Switch](https://www.nintendo.com/switch/)
* [Nordic Semiconductor PCA10031](https://www.nordicsemi.com/eng/Products/nRF51-Dongle) * [Nordic Semiconductor PCA10031](https://www.nordicsemi.com/eng/Products/nRF51-Dongle)
* [Nordic Semiconductor PCA10040](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK) * [Nordic Semiconductor PCA10040](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK)

84
src/machine/board_nicenano.go Обычный файл
Просмотреть файл

@ -0,0 +1,84 @@
// +build nicenano
package machine
const HasLowFrequencyCrystal = true
// GPIO Pins
const (
D006 = P0_06
D008 = P0_08
D017 = P0_17
D020 = P0_20
D022 = P0_22
D024 = P0_24
D100 = P1_00
D011 = P0_11
D104 = P1_04
D106 = P1_06
D004 = P0_04 // AIN2; P0.04 (AIN2) is used to read the voltage of the battery via ADC. It cant be used for any other function.
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
D115 = P1_15
D113 = P1_13
D031 = P0_31 // AIN7
D029 = P0_29 // AIN5
D002 = P0_02 // AIN0
D111 = P1_11
D010 = P0_10 // NFC2
D009 = P0_09 // NFC1
D026 = P0_26
D012 = P0_12
D101 = P1_01
D102 = P1_02
D107 = P1_07
)
// Analog Pins
const (
AIN2 = P0_04 // Battery
AIN7 = P0_31
AIN5 = P0_29
AIN0 = P0_02
)
const (
LED = P0_15
)
// UART0 pins (logical UART1)
const (
UART_RX_PIN = P0_06
UART_TX_PIN = P0_08
)
// UART0 is the USB device
var (
UART0 = USB
)
// I2C pins
const (
SDA_PIN = P0_17 // I2C0 external
SCL_PIN = P0_20 // I2C0 external
)
// SPI pins
const (
SPI0_SCK_PIN = P0_22 // SCK
SPI0_SDO_PIN = P0_24 // SDO
SPI0_SDI_PIN = P1_00 // SDI
)
// USB CDC identifiers
const (
usb_STRING_PRODUCT = "nice!nano"
usb_STRING_MANUFACTURER = "Nice Keyboards"
)
var (
usb_VID uint16 = 0x239A
usb_PID uint16 = 0x0029
)

10
targets/nicenano.json Обычный файл
Просмотреть файл

@ -0,0 +1,10 @@
{
"inherits": ["nrf52840"],
"build-tags": ["nicenano","nrf52840_reset_uf2", "softdevice", "s140v6"],
"flash-1200-bps-reset": "true",
"flash-method": "msd",
"msd-volume-name": "NICENANO",
"msd-firmware-name": "firmware.uf2",
"uf2-family-id": "0xADA52840",
"linkerscript": "targets/circuitplay-bluefruit.ld"
}