rev2.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "helix.h"
  2. // Each keymap.c should use is_keyboard_master() instead of 'is_master'.
  3. // But keep 'is_master' for a while for backwards compatibility
  4. // for the old keymap.c.
  5. uint8_t is_master = false;
  6. #ifdef SSD1306OLED
  7. #include "ssd1306.h"
  8. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  9. return process_record_gfx(keycode,record) && process_record_user(keycode, record);
  10. }
  11. #endif
  12. bool is_mac_mode(void) {
  13. // This is the opposite of the QMK standard, but we'll leave it for backwards compatibility.
  14. return keymap_config.swap_lalt_lgui == false;
  15. }
  16. void set_mac_mode_kb(bool macmode) {
  17. /* The result is the same as pressing the AG_NORM(=MAGIC_UNSWAP_ALT_GUI)/AG_SWAP(=MAGIC_SWAP_ALT_GUI) keys.
  18. * see
  19. * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L123-L124
  20. * https://github.com/qmk/qmk_firmware/blob/fb4a6ad30ea7a648acd59793ed4a30c3a8d8dc32/quantum/process_keycode/process_magic.c#L80-L81
  21. */
  22. keymap_config.swap_lalt_lgui = keymap_config.swap_ralt_rgui = !macmode;
  23. eeconfig_update_keymap(keymap_config.raw);
  24. }
  25. void matrix_init_kb(void) {
  26. // Each keymap.c should use is_keyboard_master() instead of is_master.
  27. // But keep is_master for a while for backwards compatibility
  28. // for the old keymap.c.
  29. is_master = is_keyboard_master();
  30. matrix_init_user();
  31. };
  32. void keyboard_post_init_kb(void) {
  33. #if defined(DEBUG_MATRIX_SCAN_RATE)
  34. debug_enable = true;
  35. #endif
  36. keyboard_post_init_user();
  37. }
  38. #if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED)
  39. void matrix_slave_scan_user(void) {
  40. matrix_scan_user();
  41. }
  42. #endif