timekeeping.c 252 B

12345678910111213141516
  1. #include "mcc_generated_files/mcc.h"
  2. static uint16_t ms_counter;
  3. static void inc_ms_counter(void) {
  4. ms_counter++;
  5. }
  6. void init_timekeeping(void) {
  7. TMR0_SetInterruptHandler(inc_ms_counter);
  8. }
  9. uint16_t millis(void) {
  10. return ms_counter;
  11. }