keymap.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright 2017 skully <skullydazed@gmail.com>
  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 "simontester.h"
  17. #include "printf.h"
  18. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  19. [0] = KEYMAP(
  20. KC_1, KC_2, \
  21. F(0), F(1) \
  22. ),
  23. };
  24. const uint16_t PROGMEM fn_actions[] = {
  25. [0] = ACTION_FUNCTION(0),
  26. [1] = ACTION_FUNCTION(1),
  27. };
  28. void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
  29. if (!record->event.pressed) {
  30. return;
  31. }
  32. switch (id) {
  33. case 0:
  34. print("Turning backlight off.\n");
  35. palSetPad(GPIOA, 6);
  36. palSetPad(GPIOA, 3);
  37. palSetPad(GPIOA, 15);
  38. palSetPad(GPIOB, 5);
  39. break;
  40. case 1:
  41. print("Turning backlight on.\n");
  42. palClearPad(GPIOA, 6);
  43. palClearPad(GPIOA, 3);
  44. palClearPad(GPIOA, 15);
  45. palClearPad(GPIOB, 5);
  46. break;
  47. }
  48. }