Thanks in advanced. On sdk17.0.2 examples\ble_central\ble_app_uart_c, I connect a button's one end to nrf52832 pin 24, the other end is connected to VDD. So I have to #define BUTTON_PULL NRF_GPIO_PIN_PULLDOWN. After that, program can't detect the first button press action, and reverse the follow button action, i.e., after the first press undetected, I release button, program performs press action APP_BUTTON_PUSH. And when I press button, program performs release action APP_BUTTON_RELEASE. I update evt_handle() as below:
......
case BTN_PRESS_DETECTED:
if (value)
{
state_set(pin, BTN_PRESSED);
usr_event(pin, APP_BUTTON_RELEASE);
}
else
{
state_set(pin, BTN_PRESS_ARMED);
}
NRF_LOG_DEBUG("Pin %d detected->%s", pin, value ? "pressed" : "armed");
break;
......
case BTN_RELEASE_DETECTED:
if (value)
{
state_set(pin, BTN_PRESSED);
}
else
{
state_set(pin, BTN_IDLE);
usr_event(pin, APP_BUTTON_PUSH);
CRITICAL_REGION_ENTER();
m_pin_active &= ~(1ULL << pin);
CRITICAL_REGION_EXIT();
}
......
Action reversion is fixed(not sure), but the first button press is still can't be detected by program. Would anyone help me to adapt #define BUTTON_PULL NRF_GPIO_PIN_PULLDOWN?