Naze32 clone with Frysky receiver
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

timer.cpp 533B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Time-Keeping helper
  3. */
  4. #pragma GCC diagnostic push
  5. #pragma GCC diagnostic ignored "-Wunused-parameter"
  6. #pragma GCC diagnostic ignored "-pedantic"
  7. #include "mbed.h"
  8. #pragma GCC diagnostic pop
  9. static Ticker t;
  10. static time_t systemTime = 0;
  11. static void timerISR(void) {
  12. systemTime += 100;
  13. }
  14. extern "C" {
  15. #include "timer.h"
  16. void delay_us(int x) {
  17. wait_us(x);
  18. }
  19. void delay_ms(int x) {
  20. wait_ms(x);
  21. }
  22. void timerInit(void) {
  23. t.attach_us(&timerISR, 100);
  24. }
  25. time_t timerGet(void) {
  26. return systemTime;
  27. }
  28. }