diff options
author | Drashna Jaelre <drashna@live.com> | 2022-10-27 22:43:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-28 14:43:40 +0900 |
commit | d9f575fa86ca10b990958d4e677c6a0a387dc7c3 (patch) | |
tree | 310799b9843273a98ad92872f31309fe69295223 /keyboards | |
parent | 89e3c4c0daffc746b8393cf36b755e228a819709 (diff) |
Reduce i2c timeouts for rgb led supported hardware (#360)
* Reduce i2c timeouts for rgb led supported hardware
* update
* make defines more consistent
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/ergodox_ez/ergodox_ez.h | 4 | ||||
-rw-r--r-- | keyboards/ergodox_ez/led_i2c.c | 17 | ||||
-rw-r--r-- | keyboards/ergodox_ez/matrix.c | 2 | ||||
-rw-r--r-- | keyboards/ergodox_ez/post_config.h | 8 | ||||
-rw-r--r-- | keyboards/moonlander/post_config.h | 16 |
5 files changed, 31 insertions, 16 deletions
diff --git a/keyboards/ergodox_ez/ergodox_ez.h b/keyboards/ergodox_ez/ergodox_ez.h index 1ea13070e8..60ec270c9e 100644 --- a/keyboards/ergodox_ez/ergodox_ez.h +++ b/keyboards/ergodox_ez/ergodox_ez.h @@ -45,7 +45,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define OLATB 0x15 extern i2c_status_t mcp23018_status; -#define ERGODOX_EZ_I2C_TIMEOUT 100 +#ifndef ERGODOX_EZ_I2C_TIMEOUT +# define ERGODOX_EZ_I2C_TIMEOUT 80 +#endif void init_ergodox(void); void ergodox_blink_all_leds(void); diff --git a/keyboards/ergodox_ez/led_i2c.c b/keyboards/ergodox_ez/led_i2c.c index e9ab247ba1..e38818aa98 100644 --- a/keyboards/ergodox_ez/led_i2c.c +++ b/keyboards/ergodox_ez/led_i2c.c @@ -21,12 +21,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef RGBLIGHT_ENABLE # include "ergodox_ez.h" -bool i2c_rgblight = true; -extern bool i2c_initialized; +bool i2c_rgblight = true; +extern bool i2c_initialized; +# ifndef ERGODOX_RGBLIGHT_TIMEOUT +# define ERGODOX_RGBLIGHT_TIMEOUT 5 +# endif void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) { if (i2c_initialized && !mcp23018_status && i2c_rgblight) { - if (i2c_start(0x84, ERGODOX_EZ_I2C_TIMEOUT)) { + if (i2c_start(0x84, ERGODOX_RGBLIGHT_TIMEOUT)) { i2c_rgblight = false; i2c_stop(); } else { @@ -44,11 +47,11 @@ void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) { # endif { uint8_t *data = (uint8_t *)(led + i); - i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); - i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); - i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); + i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT); + i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT); + i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT); # ifdef RGBW - i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); + i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT); # endif } i2c_stop(); diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c index 0314191d41..aeb4c41609 100644 --- a/keyboards/ergodox_ez/matrix.c +++ b/keyboards/ergodox_ez/matrix.c @@ -102,7 +102,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { #endif #ifdef RGBLIGHT_ENABLE i2c_rgblight = true; // re-enable rgb light - rgblight_init(); + rgblight_set(); #endif } } diff --git a/keyboards/ergodox_ez/post_config.h b/keyboards/ergodox_ez/post_config.h index 0d4fe5c683..5fc0d83440 100644 --- a/keyboards/ergodox_ez/post_config.h +++ b/keyboards/ergodox_ez/post_config.h @@ -33,8 +33,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef ERGODOX_LED_30 // If using 30 LEDs, then define that many -# define RGBLED_NUM 30 // Number of LEDs +# define RGBLED_NUM 30 // Number of LEDs #else // If not, then only define 15 -# define RGBLED_NUM 15 // Number of LEDs +# define RGBLED_NUM 15 // Number of LEDs +#endif + +#ifndef ISSI_TIMEOUT +# define ISSI_TIMEOUT 3 #endif diff --git a/keyboards/moonlander/post_config.h b/keyboards/moonlander/post_config.h index d594c93413..493235a57e 100644 --- a/keyboards/moonlander/post_config.h +++ b/keyboards/moonlander/post_config.h @@ -1,9 +1,15 @@ +#pragma once + #ifdef AUDIO_ENABLE -#ifndef STARTUP_SONG -# define STARTUP_SONG SONG(E__NOTE(_DS5), E__NOTE(_D5), E__NOTE(_AS4), Q__NOTE(_F5)) -#endif +# ifndef STARTUP_SONG +# define STARTUP_SONG SONG(E__NOTE(_DS5), E__NOTE(_D5), E__NOTE(_AS4), Q__NOTE(_F5)) +# endif -#ifndef GOODBYE_SONG -# define GOODBYE_SONG SONG(E__NOTE(_D5), E__NOTE(_F5), E__NOTE(_C5), Q__NOTE(_AS4)) +# ifndef GOODBYE_SONG +# define GOODBYE_SONG SONG(E__NOTE(_D5), E__NOTE(_F5), E__NOTE(_C5), Q__NOTE(_AS4)) +# endif #endif + +#ifndef ISSI_TIMEOUT +# define ISSI_TIMEOUT 5 #endif |