tinygo/src/machine/board_reelboard.go
Ayke van Laethem 96e863f0f3 all: add a flag to the command line to select the serial implementation
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.
2021-06-25 17:58:39 +02:00

74 строки
1,4 КиБ
Go

// +build reelboard
package machine
const HasLowFrequencyCrystal = true
// Pins on the reel board
const (
LED Pin = LED1
LED1 Pin = LED_YELLOW
LED2 Pin = LED_RED
LED3 Pin = LED_GREEN
LED4 Pin = LED_BLUE
LED_RED Pin = 11
LED_GREEN Pin = 12
LED_BLUE Pin = 41
LED_YELLOW Pin = 13
EPD_BUSY_PIN Pin = 14
EPD_RESET_PIN Pin = 15
EPD_DC_PIN Pin = 16
EPD_CS_PIN Pin = 17
EPD_SCK_PIN Pin = 19
EPD_SDO_PIN Pin = 20
POWER_SUPPLY_PIN Pin = 32
)
// User "a" button on the reel board
const (
BUTTON Pin = 7
)
var DefaultUART = UART0
// UART pins
const (
UART_TX_PIN Pin = 6
UART_RX_PIN Pin = 8
)
// I2C pins
const (
SDA_PIN Pin = 26
SCL_PIN Pin = 27
)
// SPI pins
const (
SPI0_SCK_PIN Pin = 47
SPI0_SDO_PIN Pin = 45
SPI0_SDI_PIN Pin = 46
)
// PowerSupplyActive enables the supply voltages for nRF52840 and peripherals (true) or only for nRF52840 (false)
// This controls the TPS610981 boost converter. You must turn the power supply active in order to use the EPD and
// other onboard peripherals.
func PowerSupplyActive(active bool) {
POWER_SUPPLY_PIN.Configure(PinConfig{Mode: PinOutput})
if active {
POWER_SUPPLY_PIN.High()
} else {
POWER_SUPPLY_PIN.Low()
}
}
// USB CDC identifiers
const (
usb_STRING_PRODUCT = "PHYTEC reelboard"
usb_STRING_MANUFACTURER = "PHYTEC"
)
var (
usb_VID uint16 = 0x2FE3
usb_PID uint16 = 0x100
)