summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorErez Zukerman <bulk@ezuk.org>2018-07-03 14:06:36 -0400
committerGitHub <noreply@github.com>2018-07-03 14:06:36 -0400
commit9c2dde98e2b963704eb7cb87f6c53c52599fba53 (patch)
treeced26f98b401d83aee69a6ee3b17bf9fbc6ad556 /quantum
parenta7df902734b6aa8975e3a62a07ddb5544fd4ae85 (diff)
parent08283f61244479743c4ff5ecba39bd0264979d77 (diff)
Merge pull request #3229 from qmk/hf/shinydox
Adds I2C timeout and return values, adds support for future RGB Ergodox EZ
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c2
-rw-r--r--quantum/rgb_matrix.c78
-rw-r--r--quantum/rgb_matrix.h3
3 files changed, 43 insertions, 40 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index cfa3df7418..5abd222d19 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -854,7 +854,7 @@ void matrix_init_quantum() {
audio_init();
#endif
#ifdef RGB_MATRIX_ENABLE
- rgb_matrix_init_drivers();
+ rgb_matrix_init();
#endif
matrix_init_kb();
}
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index b7424d6372..b4bbc3dc07 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -105,7 +105,6 @@ void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led_i, uint8_t
}
}
-
void rgb_matrix_update_pwm_buffers(void) {
IS31FL3731_update_pwm_buffers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
@@ -119,7 +118,6 @@ void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
IS31FL3731_set_color_all( red, green, blue );
}
-
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
if ( record->event.pressed ) {
uint8_t led[8], led_count;
@@ -222,7 +220,7 @@ void rgb_matrix_single_LED_test(void) {
}
// All LEDs off
-void rgb_matrix_all_off(void) {
+void rgb_matrix_all_off(void) {
rgb_matrix_set_color_all( 0, 0, 0 );
}
@@ -248,7 +246,7 @@ void rgb_matrix_solid_reactive(void) {
// alphas = color1, mods = color2
void rgb_matrix_alphas_mods(void) {
-
+
RGB rgb1 = hsv_to_rgb( (HSV){ .h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val } );
RGB rgb2 = hsv_to_rgb( (HSV){ .h = (rgb_matrix_config.hue + 180) % 360, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val } );
@@ -726,40 +724,44 @@ void rgb_matrix_indicators_user(void) {}
// }
// }
-void rgb_matrix_init_drivers(void) {
- // Initialize TWI
- i2c_init();
- IS31FL3731_init( DRIVER_ADDR_1 );
- IS31FL3731_init( DRIVER_ADDR_2 );
-
- for ( int index = 0; index < DRIVER_LED_TOTAL; index++ ) {
- bool enabled = true;
- // This only caches it for later
- IS31FL3731_set_led_control_register( index, enabled, enabled, enabled );
- }
- // This actually updates the LED drivers
- IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
-
- // TODO: put the 1 second startup delay here?
-
- // clear the key hits
- for ( int led=0; led<DRIVER_LED_TOTAL; led++ ) {
- g_key_hit[led] = 255;
- }
-
-
- if (!eeconfig_is_enabled()) {
- dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n");
- eeconfig_init();
- eeconfig_update_rgb_matrix_default();
- }
- rgb_matrix_config.raw = eeconfig_read_rgb_matrix();
- if (!rgb_matrix_config.mode) {
- dprintf("rgb_matrix_init_drivers rgb_matrix_config.mode = 0. Write default values to EEPROM.\n");
- eeconfig_update_rgb_matrix_default();
- rgb_matrix_config.raw = eeconfig_read_rgb_matrix();
- }
- eeconfig_debug_rgb_matrix(); // display current eeprom values
+void rgb_matrix_init(void) {
+ rgb_matrix_setup_drivers();
+
+ // TODO: put the 1 second startup delay here?
+
+ // clear the key hits
+ for ( int led=0; led<DRIVER_LED_TOTAL; led++ ) {
+ g_key_hit[led] = 255;
+ }
+
+
+ if (!eeconfig_is_enabled()) {
+ dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n");
+ eeconfig_init();
+ eeconfig_update_rgb_matrix_default();
+ }
+ rgb_matrix_config.raw = eeconfig_read_rgb_matrix();
+ if (!rgb_matrix_config.mode) {
+ dprintf("rgb_matrix_init_drivers rgb_matrix_config.mode = 0. Write default values to EEPROM.\n");
+ eeconfig_update_rgb_matrix_default();
+ rgb_matrix_config.raw = eeconfig_read_rgb_matrix();
+ }
+ eeconfig_debug_rgb_matrix(); // display current eeprom values
+}
+
+void rgb_matrix_setup_drivers(void) {
+ // Initialize TWI
+ i2c_init();
+ IS31FL3731_init( DRIVER_ADDR_1 );
+ IS31FL3731_init( DRIVER_ADDR_2 );
+
+ for ( int index = 0; index < DRIVER_LED_TOTAL; index++ ) {
+ bool enabled = true;
+ // This only caches it for later
+ IS31FL3731_set_led_control_register( index, enabled, enabled, enabled );
+ }
+ // This actually updates the LED drivers
+ IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
}
// Deals with the messy details of incrementing an integer
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index aaa85d5f51..5769314002 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -95,7 +95,8 @@ void rgb_matrix_indicators_user(void);
void rgb_matrix_single_LED_test(void);
-void rgb_matrix_init_drivers(void);
+void rgb_matrix_init(void);
+void rgb_matrix_setup_drivers(void);
void rgb_matrix_set_suspend_state(bool state);
void rgb_matrix_set_indicator_state(uint8_t state);