Hi,
to initialize the button properly
to trigger the push event on button push and the release event on button release, do I just have to change the button active state, if not how can i control it !?
/**@brief Button configuration structure. */
typedef struct
{
uint8_t pin_no; /**< Pin to be used as a button. */
uint8_t active_state; /**< APP_BUTTON_ACTIVE_HIGH or APP_BUTTON_ACTIVE_LOW. */
#if defined(BUTTON_HIGH_ACCURACY_ENABLED) && (BUTTON_HIGH_ACCURACY_ENABLED == 1)
bool hi_accuracy; /**< True if GPIOTE high accuracy (IN_EVENT) is used. */
#endif
nrf_gpio_pin_pull_t pull_cfg; /**< Pull-up or -down configuration. */
app_button_handler_t button_handler; /**< Handler to be called when button is pushed. */
} app_button_cfg_t;
when the button push switch the analog input from 0 to 1 have to be initialized as follows :
#ifdef BSP_BUTTON_0
{BSP_BUTTON_0, true, BUTTON_PULL, bsp_button_event_handler},
#endif // BUTTON_0
and when the button push switch the analog input from 1 to 0 have to be initialized as follows :
#ifdef BSP_BUTTON_0
{BSP_BUTTON_0, false, BUTTON_PULL, bsp_button_event_handler},
#endif // BUTTON_0