Skip to content

Commit 5c202bd

Browse files
committed
feat(src/machine/nrf52xxx/spi): re-use case instead of dedicated
Signed-off-by: Paul Schroeder <milkpirate@users.noreply.github.com>
1 parent 34bb9e8 commit 5c202bd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/machine/machine_nrf52xxx.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,11 @@ func (spi *SPI) Configure(config SPIConfig) error {
235235
// Disable bus to configure it
236236
spi.Bus.ENABLE.Set(nrf.SPIM_ENABLE_ENABLE_Disabled)
237237

238-
// Pick a default frequency.
239-
if config.Frequency == 0 {
240-
config.Frequency = 4000000 // 4MHz
241-
}
242-
243238
// set frequency
244239
var freq uint32
245240
switch {
241+
case config.Frequency == 0: // default MCU SPI speed
242+
freq = nrf.SPIM_FREQUENCY_FREQUENCY_M4
246243
case config.Frequency >= 8000000:
247244
freq = nrf.SPIM_FREQUENCY_FREQUENCY_M8
248245
case config.Frequency >= 4000000:

0 commit comments

Comments
 (0)