diff options
author | Ayke van Laethem <[email protected]> | 2019-04-28 18:49:17 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-05-26 20:48:50 +0200 |
commit | 94b8214529f1cebad2cc45b5c1820695a7dd8201 (patch) | |
tree | 62ea7f3171ba0a3f106998e2ddc8ed1c7e799f59 /src/machine/machine_nrf52.go | |
parent | 421ef04efb87889d73d5b404202a655f41d2e1e4 (diff) | |
download | tinygo-94b8214529f1cebad2cc45b5c1820695a7dd8201.tar.gz tinygo-94b8214529f1cebad2cc45b5c1820695a7dd8201.zip |
machine: refactor pins to be of Pin type
Diffstat (limited to 'src/machine/machine_nrf52.go')
-rw-r--r-- | src/machine/machine_nrf52.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/machine/machine_nrf52.go b/src/machine/machine_nrf52.go index 5ad1b59f6..b661aecf6 100644 --- a/src/machine/machine_nrf52.go +++ b/src/machine/machine_nrf52.go @@ -10,13 +10,13 @@ import ( const CPU_FREQUENCY = 64000000 // Get peripheral and pin number for this GPIO pin. -func (p GPIO) getPortPin() (*nrf.GPIO_Type, uint8) { - return nrf.P0, p.Pin +func (p Pin) getPortPin() (*nrf.GPIO_Type, uint32) { + return nrf.P0, uint32(p) } -func (uart UART) setPins(tx, rx uint32) { - nrf.UART0.PSELTXD.Set(tx) - nrf.UART0.PSELRXD.Set(rx) +func (uart UART) setPins(tx, rx Pin) { + nrf.UART0.PSELTXD.Set(uint32(tx)) + nrf.UART0.PSELRXD.Set(uint32(rx)) } //go:export UARTE0_UART0_IRQHandler @@ -24,13 +24,13 @@ func handleUART0() { UART0.handleInterrupt() } -func (i2c I2C) setPins(scl, sda uint8) { +func (i2c I2C) setPins(scl, sda Pin) { i2c.Bus.PSELSCL.Set(uint32(scl)) i2c.Bus.PSELSDA.Set(uint32(sda)) } // SPI -func (spi SPI) setPins(sck, mosi, miso uint8) { +func (spi SPI) setPins(sck, mosi, miso Pin) { if sck == 0 { sck = SPI0_SCK_PIN } |