Updated rgb_led struct field modifier to flags (#5619)
[jackhill/qmk/firmware.git] / keyboards / planck / light / light.c
CommitLineData
14b7602a 1/* Copyright 2017 Jack Humbert
b669d115
JH
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
17#include "light.h"
18
14b7602a
JH
19const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
20/* Refer to IS31 manual for these locations
21 * driver
22 * | R location
23 * | | G location
24 * | | | B location
25 * | | | | */
26 {0, C1_3, C2_3, C3_3},
27 {0, C1_4, C2_4, C3_4},
28 {0, C1_5, C2_5, C3_5},
29 {0, C1_11, C2_11, C3_11},
30 {0, C1_12, C2_12, C3_12},
31 {0, C1_13, C2_13, C3_13},
32 {1, C1_3, C2_3, C3_3},
33 {1, C1_4, C2_4, C3_4},
34 {1, C1_5, C2_5, C3_5},
35 {1, C1_11, C2_11, C3_11},
36 {1, C1_12, C2_12, C3_12},
37 {1, C1_13, C2_13, C3_13},
38
39 {0, C1_6, C2_6, C3_6},
40 {0, C1_7, C2_7, C3_7},
41 {0, C1_8, C2_8, C3_8},
42 {0, C1_14, C2_14, C3_14},
43 {0, C1_15, C2_15, C3_15},
44 {0, C1_16, C2_16, C3_16},
45 {1, C1_6, C2_6, C3_6},
46 {1, C1_7, C2_7, C3_7},
47 {1, C1_8, C2_8, C3_8},
48 {1, C1_14, C2_14, C3_14},
49 {1, C1_15, C2_15, C3_15},
50 {1, C1_16, C2_16, C3_16},
51
52 {0, C9_1, C8_1, C7_1},
53 {0, C9_2, C8_2, C7_2},
54 {0, C9_3, C8_3, C7_3},
55 {0, C9_9, C8_9, C7_9},
56 {0, C9_10, C8_10, C7_10},
57 {0, C9_11, C8_11, C7_11},
58 {1, C9_1, C8_1, C7_1},
59 {1, C9_2, C8_2, C7_2},
60 {1, C9_3, C8_3, C7_3},
61 {1, C9_9, C8_9, C7_9},
62 {1, C9_10, C8_10, C7_10},
63 {1, C9_11, C8_11, C7_11},
64
65 {0, C9_4, C8_4, C7_4},
66 {0, C9_5, C8_5, C7_5},
67 {0, C9_6, C8_6, C7_6},
68 {0, C9_12, C8_12, C7_12},
69 {0, C9_13, C8_13, C7_13},
70 {0, C9_14, C8_14, C7_14},
71 {0, C9_15, C8_15, C6_14}, // middle 2u switch
72 {1, C9_4, C8_4, C7_4},
73 {1, C9_5, C8_5, C7_5},
74 {1, C9_6, C8_6, C7_6},
75 {1, C9_12, C8_12, C7_12},
76 {1, C9_13, C8_13, C7_13},
77 {1, C9_14, C8_14, C7_14}
78};
79
a7113c8e 80rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
14b7602a
JH
81
82 /*{row | col << 4}
83 | {x=0..224, y=0..64}
a7113c8e 84 | | flags
14b7602a
JH
85 | | | */
86 {{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
a7113c8e
X
87 {{0|(1<<4)}, {20.36*1, 21.33*0}, 4},
88 {{0|(2<<4)}, {20.36*2, 21.33*0}, 4},
89 {{0|(3<<4)}, {20.36*3, 21.33*0}, 4},
90 {{0|(4<<4)}, {20.36*4, 21.33*0}, 4},
91 {{0|(5<<4)}, {20.36*5, 21.33*0}, 4},
92 {{0|(6<<4)}, {20.36*6, 21.33*0}, 4},
93 {{0|(7<<4)}, {20.36*7, 21.33*0}, 4},
94 {{0|(8<<4)}, {20.36*8, 21.33*0}, 4},
95 {{0|(9<<4)}, {20.36*9, 21.33*0}, 4},
96 {{0|(10<<4)}, {20.36*10,21.33*0}, 4},
14b7602a
JH
97 {{0|(11<<4)}, {20.36*11,21.33*0}, 1},
98
99 {{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
a7113c8e
X
100 {{1|(1<<4)}, {20.36*1, 21.33*1}, 4},
101 {{1|(2<<4)}, {20.36*2, 21.33*1}, 4},
102 {{1|(3<<4)}, {20.36*3, 21.33*1}, 4},
103 {{1|(4<<4)}, {20.36*4, 21.33*1}, 4},
104 {{1|(5<<4)}, {20.36*5, 21.33*1}, 4},
105 {{1|(6<<4)}, {20.36*6, 21.33*1}, 4},
106 {{1|(7<<4)}, {20.36*7, 21.33*1}, 4},
107 {{1|(8<<4)}, {20.36*8, 21.33*1}, 4},
108 {{1|(9<<4)}, {20.36*9, 21.33*1}, 4},
109 {{1|(10<<4)}, {20.36*10,21.33*1}, 4},
14b7602a
JH
110 {{1|(11<<4)}, {20.36*11,21.33*1}, 1},
111
112 {{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
a7113c8e
X
113 {{2|(1<<4)}, {20.36*1, 21.33*2}, 4},
114 {{2|(2<<4)}, {20.36*2, 21.33*2}, 4},
115 {{2|(3<<4)}, {20.36*3, 21.33*2}, 4},
116 {{2|(4<<4)}, {20.36*4, 21.33*2}, 4},
117 {{2|(5<<4)}, {20.36*5, 21.33*2}, 4},
118 {{2|(6<<4)}, {20.36*6, 21.33*2}, 4},
119 {{2|(7<<4)}, {20.36*7, 21.33*2}, 4},
120 {{2|(8<<4)}, {20.36*8, 21.33*2}, 4},
121 {{2|(9<<4)}, {20.36*9, 21.33*2}, 4},
122 {{2|(10<<4)}, {20.36*10,21.33*2}, 4},
14b7602a
JH
123 {{2|(11<<4)}, {20.36*11,21.33*2}, 1},
124
125 {{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
126 {{3|(1<<4)}, {20.36*1, 21.33*3}, 1},
127 {{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
128 {{3|(3<<4)}, {20.36*3, 21.33*3}, 1},
129 {{3|(4<<4)}, {20.36*4, 21.33*3}, 1},
a7113c8e
X
130 {{3|(5<<4)}, {20.36*5, 21.33*3}, 4},
131 {{3|(5<<4)}, {20.36*5.5,21.33*3}, 4},
132 {{3|(6<<4)}, {20.36*6, 21.33*3}, 4},
14b7602a
JH
133 {{3|(7<<4)}, {20.36*7, 21.33*3}, 1},
134 {{3|(8<<4)}, {20.36*8, 21.33*3}, 1},
135 {{3|(9<<4)}, {20.36*9, 21.33*3}, 1},
136 {{3|(10<<4)}, {20.36*10,21.33*3}, 1},
137 {{3|(11<<4)}, {20.36*11,21.33*3}, 1}
138};
139
b669d115
JH
140void matrix_init_kb(void) {
141
142 // Turn status LED on
143 DDRD |= (1<<6);
144 PORTD |= (1<<6);
145
146 matrix_init_user();
147}
148
149bool process_record_kb(uint16_t keycode, keyrecord_t *record)
14b7602a 150{
b669d115
JH
151 return process_record_user(keycode, record);
152}
153
b669d115
JH
154void matrix_scan_kb(void)
155{
156 matrix_scan_user();
14b7602a
JH
157}
158
159void suspend_power_down_kb(void)
160{
161 rgb_matrix_set_suspend_state(true);
23d68d0b 162 suspend_power_down_user();
14b7602a
JH
163}
164
165void suspend_wakeup_init_kb(void)
166{
167 rgb_matrix_set_suspend_state(false);
23d68d0b 168 suspend_wakeup_init_user();
14b7602a
JH
169}
170