mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 23:43:40 +00:00
machine/nrf: SPI master implementation
Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
committed by
Ayke van Laethem
parent
23b283366d
commit
06ab3a836f
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user