This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use two GPIO pin with button press handler even?

Hi , I want to use two GPIO oin with button press hadler even . when pin low will interrupt and into handle..

Below is the code for the single key.

int button_handler_configure(db_ble_t *p_db_ble)
{
    s_p_db_ble = p_db_ble;

    static app_button_cfg_t b_config = {
        BUTTON_PIN,            // pin_no;
        APP_BUTTON_ACTIVE_LOW, // active_state;
        NRF_GPIO_PIN_PULLUP,   // pull_cfg;
        button_press_handler   // button_handler;
    };

    return (app_timer_create(&m_button_timer_id, APP_TIMER_MODE_SINGLE_SHOT, button_timeout_handler) == NRF_SUCCESS)
        && (app_button_init(&b_config, 1, BUTTON_DELAY) == NRF_SUCCESS)
        && (app_button_enable() == NRF_SUCCESS);
}

static void button_press_handler(uint8_t pin_no, uint8_t button_action)
{
    if (button_action == APP_BUTTON_PUSH)
    {
        app_timer_start(m_button_timer_id, APP_TIMER_TICKS(3000), s_p_db_ble);
    }
    else
    {
    // APP_BUTTON_RELEASE
		app_timer_stop(m_button_timer_id);
		DispStr("Reset: 0",20,132,GREEN,BLACK);		
	}
}

Thanks.

Paul

Parents Reply Children
Related