logo

qmk_firmware

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

pro_48.c (4570B)


  1. // Copyright 2023 linlin012 (@linlin012)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "quantum.h"
  4. #if defined(RGB_MATRIX_ENABLE)
  5. const is31fl3743a_led_t PROGMEM g_is31fl3743a_leds[IS31FL3743A_LED_COUNT] = {
  6. /* Refer to IS31 manual for these locations
  7. * driver
  8. * | R location
  9. * | | G location
  10. * | | | B location
  11. * | | | | */
  12. {0, SW1_CS1, SW1_CS2, SW1_CS3},
  13. {0, SW2_CS1, SW2_CS2, SW2_CS3},
  14. {0, SW3_CS1, SW3_CS2, SW3_CS3},
  15. {0, SW4_CS1, SW4_CS2, SW4_CS3},
  16. {0, SW5_CS1, SW5_CS2, SW5_CS3},
  17. {0, SW6_CS1, SW6_CS2, SW6_CS3},
  18. {0, SW7_CS1, SW7_CS2, SW7_CS3},
  19. {0, SW8_CS1, SW8_CS2, SW8_CS3},
  20. {0, SW9_CS1, SW9_CS2, SW9_CS3},
  21. {0, SW10_CS1, SW10_CS2, SW10_CS3},
  22. {0, SW11_CS1, SW11_CS2, SW11_CS3},
  23. {0, SW1_CS16, SW1_CS17, SW1_CS18},
  24. {0, SW2_CS16, SW2_CS17, SW2_CS18},
  25. {0, SW3_CS16, SW3_CS17, SW3_CS18},
  26. {0, SW1_CS4, SW1_CS5, SW1_CS6},
  27. {0, SW2_CS4, SW2_CS5, SW2_CS6},
  28. {0, SW3_CS4, SW3_CS5, SW3_CS6},
  29. {0, SW4_CS4, SW4_CS5, SW4_CS6},
  30. {0, SW5_CS4, SW5_CS5, SW5_CS6},
  31. {0, SW6_CS4, SW6_CS5, SW6_CS6},
  32. {0, SW7_CS4, SW7_CS5, SW7_CS6},
  33. {0, SW8_CS4, SW8_CS5, SW8_CS6},
  34. {0, SW9_CS4, SW9_CS5, SW9_CS6},
  35. {0, SW10_CS4, SW10_CS5, SW10_CS6},
  36. {0, SW11_CS4, SW11_CS5, SW11_CS6},
  37. {0, SW4_CS16, SW4_CS17, SW4_CS18},
  38. {0, SW5_CS16, SW5_CS17, SW5_CS18},
  39. {0, SW6_CS16, SW6_CS17, SW6_CS18},
  40. {0, SW1_CS7, SW1_CS8, SW1_CS9},
  41. {0, SW2_CS7, SW2_CS8, SW2_CS9},
  42. {0, SW3_CS7, SW3_CS8, SW3_CS9},
  43. {0, SW4_CS7, SW4_CS8, SW4_CS9},
  44. {0, SW5_CS7, SW5_CS8, SW5_CS9},
  45. {0, SW6_CS7, SW6_CS8, SW6_CS9},
  46. {0, SW7_CS7, SW7_CS8, SW7_CS9},
  47. {0, SW8_CS7, SW8_CS8, SW8_CS9},
  48. {0, SW9_CS7, SW9_CS8, SW9_CS9},
  49. {0, SW10_CS7, SW10_CS8, SW10_CS9},
  50. {0, SW11_CS7, SW11_CS8, SW11_CS9},
  51. {0, SW7_CS16, SW7_CS17, SW7_CS18},
  52. {0, SW8_CS16, SW8_CS17, SW8_CS18},
  53. {0, SW1_CS10, SW1_CS11, SW1_CS12},
  54. {0, SW2_CS10, SW2_CS11, SW2_CS12},
  55. {0, SW3_CS10, SW3_CS11, SW3_CS12},
  56. {0, SW4_CS10, SW4_CS11, SW4_CS12},
  57. {0, SW5_CS10, SW5_CS11, SW5_CS12},
  58. {0, SW6_CS10, SW6_CS11, SW6_CS12},
  59. {0, SW7_CS10, SW7_CS11, SW7_CS12},
  60. {0, SW8_CS10, SW8_CS11, SW8_CS12},
  61. {0, SW9_CS10, SW9_CS11, SW9_CS12},
  62. {0, SW10_CS10, SW10_CS11, SW10_CS12},
  63. {0, SW11_CS10, SW11_CS11, SW11_CS12},
  64. {0, SW9_CS16, SW9_CS17, SW9_CS18},
  65. {0, SW1_CS13, SW1_CS14, SW1_CS15},
  66. {0, SW2_CS13, SW2_CS14, SW2_CS15},
  67. {0, SW3_CS13, SW3_CS14, SW3_CS15},
  68. {0, SW4_CS13, SW4_CS14, SW4_CS15},
  69. {0, SW5_CS13, SW5_CS14, SW5_CS15},
  70. {0, SW5_CS13, SW5_CS14, SW5_CS15},
  71. {0, SW6_CS13, SW6_CS14, SW6_CS15},
  72. {0, SW7_CS13, SW7_CS14, SW7_CS15},
  73. {0, SW8_CS13, SW8_CS14, SW8_CS15},
  74. {0, SW9_CS13, SW9_CS14, SW9_CS15},
  75. {0, SW10_CS13, SW10_CS14, SW10_CS15}
  76. };
  77. bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
  78. if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
  79. return false;
  80. }
  81. if (host_keyboard_led_state().caps_lock) {
  82. RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255);
  83. } else {
  84. if (!rgb_matrix_get_flags()) {
  85. RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0);
  86. }
  87. }
  88. return false;
  89. }
  90. void suspend_power_down_kb(void) {
  91. gpio_write_pin_low(IS31FL3743A_SDB_PIN);
  92. suspend_power_down_user();
  93. }
  94. void suspend_wakeup_init_kb(void) {
  95. gpio_write_pin_high(IS31FL3743A_SDB_PIN);
  96. suspend_wakeup_init_user();
  97. }
  98. #endif
  99. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  100. if (!process_record_user(keycode, record)) {
  101. return false;
  102. }
  103. switch (keycode) {
  104. # ifdef RGB_MATRIX_ENABLE
  105. case QK_RGB_MATRIX_TOGGLE:
  106. if (record->event.pressed) {
  107. switch (rgb_matrix_get_flags()) {
  108. case LED_FLAG_ALL: {
  109. rgb_matrix_set_flags(LED_FLAG_NONE);
  110. rgb_matrix_set_color_all(0, 0, 0);
  111. } break;
  112. default: {
  113. rgb_matrix_set_flags(LED_FLAG_ALL);
  114. } break;
  115. }
  116. }
  117. return false;
  118. # endif
  119. }
  120. return true;
  121. }
  122. void board_init(void) {
  123. // JTAG-DP Disabled and SW-DP Disabled
  124. AFIO->MAPR = (AFIO->MAPR & ~AFIO_MAPR_SWJ_CFG_Msk) | AFIO_MAPR_SWJ_CFG_DISABLE;
  125. }