Keyboard firmwares for Atmel AVR and Cortex-M
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

timer.c 449B

123456789101112131415161718192021222324252627
  1. #include "ch.h"
  2. #include "timer.h"
  3. void timer_init(void) {}
  4. void timer_clear(void) {}
  5. uint16_t timer_read(void)
  6. {
  7. return (uint16_t)ST2MS(chVTGetSystemTime());
  8. }
  9. uint32_t timer_read32(void)
  10. {
  11. return ST2MS(chVTGetSystemTime());
  12. }
  13. uint16_t timer_elapsed(uint16_t last)
  14. {
  15. return (uint16_t)(ST2MS(chVTTimeElapsedSinceX(MS2ST(last))));
  16. }
  17. uint32_t timer_elapsed32(uint32_t last)
  18. {
  19. return ST2MS(chVTTimeElapsedSinceX(MS2ST(last)));
  20. }