machine/nrf: refactor to use volatile package/API

Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
Ron Evans
2019-05-20 10:42:50 +02:00
committed by Ayke
parent 0f6873cf02
commit 9f8340a970
6 changed files with 151 additions and 151 deletions
+7 -7
View File
@@ -14,8 +14,8 @@ func (p GPIO) getPortPin() (*nrf.GPIO_Type, uint8) {
}
func (uart UART) setPins(tx, rx uint32) {
nrf.UART0.PSELTXD = nrf.RegValue(tx)
nrf.UART0.PSELRXD = nrf.RegValue(rx)
nrf.UART0.PSELTXD.Set(tx)
nrf.UART0.PSELRXD.Set(rx)
}
//go:export UART0_IRQHandler
@@ -24,8 +24,8 @@ func handleUART0() {
}
func (i2c I2C) setPins(scl, sda uint8) {
i2c.Bus.PSELSCL = nrf.RegValue(scl)
i2c.Bus.PSELSDA = nrf.RegValue(sda)
i2c.Bus.PSELSCL.Set(uint32(scl))
i2c.Bus.PSELSDA.Set(uint32(sda))
}
// SPI
@@ -39,7 +39,7 @@ func (spi SPI) setPins(sck, mosi, miso uint8) {
if miso == 0 {
miso = SPI0_MISO_PIN
}
spi.Bus.PSELSCK = nrf.RegValue(sck)
spi.Bus.PSELMOSI = nrf.RegValue(mosi)
spi.Bus.PSELMISO = nrf.RegValue(miso)
spi.Bus.PSELSCK.Set(uint32(sck))
spi.Bus.PSELMOSI.Set(uint32(mosi))
spi.Bus.PSELMISO.Set(uint32(miso))
}