rgb_matrix.h 9.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. Copyright 2020 Joel Elkins <joel@elkins.com>
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #pragma once
  15. /* RGB LED Layout on the Massdrop ALT
  16. *
  17. * ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
  18. * │ │
  19. * │ 100 99 98 97 96 95 94 93 92 91 90 89 88 │
  20. * │ 101 87 |
  21. * │ ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬────────────┬───────┐ │
  22. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  23. * │ │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ BackSpace │ Home │ │
  24. * │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ │
  25. * │ 102 ├───────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬─────────┼───────┤ 86 │
  26. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  27. * │ │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ Del │ │
  28. * │ │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ │
  29. * │ 103 ├──────────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─────────┼───────┤ 85 │
  30. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  31. * │ │ Ctrl/Esc │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Return │ PgUp │ │
  32. * │ │ 31 │ 32 │ 33 │ 34 │ 35 │ 36 │ 37 │ 38 │ 39 │ 40 │ 41 │ 42 │ 43 │ 44 │ │
  33. * │ 104 ├────────────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴───────┬───────┼───────┤ 84 │
  34. * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
  35. * │ │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │ Up │ PgDn │ │
  36. * │ │ 45 │ 46 │ 47 │ 48 │ 49 │ 50 │ 51 │ 52 │ 53 │ 54 │ 55 │ 56 │ 57 │ 58 │ │
  37. * │ 105 ├─────────┬─────┴───┬───┴─────┬─┴───────┴───────┴───────┴───────┴───────┴─────┬─┴───────┼───────┴─┬──┬───────┼───────┼───────┤ 83 │
  38. * │ │ │ │ │ │ │ │▒▒│ │ │ │ │
  39. * │ │ Ctrl │ GUI │ Alt │ Space │ Alt │ Func │▒▒│ Left │ Down │ Right │ │
  40. * │ │ 59 │ 60 │ 61 │ 62 │ 63 │ 64 │▒▒│ 65 │ 66 │ 67 │ │
  41. * │ └─────────┴─────────┴─────────┴───────────────────────────────────────────────┴─────────┴─────────┴──┴───────┴───────┴───────┘ │
  42. * │ 68 82 │
  43. * │ 69 70 71 72 73 74 75 76 77 78 79 80 81 │
  44. * │ │
  45. * └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
  46. */
  47. enum layer_rgb_type {
  48. type_hsv,
  49. type_rgb,
  50. };
  51. #define RGB_LINK_TO_LAYER(layer) (layer + RGB_MATRIX_EFFECT_MAX)
  52. struct layer_rgb {
  53. uint8_t type;
  54. led_flags_t flags;
  55. uint8_t mode;
  56. union {
  57. HSV hsv;
  58. RGB rgb[DRIVER_LED_TOTAL];
  59. };
  60. };
  61. #define LAYOUT_rgb(_flags, _mode, \
  62. R101, R100, R99, R98, R97, R96, R95, R94, R93, R92, R91, R90, R89, R88, R87, \
  63. R102, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R86, \
  64. R103, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30, R85, \
  65. R31, R32, R33, R34, R35, R36, R37, R38, R39, R40, R41, R42, R43, R44, \
  66. R104, R45, R46, R47, R48, R49, R50, R51, R52, R53, R54, R55, R56, R57, R58, R84, \
  67. R105, R59, R60, R61, R62, R63, R64, R65, R66, R67, R83, \
  68. R68, R69, R70, R71, R72, R73, R74, R75, R76, R77, R78, R79, R80, R81, R82 \
  69. ) (struct layer_rgb) { .type = type_rgb, .flags = _flags, .mode = _mode, .rgb = { \
  70. R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, \
  71. R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, R32, R33, R34, R35, R36, R37, R38, R39, R40, \
  72. R41, R42, R43, R44, R45, R46, R47, R48, R49, R50, R51, R52, R53, R54, R55, R56, R57, R58, R59, \
  73. R60, R61, R62, R63, R64, R65, R66, R67, R68, R69, R70, R71, R72, R73, R74, R75, R76, R77, R78, \
  74. R79, R80, R81, R82, R83, R84, R85, R86, R87, R88, R89, R90, R91, R92, R93, R94, R95, R96, R97, \
  75. R98, R99, R100, R101, R102, R103, R104, R105 \
  76. }}
  77. #define LAYOUT_hsv(_flags, _mode, _hsv) \
  78. (struct layer_rgb) { \
  79. .type = type_hsv, \
  80. .flags = _flags, \
  81. .mode = _mode, \
  82. .hsv = {_hsv} \
  83. }