esp32/machine_dac: Add MICROPY_PY_MACHINE_DAC option, enable by default.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-07-18 12:11:10 +10:00
parent d3f6ce7dc3
commit 1f9243f8d4
3 changed files with 12 additions and 5 deletions

View File

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

View File

@ -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) },

View File

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