hello there i want to generate external interrupt from adxl345.can you help me? can we do same like we are using with button??
hello there i want to generate external interrupt from adxl345.can you help me? can we do same like we are using with button??
...
static void button_event_handler(uint8_t pin_no, uint8_t button_action)
{
uint32_t err_code;
switch (pin_no)
{
case LEDBUTTON_BUTTON_PIN:
err_code = ble_lbs_on_button_change(&m_lbs, button_action);
if (err_code != NRF_SUCCESS &&
err_code != BLE_ERROR_INVALID_CONN_HANDLE &&
err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
break;
default:
APP_ERROR_HANDLER(pin_no);
break;
}
}
/**@brief Function for initializing the button handler module.
*/
static void buttons_init(void)
{
uint32_t err_code;
//The array must be static because a pointer to it will be saved in the button handler module.
static app_button_cfg_t buttons[] =
{
{LEDBUTTON_BUTTON_PIN, false, BUTTON_PULL, button_event_handler}
};
err_code = app_button_init(buttons, sizeof(buttons) / sizeof(buttons[0]),
BUTTON_DETECTION_DELAY);
APP_ERROR_CHECK(err_code);
}
...
static void button_event_handler(uint8_t pin_no, uint8_t button_action)
{
uint32_t err_code;
switch (pin_no)
{
case LEDBUTTON_BUTTON_PIN:
err_code = ble_lbs_on_button_change(&m_lbs, button_action);
if (err_code != NRF_SUCCESS &&
err_code != BLE_ERROR_INVALID_CONN_HANDLE &&
err_code != NRF_ERROR_INVALID_STATE)
{
APP_ERROR_CHECK(err_code);
}
break;
default:
APP_ERROR_HANDLER(pin_no);
break;
}
}
/**@brief Function for initializing the button handler module.
*/
static void buttons_init(void)
{
uint32_t err_code;
//The array must be static because a pointer to it will be saved in the button handler module.
static app_button_cfg_t buttons[] =
{
{LEDBUTTON_BUTTON_PIN, false, BUTTON_PULL, button_event_handler}
};
err_code = app_button_init(buttons, sizeof(buttons) / sizeof(buttons[0]),
BUTTON_DETECTION_DELAY);
APP_ERROR_CHECK(err_code);
}