keymap.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 "clueboard2.h"
  17. #include "printf.h"
  18. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  19. [0] = KEYMAP(
  20. F(0), F(1)
  21. ),
  22. };
  23. const uint16_t PROGMEM fn_actions[] = {
  24. [0] = ACTION_FUNCTION(0),
  25. [1] = ACTION_FUNCTION(1),
  26. };
  27. void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
  28. /* Turn LEDs on and off as the button is pressed.
  29. */
  30. if (record->event.pressed) {
  31. switch (id) {
  32. case 0:
  33. palSetPad(GPIOA, 4);
  34. break;
  35. case 1:
  36. palSetPad(GPIOB, 7);
  37. break;
  38. }
  39. } else {
  40. switch (id) {
  41. case 0:
  42. palClearPad(GPIOA, 4);
  43. break;
  44. case 1:
  45. palClearPad(GPIOB, 7);
  46. break;
  47. }
  48. }
  49. /*
  50. switch (id) {
  51. case 0:
  52. print("Turning backlight off.\n");
  53. palClearPad(GPIOA, 4);
  54. palClearPad(GPIOB, 7);
  55. break;
  56. case 1:
  57. print("Turning backlight on.\n");
  58. palSetPad(GPIOA, 4);
  59. palSetPad(GPIOB, 7);
  60. break;
  61. }
  62. */
  63. }