diff options
| author | Sean Cross <sean@xobs.io> | 2020-04-19 13:53:51 +0800 |
|---|---|---|
| committer | Sean Cross <sean@xobs.io> | 2020-04-21 10:44:20 +0800 |
| commit | 066f486b28c38c71f89cbba44e31857125ff243e (patch) | |
| tree | fa48ef9dba9d05df8dd0658dcfd85a4f2ea71d48 | |
| parent | ac9d336f40634419617d13464e87ab6917f9152a (diff) | |
nrf: supervisor: support building without BUSIO
Only initialize i2c, spi, and uart if building with BUSIO.
Signed-off-by: Sean Cross <sean@xobs.io>
| -rw-r--r-- | ports/nrf/nrfx_config.h | 15 | ||||
| -rw-r--r-- | ports/nrf/supervisor/port.c | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/ports/nrf/nrfx_config.h b/ports/nrf/nrfx_config.h index e37c60934..a13ddf018 100644 --- a/ports/nrf/nrfx_config.h +++ b/ports/nrf/nrfx_config.h @@ -31,8 +31,8 @@ #define CIRCUITPY_NRF_NUM_I2C 2 #endif -#if CIRCUITPY_NRF_NUM_I2C != 1 && CIRCUITPY_NRF_NUM_I2C != 2 -# error CIRCUITPY_NRF_NUM_I2C must be 1 or 2 +#if CIRCUITPY_NRF_NUM_I2C != 0 && CIRCUITPY_NRF_NUM_I2C != 1 && CIRCUITPY_NRF_NUM_I2C != 2 +# error CIRCUITPY_NRF_NUM_I2C must be 0, 1, or 2 #endif // Enable SPIM1, SPIM2 and SPIM3 (if available) @@ -44,7 +44,7 @@ #ifdef NRF52840_XXAA #define NRFX_SPIM_EXTENDED_ENABLED 1 #define NRFX_SPIM3_ENABLED 1 -#else +#elif CIRCUITPY_NRF_NUM_I2C == 2 #define NRFX_SPIM3_ENABLED 0 #endif @@ -56,17 +56,18 @@ #define NRFX_QSPI_ENABLED 1 // TWI aka. I2C; always enable TWIM0 (no conflict with SPIM1 and SPIM2) +#if CIRCUITPY_NRF_NUM_I2C == 1 || CIRCUITPY_NRF_NUM_I2C == 2 #define NRFX_TWIM_ENABLED 1 #define NRFX_TWIM0_ENABLED 1 +#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 7 +#define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY NRF_TWIM_FREQ_400K +#define NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0 +#endif #if CIRCUITPY_NRF_NUM_I2C == 2 #define NRFX_TWIM1_ENABLED 1 #endif -#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 7 -#define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY NRF_TWIM_FREQ_400K -#define NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0 - // UART #define NRFX_UARTE_ENABLED 1 #define NRFX_UARTE0_ENABLED 1 diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 1b92e7832..3f16e090f 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -101,9 +101,11 @@ void reset_port(void) { gamepad_reset(); #endif +#if CIRCUITPY_BUSIO i2c_reset(); spi_reset(); uart_reset(); +#endif #if CIRCUITPY_NEOPIXEL_WRITE neopixel_write_reset(); |
