diff options
Diffstat (limited to 'quantum/led_matrix.h')
| -rw-r--r-- | quantum/led_matrix.h | 84 |
1 files changed, 58 insertions, 26 deletions
diff --git a/quantum/led_matrix.h b/quantum/led_matrix.h index 85bae43c1..ba8f0279a 100644 --- a/quantum/led_matrix.h +++ b/quantum/led_matrix.h | |||
| @@ -19,10 +19,32 @@ | |||
| 19 | 19 | ||
| 20 | #pragma once | 20 | #pragma once |
| 21 | 21 | ||
| 22 | #include <stdint.h> | ||
| 23 | #include <stdbool.h> | ||
| 22 | #include "led_matrix_types.h" | 24 | #include "led_matrix_types.h" |
| 25 | #include "quantum.h" | ||
| 23 | 26 | ||
| 24 | #ifndef BACKLIGHT_ENABLE | 27 | #ifdef IS31FL3731 |
| 25 | # error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE | 28 | # include "is31fl3731-simple.h" |
| 29 | #endif | ||
| 30 | |||
| 31 | #ifndef LED_MATRIX_LED_FLUSH_LIMIT | ||
| 32 | # define LED_MATRIX_LED_FLUSH_LIMIT 16 | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #ifndef LED_MATRIX_LED_PROCESS_LIMIT | ||
| 36 | # define LED_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #if defined(LED_MATRIX_LED_PROCESS_LIMIT) && LED_MATRIX_LED_PROCESS_LIMIT > 0 && LED_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL | ||
| 40 | # define LED_MATRIX_USE_LIMITS(min, max) \ | ||
| 41 | uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter; \ | ||
| 42 | uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT; \ | ||
| 43 | if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; | ||
| 44 | #else | ||
| 45 | # define LED_MATRIX_USE_LIMITS(min, max) \ | ||
| 46 | uint8_t min = 0; \ | ||
| 47 | uint8_t max = DRIVER_LED_TOTAL; | ||
| 26 | #endif | 48 | #endif |
| 27 | 49 | ||
| 28 | enum led_matrix_effects { | 50 | enum led_matrix_effects { |
| @@ -31,49 +53,58 @@ enum led_matrix_effects { | |||
| 31 | LED_MATRIX_EFFECT_MAX | 53 | LED_MATRIX_EFFECT_MAX |
| 32 | }; | 54 | }; |
| 33 | 55 | ||
| 34 | void led_matrix_set_index_value(int index, uint8_t value); | 56 | void eeconfig_update_led_matrix_default(void); |
| 35 | void led_matrix_set_index_value_all(uint8_t value); | 57 | void eeconfig_update_led_matrix(void); |
| 58 | void eeconfig_debug_led_matrix(void); | ||
| 36 | 59 | ||
| 37 | // This runs after another backlight effect and replaces | 60 | uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i); |
| 38 | // colors already set | 61 | uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i); |
| 39 | void led_matrix_indicators(void); | ||
| 40 | void led_matrix_indicators_kb(void); | ||
| 41 | void led_matrix_indicators_user(void); | ||
| 42 | 62 | ||
| 43 | void led_matrix_init(void); | 63 | void led_matrix_set_value(int index, uint8_t value); |
| 44 | void led_matrix_setup_drivers(void); | 64 | void led_matrix_set_value_all(uint8_t value); |
| 45 | 65 | ||
| 46 | void led_matrix_set_suspend_state(bool state); | 66 | bool process_led_matrix(uint16_t keycode, keyrecord_t *record); |
| 47 | void led_matrix_set_indicator_state(uint8_t state); | ||
| 48 | 67 | ||
| 49 | void led_matrix_task(void); | 68 | void led_matrix_task(void); |
| 50 | 69 | ||
| 51 | // This should not be called from an interrupt | 70 | // This runs after another backlight effect and replaces |
| 52 | // (eg. from a timer interrupt). | 71 | // values already set |
| 53 | // Call this while idle (in between matrix scans). | 72 | void led_matrix_indicators(void); |
| 54 | // If the buffer is dirty, it will update the driver with the buffer. | 73 | void led_matrix_indicators_kb(void); |
| 55 | void led_matrix_update_pwm_buffers(void); | 74 | void led_matrix_indicators_user(void); |
| 56 | |||
| 57 | bool process_led_matrix(uint16_t keycode, keyrecord_t *record); | ||
| 58 | 75 | ||
| 59 | uint32_t led_matrix_get_tick(void); | 76 | void led_matrix_init(void); |
| 60 | 77 | ||
| 78 | void led_matrix_set_suspend_state(bool state); | ||
| 79 | bool led_matrix_get_suspend_state(void); | ||
| 61 | void led_matrix_toggle(void); | 80 | void led_matrix_toggle(void); |
| 81 | void led_matrix_toggle_noeeprom(void); | ||
| 62 | void led_matrix_enable(void); | 82 | void led_matrix_enable(void); |
| 63 | void led_matrix_enable_noeeprom(void); | 83 | void led_matrix_enable_noeeprom(void); |
| 64 | void led_matrix_disable(void); | 84 | void led_matrix_disable(void); |
| 65 | void led_matrix_disable_noeeprom(void); | 85 | void led_matrix_disable_noeeprom(void); |
| 86 | uint8_t led_matrix_is_enabled(void); | ||
| 87 | void led_matrix_mode(uint8_t mode); | ||
| 88 | void led_matrix_mode_noeeprom(uint8_t mode); | ||
| 89 | uint8_t led_matrix_get_mode(void); | ||
| 66 | void led_matrix_step(void); | 90 | void led_matrix_step(void); |
| 91 | void led_matrix_step_noeeprom(void); | ||
| 67 | void led_matrix_step_reverse(void); | 92 | void led_matrix_step_reverse(void); |
| 93 | void led_matrix_step_reverse_noeeprom(void); | ||
| 94 | void led_matrix_set_val(uint8_t val); | ||
| 95 | void led_matrix_set_val_noeeprom(uint8_t val); | ||
| 96 | uint8_t led_matrix_get_val(void); | ||
| 68 | void led_matrix_increase_val(void); | 97 | void led_matrix_increase_val(void); |
| 98 | void led_matrix_increase_val_noeeprom(void); | ||
| 69 | void led_matrix_decrease_val(void); | 99 | void led_matrix_decrease_val(void); |
| 100 | void led_matrix_decrease_val_noeeprom(void); | ||
| 101 | void led_matrix_set_speed(uint8_t speed); | ||
| 102 | void led_matrix_set_speed_noeeprom(uint8_t speed); | ||
| 103 | uint8_t led_matrix_get_speed(void); | ||
| 70 | void led_matrix_increase_speed(void); | 104 | void led_matrix_increase_speed(void); |
| 105 | void led_matrix_increase_speed_noeeprom(void); | ||
| 71 | void led_matrix_decrease_speed(void); | 106 | void led_matrix_decrease_speed(void); |
| 72 | void led_matrix_mode(uint8_t mode, bool eeprom_write); | 107 | void led_matrix_decrease_speed_noeeprom(void); |
| 73 | void led_matrix_mode_noeeprom(uint8_t mode); | ||
| 74 | uint8_t led_matrix_get_mode(void); | ||
| 75 | void led_matrix_set_value(uint8_t mode); | ||
| 76 | void led_matrix_set_value_noeeprom(uint8_t mode); | ||
| 77 | 108 | ||
| 78 | typedef struct { | 109 | typedef struct { |
| 79 | /* Perform any initialisation required for the other driver functions to work. */ | 110 | /* Perform any initialisation required for the other driver functions to work. */ |
| @@ -91,4 +122,5 @@ extern const led_matrix_driver_t led_matrix_driver; | |||
| 91 | 122 | ||
| 92 | extern led_eeconfig_t led_matrix_eeconfig; | 123 | extern led_eeconfig_t led_matrix_eeconfig; |
| 93 | 124 | ||
| 125 | extern bool g_suspend_state; | ||
| 94 | extern led_config_t g_led_config; | 126 | extern led_config_t g_led_config; |
