Skip to content

Commit 13bcee2

Browse files
markshannondpgeorge
authored andcommitted
Use NO_PULL for touch pins. External 1MΩ is sufficient.
1 parent ba969d6 commit 13bcee2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

source/microbit/microbitbutton.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static bool debounced_high[8] = { true, true, true, true, true, true, true, true
4646
mp_obj_t microbit_button_is_pressed(mp_obj_t self_in) {
4747
microbit_button_obj_t *self = (microbit_button_obj_t*)self_in;
4848
/* Button is pressed if pin is low */
49-
return mp_obj_new_bool(!debounced_high[self->pin->number]);
49+
return mp_obj_new_bool(!debounced_high[self->pin->number&7]);
5050
}
5151
MP_DEFINE_CONST_FUN_OBJ_1(microbit_button_is_pressed_obj, microbit_button_is_pressed);
5252

source/microbit/microbitpin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ mp_obj_t microbit_pin_is_touched(mp_obj_t self_in) {
281281
qstr mode = microbit_obj_pin_get_mode(self);
282282
if (mode != MP_QSTR_touch && mode != MP_QSTR_button) {
283283
microbit_obj_pin_acquire(self, MP_QSTR_touch);
284-
nrf_gpio_cfg_input(self->name, NRF_GPIO_PIN_PULLUP);
284+
nrf_gpio_cfg_input(self->name, NRF_GPIO_PIN_NOPULL);
285285
}
286286
/* Pin is touched if it is low after debouncing */
287287
return mp_obj_new_bool(!microbit_pin_high_debounced(self));

0 commit comments

Comments
 (0)