Skip to content

Commit

Permalink
esp32/machine_i2s: Add MICROPY_PY_MACHINE_I2S option, enable by default.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Jul 18, 2021
1 parent 1f9243f commit 0fc0cca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ports/esp32/machine_i2s.c
Expand Up @@ -38,6 +38,8 @@
#include "modmachine.h"
#include "mphalport.h"

#if MICROPY_PY_MACHINE_I2S

#include "driver/i2s.h"
#include "soc/i2s_reg.h"
#include "freertos/FreeRTOS.h"
Expand Down Expand Up @@ -807,3 +809,5 @@ const mp_obj_type_t machine_i2s_type = {
.make_new = machine_i2s_make_new,
.locals_dict = (mp_obj_dict_t *)&machine_i2s_locals_dict,
};

#endif // MICROPY_PY_MACHINE_I2S
2 changes: 2 additions & 0 deletions ports/esp32/main.c
Expand Up @@ -138,7 +138,9 @@ void mp_task(void *pvParameter) {

// initialise peripherals
machine_pins_init();
#if MICROPY_PY_MACHINE_I2S
machine_i2s_init0();
#endif

// run boot-up scripts
pyexec_frozen_module("_boot.py");
Expand Down
2 changes: 2 additions & 0 deletions ports/esp32/modmachine.c
Expand Up @@ -282,7 +282,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
#endif
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_hw_i2c_type) },
{ MP_ROM_QSTR(MP_QSTR_SoftI2C), MP_ROM_PTR(&mp_machine_soft_i2c_type) },
#if MICROPY_PY_MACHINE_I2S
{ MP_ROM_QSTR(MP_QSTR_I2S), MP_ROM_PTR(&machine_i2s_type) },
#endif
{ MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_PTR(&machine_pwm_type) },
{ MP_ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&machine_rtc_type) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&machine_hw_spi_type) },
Expand Down
3 changes: 3 additions & 0 deletions ports/esp32/mpconfigport.h
Expand Up @@ -156,6 +156,9 @@
#ifndef MICROPY_PY_MACHINE_DAC
#define MICROPY_PY_MACHINE_DAC (1)
#endif
#ifndef MICROPY_PY_MACHINE_I2S
#define MICROPY_PY_MACHINE_I2S (1)
#endif
#ifndef MICROPY_HW_ENABLE_SDCARD
#define MICROPY_HW_ENABLE_SDCARD (1)
#endif
Expand Down

0 comments on commit 0fc0cca

Please sign in to comment.