From 94b8214529f1cebad2cc45b5c1820695a7dd8201 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sun, 28 Apr 2019 18:49:17 +0200 Subject: machine: refactor pins to be of Pin type --- src/machine/machine_nrf52.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/machine/machine_nrf52.go') 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 } -- cgit v1.2.3