Skip to content

Commit

Permalink
esp32/machine_i2c.c: Fix warnings when I2C is disabled.
Browse files Browse the repository at this point in the history
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
  • Loading branch information
IhorNehrutsa committed Feb 19, 2024
1 parent 1ef2944 commit 6f5c2ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions extmod/modmachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ extern const machine_mem_obj_t machine_mem32_obj;
// is provided by a port.
extern const mp_obj_type_t machine_adc_type;
extern const mp_obj_type_t machine_adc_block_type;
#if MICROPY_PY_MACHINE_I2C
extern const mp_obj_type_t machine_i2c_type;
#endif
extern const mp_obj_type_t machine_i2s_type;
extern const mp_obj_type_t machine_mem_type;
extern const mp_obj_type_t machine_pin_type;
Expand Down
4 changes: 4 additions & 0 deletions ports/esp32/machine_i2c.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "driver/i2c.h"
#include "hal/i2c_ll.h"

#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SOFTI2C

#ifndef MICROPY_HW_I2C0_SCL
#define MICROPY_HW_I2C0_SCL (GPIO_NUM_18)
#define MICROPY_HW_I2C0_SDA (GPIO_NUM_19)
Expand Down Expand Up @@ -210,3 +212,5 @@ MP_DEFINE_CONST_OBJ_TYPE(
protocol, &machine_hw_i2c_p,
locals_dict, &mp_machine_i2c_locals_dict
);

#endif

0 comments on commit 6f5c2ad

Please sign in to comment.