diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-01-30 13:23:00 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2018-01-30 13:23:00 -0500 |
| commit | 64831f4e7d9122fe7d70596cf99541cfd60359a8 (patch) | |
| tree | d6044582b5d70c11563f30b76f74878cd9039714 | |
| parent | e550b024c5d3d6d5a7e739ae9dd2175756591f6e (diff) | |
add SPI.frequency to nRF
| -rw-r--r-- | ports/nrf/common-hal/busio/SPI.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ports/nrf/common-hal/busio/SPI.c b/ports/nrf/common-hal/busio/SPI.c index 4bb448a0c..32ebbf53a 100644 --- a/ports/nrf/common-hal/busio/SPI.c +++ b/ports/nrf/common-hal/busio/SPI.c @@ -184,3 +184,23 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint8_t *data_out, uin return true; } +uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t* self) { + switch (self->spi->FREQUENCY) { + case SPI_FREQUENCY_FREQUENCY_K125: + return 125000; + case SPI_FREQUENCY_FREQUENCY_K250: + return 250000; + case SPI_FREQUENCY_FREQUENCY_K500: + return 500000; + case SPI_FREQUENCY_FREQUENCY_M1: + return 1000000; + case SPI_FREQUENCY_FREQUENCY_M2: + return 2000000; + case SPI_FREQUENCY_FREQUENCY_M4: + return 4000000; + case SPI_FREQUENCY_FREQUENCY_M8: + return 8000000; + default: + return 0; + } +} |
