i'm trying to blink led using timer, but nothing blink. I dont see the error in my code
#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */
#define APP_TIMER_MAX_TIMERS 6 /**< Maximum number of simultaneously created timers. */
#define APP_TIMER_OP_QUEUE_SIZE 7 /**< Size of timer operation queues. */
#define SCHED_MAX_EVENT_DATA_SIZE sizeof(app_timer_event_t)
#define SCHED_QUEUE_SIZE 10
#define LED_BLINK_TIME APP_TIMER_TICKS(1000, APP_TIMER_PRESCALER)
void led_blink_timer_handler(void * p_context) {
// blink code here
}
static void scheduler_init(void)
{
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
}
static void timers_init(void)
{
uint32_t err_code;
APP_TIMER_APPSH_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, true);
err_code = app_timer_create(&m_led_blink_timer_id, APP_TIMER_MODE_REPEATED, led_blink_timer_handler);
APP_ERROR_CHECK(err_code);
}
static void timers_start(void)
{
uint32_t err_code;
err_code = app_timer_start(m_led_blink_timer_id, LED_BLINK_TIME, NULL);
APP_ERROR_CHECK(err_code);
}
/**@brief Function for application main entry.
*/
int main(void)
{
nrf_gpio_cfg_output(LED_GREEN);
timers_init();
nrf_gpio_pin_clear(LED_GREEN);
scheduler_init();
timers_start();
while (1>0) {
app_sched_execute();
}
return 0;