From 625609a7378ab6ee92855e031335cc1a915a99c8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 20 Jul 2019 12:41:20 +1000 Subject: [PATCH] esp8266/machine_adc: Rename pyb_adc_* to machine_adc_*. --- ports/esp8266/machine_adc.c | 34 +++++++++++++++++----------------- ports/esp8266/modmachine.c | 2 +- ports/esp8266/modmachine.h | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ports/esp8266/machine_adc.c b/ports/esp8266/machine_adc.c index b422f0f9ec..13fbd53056 100644 --- a/ports/esp8266/machine_adc.c +++ b/ports/esp8266/machine_adc.c @@ -30,17 +30,17 @@ #include "py/runtime.h" #include "user_interface.h" -const mp_obj_type_t pyb_adc_type; +const mp_obj_type_t machine_adc_type; -typedef struct _pyb_adc_obj_t { +typedef struct _machine_adc_obj_t { mp_obj_base_t base; bool isvdd; -} pyb_adc_obj_t; +} machine_adc_obj_t; -STATIC pyb_adc_obj_t pyb_adc_vdd3 = {{&pyb_adc_type}, true}; -STATIC pyb_adc_obj_t pyb_adc_adc = {{&pyb_adc_type}, false}; +STATIC machine_adc_obj_t machine_adc_vdd3 = {{&machine_adc_type}, true}; +STATIC machine_adc_obj_t machine_adc_adc = {{&machine_adc_type}, false}; -STATIC mp_obj_t pyb_adc_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, +STATIC mp_obj_t machine_adc_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); @@ -48,17 +48,17 @@ STATIC mp_obj_t pyb_adc_make_new(const mp_obj_type_t *type_in, size_t n_args, si switch (chn) { case 0: - return &pyb_adc_adc; + return &machine_adc_adc; case 1: - return &pyb_adc_vdd3; + return &machine_adc_vdd3; default: nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "not a valid ADC Channel: %d", chn)); } } -STATIC mp_obj_t pyb_adc_read(mp_obj_t self_in) { - pyb_adc_obj_t *adc = self_in; +STATIC mp_obj_t machine_adc_read(mp_obj_t self_in) { + machine_adc_obj_t *adc = self_in; if (adc->isvdd) { return mp_obj_new_int(system_get_vdd33()); @@ -66,16 +66,16 @@ STATIC mp_obj_t pyb_adc_read(mp_obj_t self_in) { return mp_obj_new_int(system_adc_read()); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_adc_read_obj, pyb_adc_read); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_obj, machine_adc_read); -STATIC const mp_rom_map_elem_t pyb_adc_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&pyb_adc_read_obj) } +STATIC const mp_rom_map_elem_t machine_adc_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&machine_adc_read_obj) } }; -STATIC MP_DEFINE_CONST_DICT(pyb_adc_locals_dict, pyb_adc_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table); -const mp_obj_type_t pyb_adc_type = { +const mp_obj_type_t machine_adc_type = { { &mp_type_type }, .name = MP_QSTR_ADC, - .make_new = pyb_adc_make_new, - .locals_dict = (mp_obj_dict_t*)&pyb_adc_locals_dict, + .make_new = machine_adc_make_new, + .locals_dict = (mp_obj_dict_t*)&machine_adc_locals_dict, }; diff --git a/ports/esp8266/modmachine.c b/ports/esp8266/modmachine.c index e20e8cb757..35d4918bd3 100644 --- a/ports/esp8266/modmachine.c +++ b/ports/esp8266/modmachine.c @@ -410,7 +410,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pyb_pin_type) }, { MP_ROM_QSTR(MP_QSTR_Signal), MP_ROM_PTR(&machine_signal_type) }, { MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_PTR(&pyb_pwm_type) }, - { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type) }, + { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&machine_adc_type) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&pyb_uart_type) }, #if MICROPY_PY_MACHINE_I2C { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_i2c_type) }, diff --git a/ports/esp8266/modmachine.h b/ports/esp8266/modmachine.h index eae351f68d..cea382d24b 100644 --- a/ports/esp8266/modmachine.h +++ b/ports/esp8266/modmachine.h @@ -5,7 +5,7 @@ extern const mp_obj_type_t pyb_pin_type; extern const mp_obj_type_t pyb_pwm_type; -extern const mp_obj_type_t pyb_adc_type; +extern const mp_obj_type_t machine_adc_type; extern const mp_obj_type_t pyb_rtc_type; extern const mp_obj_type_t pyb_uart_type; extern const mp_obj_type_t pyb_i2c_type;