I want to add timer to send sensor movement data to PC every 8ms(125HZ).
But when I add app_timer like normal
1.raise APP_TIMER_MAX_TIMERS 2.raise APP_TIMER_OP_QUEUE_SIZE 3. add handler
static void sensor_movement_handler(void * p_context)
{
UNUSED_PARAMETER(p_context);
mouse_sensor_send();
}
- create timer in timer_init()
err_code = app_timer_create(&m_sensor_timer_id,
APP_TIMER_MODE_REPEATED,
sensor_movement_handler);
APP_ERROR_CHECK(err_code);
5.start timer
err_code = app_timer_start(m_sensor_timer_id, SENSOR_MOVE_SEND_TICKS, NULL);
APP_ERROR_CHECK(err_code);
======= I add timer like this before in the same program,but failed this one It will goes into app_error_handler() ,and reboot auto.
So I want to known that,is there limit in APP_TIMER_INIT ?
#define APP_TIMER_PRESCALER 0 /< Value of the RTC1 PRESCALER register. */ #define APP_TIMER_MAX_TIMERS 6 //5 /< Maximum number of simultaneously created timers. */ #define APP_TIMER_OP_QUEUE_SIZE 5 //4
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, true);
And it shows that error comes from "app_timer.c" m_evt_schedule_func, and error_code is "4"
static void timeout_handler_exec(timer_node_t * p_timer)
{
if (m_evt_schedule_func != NULL)
{
uint32_t err_code = m_evt_schedule_func(p_timer->p_timeout_handler, p_timer->p_context);
APP_ERROR_CHECK(err_code);
}
else
{
p_timer->p_timeout_handler(p_timer->p_context);
}
}