Skip to content

Commit

Permalink
esp32: Rename machine I2C and SPI types consistently across ports.
Browse files Browse the repository at this point in the history
This renames:
- machine_hw_i2c_type -> machine_i2c_type
- machine_hw_spi_type -> machine_spi_type
  • Loading branch information
iabdalkader authored and dpgeorge committed Oct 22, 2022
1 parent af4ba6d commit 427670c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ports/esp32/machine_hw_spi.c
Expand Up @@ -490,7 +490,7 @@ mp_obj_t machine_hw_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_
self = &machine_hw_spi_obj[1];
default_pins = &machine_hw_spi_default_pins[1];
}
self->base.type = &machine_hw_spi_type;
self->base.type = &machine_spi_type;

int8_t sck, mosi, miso;

Expand Down Expand Up @@ -540,7 +540,7 @@ STATIC const mp_machine_spi_p_t machine_hw_spi_p = {
};

MP_DEFINE_CONST_OBJ_TYPE(
machine_hw_spi_type,
machine_spi_type,
MP_QSTR_SPI,
MP_TYPE_FLAG_NONE,
make_new, machine_hw_spi_make_new,
Expand Down
4 changes: 2 additions & 2 deletions ports/esp32/machine_i2c.c
Expand Up @@ -161,7 +161,7 @@ mp_obj_t machine_hw_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_
bool first_init = false;
if (self->base.type == NULL) {
// Created for the first time, set default pins
self->base.type = &machine_hw_i2c_type;
self->base.type = &machine_i2c_type;
self->port = i2c_id;
if (self->port == I2C_NUM_0) {
self->scl = MICROPY_HW_I2C0_SCL;
Expand Down Expand Up @@ -193,7 +193,7 @@ STATIC const mp_machine_i2c_p_t machine_hw_i2c_p = {
};

MP_DEFINE_CONST_OBJ_TYPE(
machine_hw_i2c_type,
machine_i2c_type,
MP_QSTR_I2C,
MP_TYPE_FLAG_NONE,
make_new, machine_hw_i2c_make_new,
Expand Down
4 changes: 2 additions & 2 deletions ports/esp32/modmachine.c
Expand Up @@ -315,14 +315,14 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
#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_I2C), MP_ROM_PTR(&machine_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) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&machine_spi_type) },
{ MP_ROM_QSTR(MP_QSTR_SoftSPI), MP_ROM_PTR(&mp_machine_soft_spi_type) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&machine_uart_type) },

Expand Down
4 changes: 2 additions & 2 deletions ports/esp32/modmachine.h
Expand Up @@ -16,8 +16,8 @@ extern const mp_obj_type_t machine_touchpad_type;
extern const mp_obj_type_t machine_adc_type;
extern const mp_obj_type_t machine_adcblock_type;
extern const mp_obj_type_t machine_dac_type;
extern const mp_obj_type_t machine_hw_i2c_type;
extern const mp_obj_type_t machine_hw_spi_type;
extern const mp_obj_type_t machine_i2c_type;
extern const mp_obj_type_t machine_spi_type;
extern const mp_obj_type_t machine_i2s_type;
extern const mp_obj_type_t machine_uart_type;
extern const mp_obj_type_t machine_rtc_type;
Expand Down

0 comments on commit 427670c

Please sign in to comment.