Reduce i2c timeouts for rgb led supported hardware (#360)
* Reduce i2c timeouts for rgb led supported hardware * update * make defines more consistent
This commit is contained in:
@@ -45,7 +45,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define OLATB 0x15
|
#define OLATB 0x15
|
||||||
|
|
||||||
extern i2c_status_t mcp23018_status;
|
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 init_ergodox(void);
|
||||||
void ergodox_blink_all_leds(void);
|
void ergodox_blink_all_leds(void);
|
||||||
|
|||||||
@@ -21,12 +21,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
# include "ergodox_ez.h"
|
# include "ergodox_ez.h"
|
||||||
bool i2c_rgblight = true;
|
bool i2c_rgblight = true;
|
||||||
extern bool i2c_initialized;
|
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) {
|
void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) {
|
||||||
if (i2c_initialized && !mcp23018_status && i2c_rgblight) {
|
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_rgblight = false;
|
||||||
i2c_stop();
|
i2c_stop();
|
||||||
} else {
|
} else {
|
||||||
@@ -44,11 +47,11 @@ void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) {
|
|||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
uint8_t *data = (uint8_t *)(led + i);
|
uint8_t *data = (uint8_t *)(led + i);
|
||||||
i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT);
|
i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT);
|
||||||
i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT);
|
i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT);
|
||||||
i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT);
|
i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT);
|
||||||
# ifdef RGBW
|
# ifdef RGBW
|
||||||
i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT);
|
i2c_write(*data++, ERGODOX_RGBLIGHT_TIMEOUT);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
i2c_stop();
|
i2c_stop();
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
i2c_rgblight = true; // re-enable rgb light
|
i2c_rgblight = true; // re-enable rgb light
|
||||||
rgblight_init();
|
rgblight_set();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#ifdef ERGODOX_LED_30
|
#ifdef ERGODOX_LED_30
|
||||||
// If using 30 LEDs, then define that many
|
// If using 30 LEDs, then define that many
|
||||||
# define RGBLED_NUM 30 // Number of LEDs
|
# define RGBLED_NUM 30 // Number of LEDs
|
||||||
#else
|
#else
|
||||||
// If not, then only define 15
|
// 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
|
#endif
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
#ifndef STARTUP_SONG
|
# ifndef STARTUP_SONG
|
||||||
# define STARTUP_SONG SONG(E__NOTE(_DS5), E__NOTE(_D5), E__NOTE(_AS4), Q__NOTE(_F5))
|
# 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))
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GOODBYE_SONG
|
#ifndef ISSI_TIMEOUT
|
||||||
# define GOODBYE_SONG SONG(E__NOTE(_D5), E__NOTE(_F5), E__NOTE(_C5), Q__NOTE(_AS4))
|
# define ISSI_TIMEOUT 5
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user