mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 03:27:48 +00:00
all: use groupName in peripherals
This is needed for support for multiple instances of a peripheral type.
This commit is contained in:
@@ -9,10 +9,10 @@ import (
|
||||
type GPIOMode uint8
|
||||
|
||||
const (
|
||||
GPIO_INPUT = (nrf.P0_PIN_CNF_DIR_Input << nrf.P0_PIN_CNF_DIR_Pos) | (nrf.P0_PIN_CNF_INPUT_Connect << nrf.P0_PIN_CNF_INPUT_Pos)
|
||||
GPIO_INPUT_PULLUP = GPIO_INPUT | (nrf.P0_PIN_CNF_PULL_Pullup << nrf.P0_PIN_CNF_PULL_Pos)
|
||||
GPIO_INPUT_PULLDOWN = GPIO_INPUT | (nrf.P0_PIN_CNF_PULL_Pulldown << nrf.P0_PIN_CNF_PULL_Pos)
|
||||
GPIO_OUTPUT = (nrf.P0_PIN_CNF_DIR_Output << nrf.P0_PIN_CNF_DIR_Pos) | (nrf.P0_PIN_CNF_INPUT_Disconnect << nrf.P0_PIN_CNF_INPUT_Pos)
|
||||
GPIO_INPUT = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
|
||||
GPIO_INPUT_PULLUP = GPIO_INPUT | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
|
||||
GPIO_INPUT_PULLDOWN = GPIO_INPUT | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
|
||||
GPIO_OUTPUT = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
|
||||
)
|
||||
|
||||
// LEDs on the PCA10040 (nRF52832 dev board)
|
||||
@@ -35,7 +35,7 @@ const (
|
||||
|
||||
// Configure this pin with the given configuration.
|
||||
func (p GPIO) Configure(config GPIOConfig) {
|
||||
cfg := config.Mode | nrf.P0_PIN_CNF_DRIVE_S0S1 | nrf.P0_PIN_CNF_SENSE_Disabled
|
||||
cfg := config.Mode | nrf.GPIO_PIN_CNF_DRIVE_S0S1 | nrf.GPIO_PIN_CNF_SENSE_Disabled
|
||||
nrf.P0.PIN_CNF[p.Pin] = nrf.RegValue(cfg)
|
||||
}
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ func init() {
|
||||
}
|
||||
|
||||
func initUART() {
|
||||
nrf.UART0.ENABLE = nrf.UART0_ENABLE_ENABLE_Enabled
|
||||
nrf.UART0.BAUDRATE = nrf.UART0_BAUDRATE_BAUDRATE_Baud115200
|
||||
nrf.UART0.ENABLE = nrf.UART_ENABLE_ENABLE_Enabled
|
||||
nrf.UART0.BAUDRATE = nrf.UART_BAUDRATE_BAUDRATE_Baud115200
|
||||
nrf.UART0.TASKS_STARTTX = 1
|
||||
nrf.UART0.PSELTXD = 6 // pin 6 for NRF52840-DK
|
||||
}
|
||||
@@ -139,7 +139,7 @@ type __volatile bool
|
||||
var rtc_wakeup __volatile
|
||||
|
||||
func rtc_sleep(ticks uint32) {
|
||||
nrf.RTC0.INTENSET = nrf.RTC0_INTENSET_COMPARE0_Msk
|
||||
nrf.RTC0.INTENSET = nrf.RTC_INTENSET_COMPARE0_Msk
|
||||
rtc_wakeup = false
|
||||
if ticks == 1 {
|
||||
// Race condition (even in hardware) at ticks == 1.
|
||||
@@ -155,7 +155,7 @@ func rtc_sleep(ticks uint32) {
|
||||
|
||||
//go:export RTC0_IRQHandler
|
||||
func handleRTC0() {
|
||||
nrf.RTC0.INTENCLR = nrf.RTC0_INTENSET_COMPARE0_Msk
|
||||
nrf.RTC0.INTENCLR = nrf.RTC_INTENSET_COMPARE0_Msk
|
||||
nrf.RTC0.EVENTS_COMPARE[0] = 0
|
||||
rtc_wakeup = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user