Start stop button ?

Dear Members,

How can I make a start/stop button with 1 button ?

Here's my handler :

void bsp_event_handler(bsp_event_t event)
{
    switch (event)
    {
        case BSP_EVENT_SLEEP:
            nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
            break;
				
				 case BSP_EVENT_KEY_0:
					 NRF_LOG_INFO("BSP_EVENT_KEY 0 PUSH ON\n");
            if (actual_state != BSP_INDICATE_FIRST)
                actual_state--;
						    //NRF_LOG_INFO("BSP_EVENT_KEY 0 PUSH ON\n"); //2Mar22 Rixtronix LAB
            else
                actual_state = BSP_INDICATE_LAST;
						    NRF_LOG_INFO("BSP_EVENT_KEY 0 PUSH OFF\n"); //2Mar22 Rixtronix LAB
            break;
            ............

Any clues ?

Kind regards,

Rixtronix LAB

Parents Reply
  • RixtronixLAB said:
    Thanks for the reply,

    No problem at all, I am happy to help!

    RixtronixLAB said:
    That's correct, how can I fix a bouncing button ? a delay ?

    The bsp module has debouncing already has this since its using the app_button module, which has a detection delay implemented.
    This is currently 50 ms, you could extend this to see if it resolves your issue, but usually 50 ms is enough for a regular pushbutton.

    Best regards,
    Karl

Children
No Data
Related