setup-loop.cpp 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 section_incrementations(SECTION_MODE) {
  17. gCount1 += 1 ;
  18. gCount2 += 1 ;
  19. gCount3 += 1 ;
  20. gCount4 += 1 ;
  21. }
  22. void setup (USER_MODE) {
  23. }
  24. void loop (USER_MODE) {
  25. if (gPerformCount) {
  26. incrementations(MODE);
  27. if (5000000 <= micros (MODE)) {
  28. gPerformCount = false ;
  29. gotoLineColumn (MODE_ 0, 0) ;
  30. printUnsigned (MODE_ gCount1) ;
  31. gotoLineColumn (MODE_ 1, 0) ;
  32. printUnsigned (MODE_ gCount2) ;
  33. gotoLineColumn (MODE_ 2, 0) ;
  34. printUnsigned (MODE_ gCount3) ;
  35. gotoLineColumn (MODE_ 3, 0) ;
  36. printUnsigned (MODE_ gCount4) ;
  37. }
  38. }
  39. }