keybrd library is an open source library for creating custom-keyboard firmware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

Debug.cpp 862B

1234567891011121314151617181920212223242526272829303132
  1. #include "Debug.h"
  2. #include "getFreeSRAM.h"
  3. void Debug::print_free_RAM()
  4. {
  5. delay(1000); //give OS time to find USB
  6. Keyboard.print(F("Free SRAM = "));
  7. Keyboard.println( getFreeSRAM() );
  8. }
  9. void Debug::print_microseconds_per_scan()
  10. {
  11. if (millis() >= nextTime)
  12. {
  13. Keyboard.print(1000000/scanCount); //print microseconds per scan
  14. Keyboard.write(',');
  15. scanCount = 0;
  16. nextTime = millis() + 1000; //print every second
  17. }
  18. scanCount++;
  19. }
  20. void Debug::print_scans_per_second()
  21. {
  22. if (millis() >= nextTime)
  23. {
  24. Keyboard.print(scanCount); //print scans per second
  25. Keyboard.write(',');
  26. scanCount = 0;
  27. nextTime = millis() + 1000; //print every second
  28. }
  29. scanCount++;
  30. }