Migrate remaining VIA_EEPROM_CUSTOM_CONFIG_SIZE to EECONFIG_KB_DATA_SIZE (#26321)

This commit is contained in:
Joel Challis
2026-08-20 00:35:50 +01:00
committed by GitHub
parent 65315a8315
commit 37142b6b8f
34 changed files with 60 additions and 164 deletions
+1 -3
View File
@@ -72,6 +72,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32
#define EECONFIG_KB_DATA_SIZE 32
+1 -3
View File
@@ -72,6 +72,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32
#define EECONFIG_KB_DATA_SIZE 32
+1 -3
View File
@@ -69,6 +69,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32
#define EECONFIG_KB_DATA_SIZE 32
+1 -3
View File
@@ -70,6 +70,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32
#define EECONFIG_KB_DATA_SIZE 32
+1 -3
View File
@@ -92,6 +92,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32
#define EECONFIG_KB_DATA_SIZE 32
+1 -3
View File
@@ -76,6 +76,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32
#define EECONFIG_KB_DATA_SIZE 32
+1 -3
View File
@@ -70,8 +70,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111000000000001
#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b1111111111111111
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
#endif
+1 -3
View File
@@ -75,7 +75,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define RGB_BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111100000000001
# define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b1111111111111111
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
# define EECONFIG_KB_DATA_SIZE 31
#endif
@@ -85,6 +85,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
@@ -85,6 +85,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
@@ -68,6 +68,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 51
#define EECONFIG_KB_DATA_SIZE 51
@@ -69,6 +69,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
@@ -85,6 +85,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
@@ -69,6 +69,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
@@ -69,6 +69,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
@@ -20,6 +20,4 @@
// NOTE: M6-A doesn't use RGB backlight, but we keep this
// consistent with M6-B which does.
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 43
#define EECONFIG_KB_DATA_SIZE 43
@@ -65,6 +65,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 43
#define EECONFIG_KB_DATA_SIZE 43
@@ -87,6 +87,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define EECONFIG_KB_DATA_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -70,6 +70,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
+1 -3
View File
@@ -70,6 +70,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
+1 -3
View File
@@ -71,6 +71,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define EECONFIG_KB_DATA_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define EECONFIG_KB_DATA_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define EECONFIG_KB_DATA_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define EECONFIG_KB_DATA_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 000
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define EECONFIG_KB_DATA_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define EECONFIG_KB_DATA_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96
+5 -39
View File
@@ -24,51 +24,19 @@
#include "keyboards/wilba_tech/wt_mono_backlight.h"
#endif // MONO_BACKLIGHT_ENABLED
#ifndef VIA_ENABLE
#include "via.h"
#include "eeprom.h"
#include "version.h" // for QMK_BUILDDATE used in EEPROM magic
#endif
// Called from via_init() if VIA_ENABLE
// Called from matrix_init_kb() if not VIA_ENABLE
void wt_main_init(void)
{
// This checks both an EEPROM reset (from bootmagic lite, keycodes)
// and also firmware build date (from via_eeprom_is_valid())
if (eeconfig_is_enabled()) {
void keyboard_post_init_kb(void) {
#if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
backlight_config_load();
#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
} else {
#if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
// If the EEPROM has not been saved before, or is out of date,
// save the default values to the EEPROM. Default values
// come from construction of the backlight_config instance.
backlight_config_save();
#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
// Must be called after quantum_init
backlight_config_load();
// DO NOT set EEPROM valid here, let caller do this
}
#if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
// Initialize LED drivers for backlight.
backlight_init_drivers();
backlight_timer_init();
backlight_timer_enable();
#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
}
void matrix_init_kb(void)
{
// If VIA is disabled, we still need to load backlight settings.
// Call via_init_kb() the same way as via_init_kb() does.
#ifndef VIA_ENABLE
wt_main_init();
#endif // VIA_ENABLE
matrix_init_user();
keyboard_post_init_user();
}
void matrix_scan_kb(void)
@@ -106,9 +74,7 @@ void suspend_wakeup_init_kb(void)
// Moving this to the bottom of this source file is a workaround
// for an intermittent compiler error for Atmel compiler.
#ifdef VIA_ENABLE
void via_init_kb(void) {
wt_main_init();
}
# include "via.h"
void via_custom_value_command_kb(uint8_t *data, uint8_t length) {
uint8_t *command_id = &(data[0]);
+12 -16
View File
@@ -23,16 +23,8 @@
#include "i2c_master.h"
#include "host.h"
#include "progmem.h"
#include "eeprom.h"
#include "nvm_eeprom_eeconfig_internal.h" // expose EEPROM addresses, no appetite to move legacy/deprecated code to nvm
#include "nvm_eeprom_via_internal.h" // expose EEPROM addresses, no appetite to move legacy/deprecated code to nvm
#include "via.h" // uses EEPROM address, lighting value IDs
#define MONO_BACKLIGHT_CONFIG_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR)
#if VIA_EEPROM_CUSTOM_CONFIG_SIZE == 0
#error VIA_EEPROM_CUSTOM_CONFIG_SIZE was not defined to store backlight_config struct
#endif
#include "eeconfig.h"
#include "compiler_support.h"
#include "drivers/led/issi/is31fl3736-mono.h"
@@ -51,6 +43,8 @@ backlight_config g_config = {
.color_1 = MONO_BACKLIGHT_COLOR_1,
};
STATIC_ASSERT(sizeof(backlight_config) == EECONFIG_KB_DATA_SIZE, "Mismatch in keyboard EECONFIG stored data");
bool g_suspend_state = false;
// Global tick at 20 Hz
@@ -341,14 +335,16 @@ void backlight_config_get_value( uint8_t *data )
}
}
void backlight_config_load(void)
{
eeprom_read_block( &g_config, ((void*)MONO_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) );
void eeconfig_init_kb_datablock(void) {
backlight_config_save();
}
void backlight_config_save(void)
{
eeprom_update_block( &g_config, ((void*)MONO_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) );
void backlight_config_load(void) {
eeconfig_read_kb_datablock( &g_config, 0, sizeof(backlight_config) );
}
void backlight_config_save(void) {
eeconfig_update_kb_datablock( &g_config, 0, sizeof(backlight_config) );
}
void backlight_update_pwm_buffers(void)
+12 -16
View File
@@ -64,16 +64,8 @@
#include "progmem.h"
#include "quantum/color.h"
#include "eeprom.h"
#include "nvm_eeprom_eeconfig_internal.h" // expose EEPROM addresses, no appetite to move legacy/deprecated code to nvm
#include "nvm_eeprom_via_internal.h" // expose EEPROM addresses, no appetite to move legacy/deprecated code to nvm
#include "via.h" // uses EEPROM address, lighting value IDs
#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR (VIA_EEPROM_CUSTOM_CONFIG_ADDR)
#if VIA_EEPROM_CUSTOM_CONFIG_SIZE == 0
#error VIA_EEPROM_CUSTOM_CONFIG_SIZE was not defined to store backlight_config struct
#endif
#include "eeconfig.h"
#include "compiler_support.h"
#if defined(RGB_BACKLIGHT_M6_B)
#include "drivers/led/issi/is31fl3218.h"
@@ -140,6 +132,8 @@ backlight_config g_config = {
#endif
};
STATIC_ASSERT(sizeof(backlight_config) == EECONFIG_KB_DATA_SIZE, "Mismatch in keyboard EECONFIG stored data");
bool g_suspend_state = false;
// Global tick at 20 Hz
@@ -2097,14 +2091,16 @@ void backlight_config_set_alphas_mods( uint16_t *alphas_mods )
backlight_config_save();
}
void backlight_config_load(void)
{
eeprom_read_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) );
void eeconfig_init_kb_datablock(void) {
backlight_config_save();
}
void backlight_config_save(void)
{
eeprom_update_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) );
void backlight_config_load(void) {
eeconfig_read_kb_datablock( &g_config, 0, sizeof(backlight_config) );
}
void backlight_config_save(void) {
eeconfig_update_kb_datablock( &g_config, 0, sizeof(backlight_config) );
}
void backlight_init_drivers(void)
+1 -3
View File
@@ -84,6 +84,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
+1 -3
View File
@@ -84,6 +84,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31
+1 -3
View File
@@ -100,6 +100,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#define EECONFIG_KB_DATA_SIZE 31