Hello together,

I try to implement a simple timer on the board samr21-xpro. The board
support multiple timers [1].

Here is my code, but the timer is not running although I get a success
back on timer_init(...).


C-File:
=============================================================
#include <stdio.h>
#include "xtimer.h"
#include "timex.h"
#include "board.h"
#include "periph/timer.h"

void ISR_timer(void* arg, int argc){

        //Never called :(
        (void)arg;
        (void)argc;

        printf("ISR works...\n");
        printf("This should be print every 1Hz\n");
}

int main(void){

        int returnval = 0;
        xtimer_sleep(1);
        printf("Timer available: %d\n",TIMER_NUMOF);//Print how many
timers are available on samr21-xpro
        printf("Timer start ...\n");

        returnval = timer_init(1,1,&ISR_timer,NULL);//timer 1 with 1Hz
and ISR_timer as callback
        printf("returnval = %d\n",returnval);

        while(1);//do nothing
}
=============================================================

Makefile:
=============================================================
APPLICATION = timer
RIOTBASE ?= $(CURDIR)/../../RIOT
BOARD ?= samr21-xpro
QUIET ?= 1

# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
DEVELHELP ?= 1

FEATURES_REQUIRED += periph_timer

USEMODULE += xtimer

include $(RIOTBASE)/Makefile.include
=============================================================


[1]     https://riot-os.org/api/group__boards__samr21-xpro.html

Thanks for the help.


-- 
Best Regards

Oliver Koepp
_______________________________________________
users mailing list
[email protected]
https://lists.riot-os.org/mailman/listinfo/users

Reply via email to