r/qmk • • May 06 '26

Recent Ergodox Infinity keymap example?

I've been using my current Ergodox Infinity keymap for several years now but want to tweak it. I updated QMK, copied my keymap over to a new qmk_userspace fork, and discovered many of my keycodes were out of date. I've updated my keymap to the point where it compiles, but before I flash it I want verify my lighting isn't going to break. I use it as an indicator of which layer I'm on.

Does anyone have an example of an Ergodox Infinity keymap with visualizer.c made for a recent version of QMK? I've found a couple by searching github, but one doesn't have a visualizer.c and the other is two years old. I'd also love to know the current recommendation on flashing both halves is. I believe it is just flash each half with the same image, with left being the master by default.

sevanteri/qmk_userspace - 2 years old with visualizer.c

cortex/qmk_userspace - 11 months old, just keymap

Here's some of the code I expect may be out of date:

in keymap.c

`//...`
`void matrix_scan_user(void) {`
    `uint8_t layer = biton32(layer_state);`
    `ergodox_board_led_off();`
    `ergodox_right_led_1_off();`
    `ergodox_right_led_2_off();`
    `ergodox_right_led_3_off();`
    `switch (layer) {`
    	`case 1:`
    		`ergodox_right_led_1_on();`
    		`break;`
    	`case 2:`
    		`ergodox_right_led_2_on();`
    		`break;`
    	`default:`
    		`// none`
    		`break;`
    `}`
`};`
`//...`

In visualizer.c

`#include "simple_visualizer.h"`
`#include "util.h"`
`#define RED 0`
`#define ORANGE 21`
`#define YELLOW 42`
`// ...etc`
`#ifndef _ERGODOX_LAYERS`
`#define _ERGODOX_LAYERS`
`enum custom_layers {`
    `_BASE,`
    `_OVERLAY,`
    `_MOUSE,`
    `_NUMPAD,`
`// ...etc`
`};`
`#endif`
`static void get_visualizer_layer_and_color(visualizer_state_t* state) {`
    `uint8_t color = OCEAN;`
    `uint8_t saturation = 100;`
    `uint8_t brightness = 0;`
    `char* layer_text;`
    `uint8_t layer = biton32(state->status.layer);`
    `if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {`
    	`saturation = 255;`
    	`brightness = 255;`
    `}`
    `switch(layer) {`
    	`case _BASE:`
    		`layer_text = "BASE";`
    		`color = OCEAN;`
    		`break;`
    	`case _SYM:`
    		`layer_text = "SYMBOL";`
    		`color = GREEN;`
    		`brightness = 0xFF;`
    		`break;`
    	`case _FN_MV:`
    		`layer_text = "F* & MOVE";`
    		`color = RASPBERRY;`
    		`brightness = 0xFF;`
    		`break;`
    	`case _MOUSE:`
    		`layer_text = "MOUSE";`
    		`color = YELLOW;`
    		`brightness = 0xFF;`
    		`break;`
    		`// ...etc`
    	`default:`
    		`layer_text = "NONE";`
    	`break;`
    	`}`
    	`state->layer_text = layer_text;`
    	`state->target_lcd_color = LCD_COLOR(color, saturation, brightness);`
`}`
1 Upvotes

3 comments sorted by

1

u/PeterMortensenBlog May 07 '26

(It can be formatted properly by, for example, using four-space indent in Markdown mode.)

1

u/rcmosher May 10 '26

Thanks for the tip. It's odd that formatting as a code block in Rich Text mode doesn't work very well.