You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
4.8 KiB

5 years ago
5 years ago
  1. /* Copyright 2018 Jack Humbert <jack.humb@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 "ez.h"
  17. const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
  18. /* Refer to IS31 manual for these locations
  19. * driver
  20. * | R location
  21. * | | G location
  22. * | | | B location
  23. * | | | | */
  24. {0, A_12, B_12, C_12},
  25. {0, A_11, B_11, C_11},
  26. {0, A_10, B_10, C_10},
  27. {0, A_9, B_9, C_9},
  28. {0, A_8, B_8, C_8},
  29. {0, A_7, B_7, C_7},
  30. {0, G_12, H_12, I_12},
  31. {0, G_11, H_11, I_11},
  32. {0, G_10, H_10, I_10},
  33. {0, G_9, H_9, I_9},
  34. {0, G_8, H_8, I_8},
  35. {0, G_7, H_7, I_7},
  36. {0, A_6, B_6, C_6},
  37. {0, A_5, B_5, C_5},
  38. {0, A_4, B_4, C_4},
  39. {0, A_3, B_3, C_3},
  40. {0, A_2, B_2, C_2},
  41. {0, A_1, B_1, C_1},
  42. {0, G_6, H_6, I_6},
  43. {0, G_5, H_5, I_5},
  44. {0, G_4, H_4, I_4},
  45. {0, G_3, H_3, I_3},
  46. {0, G_2, H_2, I_2},
  47. {0, G_1, H_1, I_1},
  48. {0, D_12, E_12, F_12},
  49. {0, D_11, E_11, F_11},
  50. {0, D_10, E_10, F_10},
  51. {0, D_9, E_9, F_9},
  52. {0, D_8, E_8, F_8},
  53. {0, D_7, E_7, F_7},
  54. {0, J_12, K_12, L_12},
  55. {0, J_11, K_11, L_11},
  56. {0, J_10, K_10, L_10},
  57. {0, J_9, K_9, L_9},
  58. {0, J_8, K_8, L_8},
  59. {0, J_7, K_7, L_7},
  60. {0, D_6, E_6, F_6},
  61. {0, D_5, E_5, F_5},
  62. {0, D_4, E_4, F_4},
  63. {0, D_3, E_3, F_3},
  64. {0, D_2, E_2, F_2},
  65. {0, D_1, E_1, F_1},
  66. {0, J_6, K_6, L_6},
  67. {0, J_5, K_5, L_5},
  68. {0, J_4, K_4, L_4},
  69. {0, J_3, K_3, L_3},
  70. {0, J_2, K_2, L_2},
  71. };
  72. const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
  73. /*{row | col << 4}
  74. | {x=0..224, y=0..64}
  75. | | modifier
  76. | | | */
  77. {{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
  78. {{0|(1<<4)}, {20.36*1, 21.33*0}, 0},
  79. {{0|(2<<4)}, {20.36*2, 21.33*0}, 0},
  80. {{0|(3<<4)}, {20.36*3, 21.33*0}, 0},
  81. {{0|(4<<4)}, {20.36*4, 21.33*0}, 0},
  82. {{0|(5<<4)}, {20.36*5, 21.33*0}, 0},
  83. {{0|(6<<4)}, {20.36*6, 21.33*0}, 0},
  84. {{0|(7<<4)}, {20.36*7, 21.33*0}, 0},
  85. {{0|(8<<4)}, {20.36*8, 21.33*0}, 0},
  86. {{0|(9<<4)}, {20.36*9, 21.33*0}, 0},
  87. {{0|(10<<4)}, {20.36*10,21.33*0}, 0},
  88. {{0|(11<<4)}, {20.36*11,21.33*0}, 1},
  89. {{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
  90. {{1|(1<<4)}, {20.36*1, 21.33*1}, 0},
  91. {{1|(2<<4)}, {20.36*2, 21.33*1}, 0},
  92. {{1|(3<<4)}, {20.36*3, 21.33*1}, 0},
  93. {{1|(4<<4)}, {20.36*4, 21.33*1}, 0},
  94. {{1|(5<<4)}, {20.36*5, 21.33*1}, 0},
  95. {{1|(6<<4)}, {20.36*6, 21.33*1}, 0},
  96. {{1|(7<<4)}, {20.36*7, 21.33*1}, 0},
  97. {{1|(8<<4)}, {20.36*8, 21.33*1}, 0},
  98. {{1|(9<<4)}, {20.36*9, 21.33*1}, 0},
  99. {{1|(10<<4)}, {20.36*10,21.33*1}, 0},
  100. {{1|(11<<4)}, {20.36*11,21.33*1}, 1},
  101. {{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
  102. {{2|(1<<4)}, {20.36*1, 21.33*2}, 0},
  103. {{2|(2<<4)}, {20.36*2, 21.33*2}, 0},
  104. {{2|(3<<4)}, {20.36*3, 21.33*2}, 0},
  105. {{2|(4<<4)}, {20.36*4, 21.33*2}, 0},
  106. {{2|(5<<4)}, {20.36*5, 21.33*2}, 0},
  107. {{2|(6<<4)}, {20.36*6, 21.33*2}, 0},
  108. {{2|(7<<4)}, {20.36*7, 21.33*2}, 0},
  109. {{2|(8<<4)}, {20.36*8, 21.33*2}, 0},
  110. {{2|(9<<4)}, {20.36*9, 21.33*2}, 0},
  111. {{2|(10<<4)}, {20.36*10,21.33*2}, 0},
  112. {{2|(11<<4)}, {20.36*11,21.33*2}, 1},
  113. {{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
  114. {{3|(1<<4)}, {20.36*1, 21.33*3}, 1},
  115. {{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
  116. {{3|(3<<4)}, {20.36*3, 21.33*3}, 1},
  117. {{3|(4<<4)}, {20.36*4, 21.33*3}, 1},
  118. {{3|(5<<4)}, {20.36*5.5,21.33*3}, 0},
  119. {{3|(7<<4)}, {20.36*7, 21.33*3}, 1},
  120. {{3|(8<<4)}, {20.36*8, 21.33*3}, 1},
  121. {{3|(9<<4)}, {20.36*9, 21.33*3}, 1},
  122. {{3|(10<<4)}, {20.36*10,21.33*3}, 1},
  123. {{3|(11<<4)}, {20.36*11,21.33*3}, 1}
  124. };
  125. void matrix_init_kb(void) {
  126. matrix_init_user();
  127. palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
  128. palSetPadMode(GPIOB, 9, PAL_MODE_OUTPUT_PUSHPULL);
  129. palClearPad(GPIOB, 9);
  130. palSetPad(GPIOB, 8);
  131. wait_ms(50);
  132. palClearPad(GPIOB, 8);
  133. wait_ms(50);
  134. palSetPad(GPIOB, 9);
  135. wait_ms(50);
  136. palClearPad(GPIOB, 9);
  137. }
  138. void matrix_scan_kb(void) {
  139. matrix_scan_user();
  140. }