Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use timer #332

Open
Inchul-Lee opened this issue Jul 5, 2022 · 1 comment
Open

How to use timer #332

Inchul-Lee opened this issue Jul 5, 2022 · 1 comment

Comments

@Inchul-Lee
Copy link

I am merging IAR source cdoe to LK. In the IAR it is possible to use SysTick_Handler(void). But I have conformed that _systick(void) is used by LK kernel. I need to use systick or timer for system. I fount out that LK has the timer function like as platform_set_oneshot_timer() or platform_set_periodic_timer. How can I use it? Please give me the example or information.

@cleverca22
Copy link
Contributor

https://github.com/librerpi/lk-overlay/blob/master/platform/bcm28xx/temp/temp.c#L98-L116

static enum handler_return poller_entry(struct timer *t, lk_time_t now, void *arg) {
...
  return INT_NO_RESCHEDULE;
}

static void temp_init(const struct app_descriptor *app) {
  timer_initialize(&poller);
  timer_set_periodic(&poller, 1000, poller_entry, NULL);
}

APP_START(temp)
  .init = temp_init,
APP_END

this code creates a timer that will run the set function every second

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants