setup-loop.cpp 895 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "all-headers.h"
  2. static volatile uint32_t gCount1 = 0 ;
  3. static volatile uint32_t gCount2 = 0 ;
  4. static volatile uint32_t gCount3 = 0 ;
  5. static volatile uint32_t gCount4 = 0 ;
  6. static volatile bool gPerformCount = true ;
  7. static void rtISR (SECTION_MODE_ const uint32_t inUptime) {
  8. if (gPerformCount) {
  9. gCount1 += 1 ;
  10. gCount2 += 1 ;
  11. gCount3 += 1 ;
  12. gCount4 += 1 ;
  13. }
  14. }
  15. MACRO_REAL_TIME_ISR (rtISR) ;
  16. void setup (USER_MODE) {
  17. }
  18. void loop (USER_MODE) {
  19. if (gPerformCount) {
  20. gCount1 += 1 ;
  21. gCount2 += 1 ;
  22. gCount3 += 1 ;
  23. gCount4 += 1 ;
  24. if (5000 <= millis (MODE)) {
  25. gPerformCount = false ;
  26. gotoLineColumn (MODE_ 0, 0) ;
  27. printUnsigned (MODE_ gCount1) ;
  28. gotoLineColumn (MODE_ 1, 0) ;
  29. printUnsigned (MODE_ gCount2) ;
  30. gotoLineColumn (MODE_ 2, 0) ;
  31. printUnsigned (MODE_ gCount3) ;
  32. gotoLineColumn (MODE_ 3, 0) ;
  33. printUnsigned (MODE_ gCount4) ;
  34. }
  35. }
  36. }