Hi
I am trying to broacast advdata (1 second advertisement period) including battery level (0..100) and a counter
My doubt is related with ADC_IRQn fired period and power_manage waikeup. Here is the main function:
int main(void)
{
leds_init();
ble_stack_init(); //Advertisement of 1s
start_timer(); //NRF_TIMER2 for 1s. Blinks LED, increment count and writes counter and battery to advdata and calls sd_ble_gap_adv_data_set
battery_start(); //then in ADC_IRQHandler I save value in global var to be used by NRF_TIMER2 handler
advertising_init();
advertising_start();
while(1)
{
power_manage();
}
}
Well, I know that interrupt handlers must be as short ad possible (without heavy operations). So NRF_TIMER2 shuld just inc counter and nothing more. Then, after power_manage(), adbdata must be updated and sd_ble_gap_adv_data_set should be called. But apart from this, what happens to power_manage call? Is it waked up by ADC_IRQn event?
Imagine that I would like to broadcast advdata with 10 seconds period (max). If I use ADC_IRQn that means that power_manage is beeing constantly waked up by ADC_IRQn interrupt?
Is it possible to configure ADC_IRQn to fire with 10 seconds period also in order to be "compliant" with power_manage.
By default, what is the fire period for ADC_IRQn?
Should I use polling for battery reading instead and call it from 5 to five minutes, for instance? (because battery does not drops too quickly)
Thanks a lot
Alex