mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
96e863f0f3
This can be very useful for some purposes:
* It makes it possible to disable the UART in cases where it is not
needed or needs to be disabled to conserve power.
* It makes it possible to disable the serial output to reduce code
size, which may be important for some chips. Sometimes, a few kB can
be saved this way.
* It makes it possible to override the default, for example you might
want to use an actual UART to debug the USB-CDC implementation.
It also lowers the dependency on having machine.Serial defined, which is
often not defined when targeting a chip. Eventually, we might want to
make it possible to write `-target=nrf52` or `-target=atmega328p` for
example to target the chip itself with no board specific assumptions.
The defaults don't change. I checked this by running `make smoketest`
before and after and comparing the results.
60 lines
902 B
Go
60 lines
902 B
Go
// +build pca10059
|
|
|
|
package machine
|
|
|
|
// The PCA10040 has a low-frequency (32kHz) crystal oscillator on board.
|
|
const HasLowFrequencyCrystal = true
|
|
|
|
// LEDs on the PCA10059 (nRF52840 dongle)
|
|
const (
|
|
LED Pin = LED1
|
|
LED1 Pin = 6
|
|
LED2 Pin = 8
|
|
LED3 Pin = (1 << 5) | 9
|
|
LED4 Pin = 12
|
|
)
|
|
|
|
// Buttons on the PCA10059 (nRF52840 dongle)
|
|
const (
|
|
BUTTON Pin = BUTTON1
|
|
BUTTON1 Pin = (1 << 5) | 6
|
|
)
|
|
|
|
// ADC pins
|
|
const (
|
|
ADC1 Pin = 2
|
|
ADC2 Pin = 4
|
|
ADC3 Pin = 29
|
|
ADC4 Pin = 31
|
|
)
|
|
|
|
// UART pins
|
|
const (
|
|
UART_TX_PIN Pin = NoPin
|
|
UART_RX_PIN Pin = NoPin
|
|
)
|
|
|
|
// I2C pins (unused)
|
|
const (
|
|
SDA_PIN = NoPin
|
|
SCL_PIN = NoPin
|
|
)
|
|
|
|
// SPI pins (unused)
|
|
const (
|
|
SPI0_SCK_PIN = NoPin
|
|
SPI0_SDO_PIN = NoPin
|
|
SPI0_SDI_PIN = NoPin
|
|
)
|
|
|
|
// USB CDC identifiers
|
|
const (
|
|
usb_STRING_PRODUCT = "nRF52840 Dongle"
|
|
usb_STRING_MANUFACTURER = "Nordic Semiconductor ASA"
|
|
)
|
|
|
|
var (
|
|
usb_VID uint16 = 0x1915
|
|
usb_PID uint16 = 0xCAFE
|
|
)
|