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

state probleme ( invalid state error 8)

i want to sinchronyze diferent peripheral and 1 central thank's to the gpiote's state. 

but i have a error 8 invalid state whereas i  had initialize 

help me please !!! 

this is my code :

static app_gpiote_user_id_t m_example_user_id;

static void example_gpiote_event_handler(uint32_t event_pins_low_to_high, uint32_t event_pin_high_to_low);


static void gpiote(void){

nrf_gpio_cfg_output(3);
nrf_drv_gpiote_in_uninit(3);
nrf_drv_gpiote_init();
bool val = nrf_drv_gpiote_is_init();

if(val == false){
NRF_LOG_INFO("initialisation = false");
}
else{
NRF_LOG_INFO("initialisation = true");
}

uint32_t low_to_high_bitmask = 0x0000000F; // Bitmask to be notified of transition from low to high for GPIO 0-3
uint32_t high_to_low_bitmask = 0x0000000E; // Bitmask to be notified of transition from high to low for GPIO 0-2
uint32_t retval ;


retval= app_gpiote_user_register(&m_example_user_id, &low_to_high_bitmask ,&high_to_low_bitmask,(app_gpiote_event_handler_t)example_gpiote_event_handler);

if(retval != NRF_SUCCESS){
NRF_LOG_INFO("echoue err_code=%d",retval);
}
else{
NRF_LOG_INFO("succes");

}

}

void example_gpiote_event_handler(uint32_t event_pins_low_to_high, uint32_t event_pin_high_to_low){
if(event_pins_low_to_high & 0x0000000F){

NRF_LOG_INFO("succes");

}
if(event_pin_high_to_low & 0x0000000F){

NRF_LOG_INFO("succes");

}

}

void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
NRF_LOG_INFO("anythings ");
}

int main(void)
{
bool erase_bonds;


// Initialize.
init_param_central();
log_init();
timers_init();
gpiote();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
advertising_init();
services_init();
conn_params_init();
peer_manager_init();
//test();

// Start execution.
NRF_LOG_INFO("Cidelec ble server test started.");
conn_evt_len_ext_set();
application_timers_start();
advertising_start(erase_bonds);

// Enter main loop.
for (;;)
{
idle_state_handle();
}
}

thanks .

Related