Skip to content

Commit 066f486

Browse files
committed
nrf: supervisor: support building without BUSIO
Only initialize i2c, spi, and uart if building with BUSIO. Signed-off-by: Sean Cross <[email protected]>
1 parent ac9d336 commit 066f486

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ports/nrf/nrfx_config.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#define CIRCUITPY_NRF_NUM_I2C 2
3232
#endif
3333

34-
#if CIRCUITPY_NRF_NUM_I2C != 1 && CIRCUITPY_NRF_NUM_I2C != 2
35-
# error CIRCUITPY_NRF_NUM_I2C must be 1 or 2
34+
#if CIRCUITPY_NRF_NUM_I2C != 0 && CIRCUITPY_NRF_NUM_I2C != 1 && CIRCUITPY_NRF_NUM_I2C != 2
35+
# error CIRCUITPY_NRF_NUM_I2C must be 0, 1, or 2
3636
#endif
3737

3838
// Enable SPIM1, SPIM2 and SPIM3 (if available)
@@ -44,7 +44,7 @@
4444
#ifdef NRF52840_XXAA
4545
#define NRFX_SPIM_EXTENDED_ENABLED 1
4646
#define NRFX_SPIM3_ENABLED 1
47-
#else
47+
#elif CIRCUITPY_NRF_NUM_I2C == 2
4848
#define NRFX_SPIM3_ENABLED 0
4949
#endif
5050

@@ -56,17 +56,18 @@
5656
#define NRFX_QSPI_ENABLED 1
5757

5858
// TWI aka. I2C; always enable TWIM0 (no conflict with SPIM1 and SPIM2)
59+
#if CIRCUITPY_NRF_NUM_I2C == 1 || CIRCUITPY_NRF_NUM_I2C == 2
5960
#define NRFX_TWIM_ENABLED 1
6061
#define NRFX_TWIM0_ENABLED 1
62+
#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 7
63+
#define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY NRF_TWIM_FREQ_400K
64+
#define NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0
65+
#endif
6166

6267
#if CIRCUITPY_NRF_NUM_I2C == 2
6368
#define NRFX_TWIM1_ENABLED 1
6469
#endif
6570

66-
#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 7
67-
#define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY NRF_TWIM_FREQ_400K
68-
#define NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0
69-
7071
// UART
7172
#define NRFX_UARTE_ENABLED 1
7273
#define NRFX_UARTE0_ENABLED 1

ports/nrf/supervisor/port.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ void reset_port(void) {
101101
gamepad_reset();
102102
#endif
103103

104+
#if CIRCUITPY_BUSIO
104105
i2c_reset();
105106
spi_reset();
106107
uart_reset();
108+
#endif
107109

108110
#if CIRCUITPY_NEOPIXEL_WRITE
109111
neopixel_write_reset();

0 commit comments

Comments
 (0)