This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to add an own timer to the multilink_peripheral_example ?

Hello,

I would like to move on from using nrf_delay_ms().

I thought this would give me some first results, but It don't. Whats wrong?

//a
    static void test_timer_handler(void * p_context)
    {
        UNUSED_PARAMETER(p_context);
    		printf("Hallo");
    }
    static app_timer_id_t   m_test_timer_id;
    void test_timer_create_and_start(void) {
    app_timer_create(&m_test_timer_id, APP_TIMER_MODE_REPEATED, test_timer_handler);
    app_timer_start(m_test_timer_id, 100, NULL);	
    }
//b


int main(void)
{   uint32_t err_code;

    ble_stack_init();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL);
    APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), button_event_handler);
    APP_ERROR_CHECK(err_code);

	//a Timer
		test_timer_create_and_start();	
	//b 

My bad. I was a little dizzy and forgot to increase the Max_timer define.. It was in fact that easy to get a timer running.

Related