diff options
| -rw-r--r-- | ports/esp32/machine_dac.c | 12 | ||||
| -rw-r--r-- | ports/esp32/modmachine.c | 2 | ||||
| -rw-r--r-- | ports/esp32/mpconfigport.h | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/ports/esp32/machine_dac.c b/ports/esp32/machine_dac.c index 146ef60aa..35826d4a9 100644 --- a/ports/esp32/machine_dac.c +++ b/ports/esp32/machine_dac.c @@ -27,15 +27,15 @@ #include <stdio.h> -#include "esp_log.h" - -#include "driver/gpio.h" -#include "driver/dac.h" - #include "py/runtime.h" #include "py/mphal.h" #include "modmachine.h" +#if MICROPY_PY_MACHINE_DAC + +#include "driver/gpio.h" +#include "driver/dac.h" + typedef struct _mdac_obj_t { mp_obj_base_t base; gpio_num_t gpio_id; @@ -111,3 +111,5 @@ const mp_obj_type_t machine_dac_type = { .make_new = mdac_make_new, .locals_dict = (mp_obj_t)&mdac_locals_dict, }; + +#endif // MICROPY_PY_MACHINE_DAC diff --git a/ports/esp32/modmachine.c b/ports/esp32/modmachine.c index a4e0724ce..5a7658dbb 100644 --- a/ports/esp32/modmachine.c +++ b/ports/esp32/modmachine.c @@ -277,7 +277,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TouchPad), MP_ROM_PTR(&machine_touchpad_type) }, #endif { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&machine_adc_type) }, + #if MICROPY_PY_MACHINE_DAC { MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&machine_dac_type) }, + #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) }, { MP_ROM_QSTR(MP_QSTR_I2S), MP_ROM_PTR(&machine_i2s_type) }, diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index a06c91047..aadf4620d 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -153,6 +153,9 @@ #define MICROPY_PY_MACHINE_SPI (1) #define MICROPY_PY_MACHINE_SPI_MSB (0) #define MICROPY_PY_MACHINE_SPI_LSB (1) +#ifndef MICROPY_PY_MACHINE_DAC +#define MICROPY_PY_MACHINE_DAC (1) +#endif #ifndef MICROPY_HW_ENABLE_SDCARD #define MICROPY_HW_ENABLE_SDCARD (1) #endif |
