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.

38 lines
1.3 KiB

  1. /* Copyright 2021 QMK
  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 QMK_KEYBOARD_H
  17. #include "digitizer.h"
  18. #include "math.h"
  19. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {LAYOUT_ortho_1x1(KC_A)};
  20. uint32_t timer = 0;
  21. void matrix_scan_user() {
  22. if (timer_elapsed32(timer) < 200) {
  23. return;
  24. }
  25. timer = timer_read32();
  26. digitizer_t digitizer;
  27. digitizer.x = 0.5 - 0.2 * cos(timer_read() / 250. / 6.28);
  28. digitizer.y = 0.5 - 0.2 * sin(timer_read() / 250. / 6.28);
  29. digitizer.tipswitch = 0;
  30. digitizer.inrange = 1;
  31. digitizer_set_report(digitizer);
  32. }