Hi, I'm working with the nRF51822 I'm trying to enable the use of some timer callback on the ble_app_template. I've succefully created and started all the timers, but i've no callback response. I suppose I'm making some mistakes in timer initialization procedure.
#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */
#define APP_TIMER_MAX_TIMERS (2 + BSP_APP_TIMERS_NUMBER) /**< Maximum number of simultaneously created timers. */
#define APP_TIMER_OP_QUEUE_SIZE 4 /**< Size of timer operation queues. */
static app_timer_id_t m_app_timer_id;
static app_timer_id_t m_battery_timer_id;
#define TIMER_INTERVAL APP_TIMER_TICKS(1000, APP_TIMER_PRESCALER) /**< LED Softblink PWM period in app_timer ticks. */
static void timers_init(void)
{
uint32_t err_code;
// Initialize timer module, making it use the scheduler
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
/* YOUR_JOB: Create any timers to be used by the application.
Below is an example of how to create a timer.
For every new timer needed, increase the value of the macro APP_TIMER_MAX_TIMERS by
one.
*/
err_code = app_timer_create(&m_app_timer_id, APP_TIMER_MODE_REPEATED, timer_timeout_handler);
APP_ERROR_CHECK(err_code);
err_code = app_timer_create(&m_battery_timer_id, APP_TIMER_MODE_REPEATED, battery_level_meas_timeout_handler);
APP_ERROR_CHECK(err_code);
}
static void timers_start(void)
{
/*YOUR_JOB: Start your timers. below is an example of how to start a timer. */
uint32_t err_code;
err_code = app_timer_start(m_app_timer_id, TIMER_INTERVAL, NULL);
APP_ERROR_CHECK(err_code);
err_code = app_timer_start(m_battery_timer_id, TIMER_INTERVAL, NULL);
APP_ERROR_CHECK(err_code);
}
int main(void)
{
// Initialize
timers_init();
// Start execution
timers_start();
for(;;)
{
power_manage();
}
}
I report only the code related to the timer initialization and run. If I put a breakpoint in timer_timeout_handler() i never get the PC to stop on it.
BR.