
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.
65 строки
917 Б
Go
65 строки
917 Б
Go
// +build pca10056
|
|
|
|
package machine
|
|
|
|
const HasLowFrequencyCrystal = true
|
|
|
|
// LEDs on the pca10056
|
|
const (
|
|
LED Pin = LED1
|
|
LED1 Pin = 13
|
|
LED2 Pin = 14
|
|
LED3 Pin = 15
|
|
LED4 Pin = 16
|
|
)
|
|
|
|
// Buttons on the pca10056
|
|
const (
|
|
BUTTON Pin = BUTTON1
|
|
BUTTON1 Pin = 11
|
|
BUTTON2 Pin = 12
|
|
BUTTON3 Pin = 24
|
|
BUTTON4 Pin = 25
|
|
)
|
|
|
|
var DefaultUART = UART0
|
|
|
|
// UART pins
|
|
const (
|
|
UART_TX_PIN Pin = 6
|
|
UART_RX_PIN Pin = 8
|
|
)
|
|
|
|
// ADC pins
|
|
const (
|
|
ADC0 Pin = 3
|
|
ADC1 Pin = 4
|
|
ADC2 Pin = 28
|
|
ADC3 Pin = 29
|
|
ADC4 Pin = 30
|
|
ADC5 Pin = 31
|
|
)
|
|
|
|
// I2C pins
|
|
const (
|
|
SDA_PIN Pin = 26 // P0.26
|
|
SCL_PIN Pin = 27 // P0.27
|
|
)
|
|
|
|
// SPI pins
|
|
const (
|
|
SPI0_SCK_PIN Pin = 47 // P1.15
|
|
SPI0_SDO_PIN Pin = 45 // P1.13
|
|
SPI0_SDI_PIN Pin = 46 // P1.14
|
|
)
|
|
|
|
// USB CDC identifiers
|
|
const (
|
|
usb_STRING_PRODUCT = "Nordic nRF52840DK (PCA10056)"
|
|
usb_STRING_MANUFACTURER = "Nordic Semiconductor"
|
|
)
|
|
|
|
var (
|
|
usb_VID uint16 = 0x239A
|
|
usb_PID uint16 = 0x8029
|
|
)
|