Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with Ergodox EZ Shine LEDs #400

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions keyboards/zsa/ergodox_ez/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
"saturation_steps": 255,
"sleep": true
},
"ws2812": {
"rgbw": true
},
"tapping": {
"toggle": 1
},
Expand Down
3 changes: 1 addition & 2 deletions keyboards/zsa/ergodox_ez/m32u4/m32u4.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ void keyboard_post_init_sub(void) {
// (tied to Vcc for hardware convenience)
setPinInput(B4);

// unused pins - C7, D4, D5, D7, E6
// unused pins - C7, D4, D5, E6
// set as input with internal pull-up enabled
setPinInputHigh(C7);
setPinInputHigh(D4);
setPinInputHigh(D5);
setPinInputHigh(D7);
setPinInputHigh(E6);

setPinOutput(ERGODOX_LED_1_PIN);
Expand Down
1 change: 1 addition & 0 deletions keyboards/zsa/ergodox_ez/post_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// If not, then only define 15
# define RGBLIGHT_LED_COUNT 15 // Number of LEDs
#endif
#define WS2812_LED_COUNT RGBLIGHT_LED_COUNT

#ifndef ISSI_TIMEOUT
# define ISSI_TIMEOUT 3
Expand Down
5 changes: 5 additions & 0 deletions keyboards/zsa/ergodox_ez/post_rules.mk
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
include keyboards/zsa/common/features.mk
ifeq ($(RGBLIGHT_ENABLE),yes)
RGBLIGHT_DRIVER = custom
WS2812_DRIVER_REQUIRED = yes
SRC += rgblight_custom.c
endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,23 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef RGBLIGHT_ENABLE

# include "ergodox_ez.h"
# include "ws2812.h"

void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) {
void setleds_custom(rgb_led_t *led, uint16_t led_num) {
uint16_t length = 0;
uint8_t i = 0;
uint8_t j = 0;
# ifdef RGBW
const uint8_t bytes_per_led = 4;
int i = 0;
int j = 0;
# ifdef WS2812_RGBW
int bytes_per_led = 4;
# else
const uint8_t bytes_per_led = 3;
int bytes_per_led = 3;
# endif
# if defined(ERGODOX_LED_30)
// prevent right-half code from trying to bitbang all 30
// so with 30 LEDs, we count from 29 to 15 here, and the
// other half does 0 to 14.
uint8_t half_led_num = RGBLED_NUM / 2;
uint8_t half_led_num = WS2812_LED_COUNT / 2;
length = half_led_num * bytes_per_led;
uint8_t data[length];
for (i = half_led_num + half_led_num - 1; i >= half_led_num; --i)
Expand All @@ -53,7 +52,7 @@ void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) {
data[j++] = data_byte[0];
data[j++] = data_byte[1];
data[j++] = data_byte[2];
# ifdef RGBW
# ifdef WS2812_RGBW
data[j++] = data_byte[3];
# endif
}
Expand All @@ -62,4 +61,7 @@ void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) {
ws2812_setleds(led, led_num);
}

#endif // RGBLIGHT_ENABLE
const rgblight_driver_t rgblight_driver = {
.init = ws2812_init,
.setleds = setleds_custom,
};
Loading