diff options
| -rw-r--r-- | ports/rp2/machine_i2s.c | 9 | ||||
| -rw-r--r-- | ports/rp2/main.c | 1 | ||||
| -rw-r--r-- | ports/rp2/modmachine.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/ports/rp2/machine_i2s.c b/ports/rp2/machine_i2s.c index 47eb5350a..b17d38336 100644 --- a/ports/rp2/machine_i2s.c +++ b/ports/rp2/machine_i2s.c @@ -171,6 +171,15 @@ void machine_i2s_init0(void) { } } +void machine_i2s_deinit_all(void) { + for (uint8_t i = 0; i < MAX_I2S_RP2; i++) { + machine_i2s_obj_t *i2s = MP_STATE_PORT(machine_i2s_obj[i]); + if (i2s) { + mp_machine_i2s_deinit(i2s); + } + } +} + static int8_t get_frame_mapping_index(int8_t bits, format_t format) { if (format == MONO) { if (bits == 16) { diff --git a/ports/rp2/main.c b/ports/rp2/main.c index 3b4d351a7..0f2721f17 100644 --- a/ports/rp2/main.c +++ b/ports/rp2/main.c @@ -214,6 +214,7 @@ int main(int argc, char **argv) { #if MICROPY_PY_NETWORK mod_network_deinit(); #endif + machine_i2s_deinit_all(); rp2_dma_deinit(); rp2_pio_deinit(); #if MICROPY_PY_BLUETOOTH diff --git a/ports/rp2/modmachine.h b/ports/rp2/modmachine.h index 3d0c726cd..e17ad67b0 100644 --- a/ports/rp2/modmachine.h +++ b/ports/rp2/modmachine.h @@ -6,6 +6,7 @@ void machine_pin_init(void); void machine_pin_deinit(void); void machine_i2s_init0(void); +void machine_i2s_deinit_all(void); void machine_pwm_deinit_all(void); struct _machine_spi_obj_t *spi_from_mp_obj(mp_obj_t o); |
