machine/nrf: SPI master implementation

Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
Ron Evans
2018-11-30 21:34:28 +01:00
committed by Ayke van Laethem
parent 23b283366d
commit 06ab3a836f
12 changed files with 312 additions and 2 deletions
+16
View File
@@ -27,6 +27,22 @@ func (i2c I2C) setPins(scl, sda uint8) {
i2c.Bus.PSELSDA = nrf.RegValue(sda)
}
// SPI
func (spi SPI) setPins(sck, mosi, miso uint8) {
if sck == 0 {
sck = SPI0_SCK_PIN
}
if mosi == 0 {
mosi = SPI0_MOSI_PIN
}
if miso == 0 {
miso = SPI0_MISO_PIN
}
spi.Bus.PSEL.SCK = nrf.RegValue(sck)
spi.Bus.PSEL.MOSI = nrf.RegValue(mosi)
spi.Bus.PSEL.MISO = nrf.RegValue(miso)
}
// InitADC initializes the registers needed for ADC.
func InitADC() {
return // no specific setup on nrf52 machine.