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.

51 lines
1.5 KiB

  1. /* Copyright 2019 Alex Ong
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "xealousbrown.h"
  17. #ifdef BENCHMARK_MATRIX
  18. # include "timer.h"
  19. # include <stdint.h>
  20. # include <stdbool.h>
  21. # include "wait.h"
  22. # include "util.h"
  23. # include "matrix.h"
  24. # include "quantum.h"
  25. static int scans = 0;
  26. static uint16_t last_print_out = 0;
  27. static int last_timer = 0;
  28. void matrix_scan_user(void) {
  29. scans++;
  30. uint16_t timer = timer_read();
  31. if (timer != last_timer && timer != last_timer + 1) {
  32. print("MS:\n");
  33. print_dec(timer);
  34. print("->");
  35. print_dec(last_timer);
  36. print("\n");
  37. }
  38. last_timer = timer;
  39. if ((timer % 1000 == 0) && (timer != last_print_out)) {
  40. print("Scans: ");
  41. print_dec(scans);
  42. print("\n");
  43. scans = 0;
  44. last_print_out = timer;
  45. }
  46. }
  47. #endif