nrf: supervisor: support building without BUSIO

Only initialize i2c, spi, and uart if building with BUSIO.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-04-19 13:53:51 +08:00
parent ac9d336f40
commit 066f486b28
2 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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();