Skip to content

Commit bedaea9

Browse files
esp32: Fix.
1 parent 6e4ec39 commit bedaea9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ports/esp32/machine_touchpad.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,24 +186,22 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
186186
}
187187
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
188188
}
189-
189+
#if SOC_TOUCH_SENSOR_VERSION == 1 || SOC_TOUCH_SENSOR_VERSION == 2
190190
static mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
191191
mtp_obj_t *self = self_in;
192192
#if SOC_TOUCH_SENSOR_VERSION == 1
193193
uint16_t value = mp_obj_get_int(value_in);
194194
esp_err_t err = touch_pad_config(self->touchpad_id, value);
195195
#elif SOC_TOUCH_SENSOR_VERSION == 2
196196
esp_err_t err = touch_pad_config(self->touchpad_id);
197-
#elif SOC_TOUCH_SENSOR_VERSION == 3
198-
esp_err_t err = ESP_OK;
199197
#endif
200198
if (err == ESP_OK) {
201199
return mp_const_none;
202200
}
203201
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
204202
}
205203
MP_DEFINE_CONST_FUN_OBJ_2(mtp_config_obj, mtp_config);
206-
204+
#endif
207205
static mp_obj_t mtp_read(mp_obj_t self_in) {
208206
mtp_obj_t *self = self_in;
209207
#if SOC_TOUCH_SENSOR_VERSION == 1
@@ -226,7 +224,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(mtp_read_obj, mtp_read);
226224

227225
static const mp_rom_map_elem_t mtp_locals_dict_table[] = {
228226
// instance methods
227+
#if SOC_TOUCH_SENSOR_VERSION == 1 || SOC_TOUCH_SENSOR_VERSION == 2
229228
{ MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&mtp_config_obj) },
229+
#endif
230230
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mtp_read_obj) },
231231
};
232232

0 commit comments

Comments
 (0)