Skip to content

Commit a525493

Browse files
committed
esp8266: Switch from using custom I2C driver to generic extmod one.
1 parent ac63ca7 commit a525493

5 files changed

Lines changed: 7 additions & 325 deletions

File tree

esp8266/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ SRC_C = \
6767
modpybrtc.c \
6868
modpybadc.c \
6969
modpybuart.c \
70-
modpybi2c.c \
7170
modpybspi.c \
7271
modesp.c \
7372
modnetwork.c \

esp8266/esp_mphal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ void dupterm_task_init();
5656
void ets_event_poll(void);
5757
#define ETS_POLL_WHILE(cond) { while (cond) ets_event_poll(); }
5858

59+
// needed for machine.I2C
60+
#include "osapi.h"
61+
#define mp_hal_delay_us_fast(us) os_delay_us(us)
62+
5963
// C-level pin HAL
6064
#include "etshal.h"
6165
#include "gpio.h"

esp8266/modmachine.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "py/obj.h"
3131
#include "py/runtime.h"
3232
#include "extmod/machine_mem.h"
33+
#include "extmod/machine_i2c.h"
3334
#include "utils.h"
3435
#include "modpyb.h"
3536

@@ -159,7 +160,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
159160
{ MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_PTR(&pyb_pwm_type) },
160161
{ MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type) },
161162
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&pyb_uart_type) },
162-
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&pyb_i2c_type) },
163+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_i2c_type) },
163164
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&pyb_spi_type) },
164165
};
165166

esp8266/modpybi2c.c

Lines changed: 0 additions & 323 deletions
This file was deleted.

esp8266/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#define MICROPY_PY_UZLIB (1)
5151
#define MICROPY_PY_LWIP (1)
5252
#define MICROPY_PY_MACHINE (1)
53+
#define MICROPY_PY_MACHINE_I2C (1)
5354
#define MICROPY_PY_WEBSOCKET (1)
5455
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
5556
#define MICROPY_PY_OS_DUPTERM (1)

0 commit comments

Comments
 (0)