diff options
author | XScorpion2 <rcalt2vt@gmail.com> | 2019-05-07 18:22:46 -0500 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-05-07 16:22:46 -0700 |
commit | af89752bffbaf5dcea30ea16be66b4d682701bc4 (patch) | |
tree | c82f2bc25409159a44778379db8b3a35afc47b8a /quantum/rgb_matrix.c | |
parent | c7f8548d9af2045996294602d2a4bd9a214ae23c (diff) | |
download | qmk_firmware-af89752bffbaf5dcea30ea16be66b4d682701bc4.tar.gz qmk_firmware-af89752bffbaf5dcea30ea16be66b4d682701bc4.zip |
rgb_led struct conversion (aka: Per led (key) type rgb matrix effects - part 2) (#5783)
* Initial conversion of the rgb_led struct
* Converting last keyboard & updating effects to take advantage of the new structure
* New struct should not be const
* Updated docs
* Changing define ___ for no led to NO_LED
* Missed converting some keymap usages of the old struct layout
Diffstat (limited to 'quantum/rgb_matrix.c')
-rw-r--r-- | quantum/rgb_matrix.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 5528a0834..edbcee9cd 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c | |||
@@ -105,6 +105,7 @@ | |||
105 | 105 | ||
106 | bool g_suspend_state = false; | 106 | bool g_suspend_state = false; |
107 | 107 | ||
108 | extern led_config_t g_led_config; | ||
108 | rgb_config_t rgb_matrix_config; | 109 | rgb_config_t rgb_matrix_config; |
109 | 110 | ||
110 | rgb_counters_t g_rgb_counters; | 111 | rgb_counters_t g_rgb_counters; |
@@ -150,14 +151,11 @@ uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t | |||
150 | } | 151 | } |
151 | 152 | ||
152 | uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { | 153 | uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { |
153 | // TODO: This is kinda expensive, fix this soonish | ||
154 | uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i); | 154 | uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i); |
155 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL && led_count < LED_HITS_TO_REMEMBER; i++) { | 155 | uint8_t led_index = g_led_config.matrix_co[row][column]; |
156 | matrix_co_t matrix_co = g_rgb_leds[i].matrix_co; | 156 | if (led_index != NO_LED) { |
157 | if (row == matrix_co.row && column == matrix_co.col) { | 157 | led_i[led_count] = led_index; |
158 | led_i[led_count] = i; | 158 | led_count++; |
159 | led_count++; | ||
160 | } | ||
161 | } | 159 | } |
162 | return led_count; | 160 | return led_count; |
163 | } | 161 | } |
@@ -201,8 +199,8 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { | |||
201 | 199 | ||
202 | for(uint8_t i = 0; i < led_count; i++) { | 200 | for(uint8_t i = 0; i < led_count; i++) { |
203 | uint8_t index = last_hit_buffer.count; | 201 | uint8_t index = last_hit_buffer.count; |
204 | last_hit_buffer.x[index] = g_rgb_leds[led[i]].point.x; | 202 | last_hit_buffer.x[index] = g_led_config.point[led[i]].x; |
205 | last_hit_buffer.y[index] = g_rgb_leds[led[i]].point.y; | 203 | last_hit_buffer.y[index] = g_led_config.point[led[i]].y; |
206 | last_hit_buffer.index[index] = led[i]; | 204 | last_hit_buffer.index[index] = led[i]; |
207 | last_hit_buffer.tick[index] = 0; | 205 | last_hit_buffer.tick[index] = 0; |
208 | last_hit_buffer.count++; | 206 | last_hit_buffer.count++; |