logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

snap.c (1957B)


  1. /* Copyright 2021 Jay Greco
  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 "snap.h"
  17. void matrix_init_kb(void) {
  18. set_bitc_LED(LED_OFF);
  19. matrix_init_remote_kb();
  20. matrix_init_user();
  21. }
  22. void keyboard_post_init_kb(void) {
  23. #ifdef CONSOLE_ENABLE
  24. debug_enable = true;
  25. debug_matrix = true;
  26. #endif
  27. keyboard_post_init_user();
  28. }
  29. void matrix_scan_kb(void) {
  30. matrix_scan_remote_kb();
  31. matrix_scan_user();
  32. }
  33. // Use Bit-C LED to show CAPS LOCK and NUM LOCK status
  34. void led_update_ports(led_t led_state) {
  35. set_bitc_LED(led_state.caps_lock ? LED_DIM : LED_OFF);
  36. }
  37. bool shutdown_kb(bool jump_to_bootloader) {
  38. if (!shutdown_user(jump_to_bootloader)) {
  39. return false;
  40. }
  41. set_bitc_LED(LED_DIM);
  42. #ifdef RGBLIGHT_ENABLE
  43. rgblight_disable_noeeprom();
  44. #endif
  45. #ifdef OLED_ENABLE
  46. oled_off();
  47. #endif
  48. return true;
  49. }
  50. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  51. // If console is enabled, it will print the matrix position and status of each key pressed
  52. #ifdef CONSOLE_ENABLE
  53. dprintf("kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time);
  54. #endif
  55. process_record_remote_kb(keycode, record);
  56. if (!process_record_user(keycode, record)) return false;
  57. return true;
  58. }