Merge remote-tracking branch 'origin/develop' into xap

This commit is contained in:
QMK Bot
2026-08-19 23:36:22 +00:00
39 changed files with 79 additions and 224 deletions
@@ -18,6 +18,10 @@
#include "eeprom.h" #include "eeprom.h"
#include "version.h" // for QMK_BUILDDATE used in EEPROM magic #include "version.h" // for QMK_BUILDDATE used in EEPROM magic
#ifdef VIA_ENABLE
# include "via.h"
#endif
/* Artificial delay added to get media keys to work in the encoder*/ /* Artificial delay added to get media keys to work in the encoder*/
#define MEDIA_KEY_DELAY 10 #define MEDIA_KEY_DELAY 10
@@ -54,22 +58,16 @@ void board_init(void) {
} }
uint32_t read_custom_config(void *data, uint32_t offset, uint32_t length) { uint32_t read_custom_config(void *data, uint32_t offset, uint32_t length) {
#ifdef VIA_ENABLE
return via_read_custom_config(data, offset, length);
#else
return eeconfig_read_kb_datablock(data, offset, length); return eeconfig_read_kb_datablock(data, offset, length);
#endif
} }
uint32_t write_custom_config(const void *data, uint32_t offset, uint32_t length) { uint32_t write_custom_config(const void *data, uint32_t offset, uint32_t length) {
#ifdef VIA_ENABLE
return via_update_custom_config(data, offset, length);
#else
return eeconfig_update_kb_datablock(data, offset, length); return eeconfig_update_kb_datablock(data, offset, length);
#endif
} }
void keyboard_post_init_kb(void) { void keyboard_post_init_kb(void) {
custom_config_load();
/* /*
This is a workaround to some really weird behavior This is a workaround to some really weird behavior
Without this code, the OLED will turn on, but not when you initially plug the keyboard in. Without this code, the OLED will turn on, but not when you initially plug the keyboard in.
@@ -305,14 +303,8 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
return true; return true;
} }
void custom_config_reset(void){ void custom_config_reset(void) {
for(int i = 0; i < VIA_EEPROM_CUSTOM_CONFIG_SIZE; ++i) { eeconfig_init_kb_datablock();
uint8_t dummy = 0;
write_custom_config(&dummy, i, 1);
}
uint8_t encoder_modes = 0x1F;
write_custom_config(&encoder_modes, EEPROM_ENABLED_ENCODER_MODES_OFFSET, 1);
} }
void custom_config_load(void){ void custom_config_load(void){
@@ -322,40 +314,20 @@ void custom_config_load(void){
#endif #endif
} }
// Called from via_init() if VIA_ENABLE void eeconfig_init_kb_datablock(void) {
// Called from matrix_init_kb() if not VIA_ENABLE uint8_t default_data[EECONFIG_KB_DATA_SIZE] = { 0 };
void satisfaction_core_init(void)
{ default_data[EEPROM_ENABLED_ENCODER_MODES_OFFSET] = 0x1F;
// This checks both an EEPROM reset (from bootmagic lite, keycodes)
// and also firmware build date (from via_eeprom_is_valid()) eeconfig_update_kb_datablock(default_data, 0, sizeof(default_data));
if (eeconfig_is_enabled()) {
custom_config_load();
} else {
#ifdef DYNAMIC_KEYMAP_ENABLE
// Reset the custom stuff
custom_config_reset();
#endif
// DO NOT set EEPROM valid here, let caller do this
}
} }
void matrix_init_kb(void) void matrix_init_kb(void) {
{
#ifndef VIA_ENABLE
satisfaction_core_init();
#endif // VIA_ENABLE
rtcGetTime(&RTCD1, &last_timespec); rtcGetTime(&RTCD1, &last_timespec);
matrix_init_user(); matrix_init_user();
oled_request_wakeup(); oled_request_wakeup();
} }
#ifdef VIA_ENABLE
void via_init_kb(void) {
satisfaction_core_init();
}
#endif // VIA_ENABLE
void housekeeping_task_kb(void) { void housekeeping_task_kb(void) {
rtcGetTime(&RTCD1, &last_timespec); rtcGetTime(&RTCD1, &last_timespec);
uint16_t minutes_since_midnight = last_timespec.millisecond / 1000 / 60; uint16_t minutes_since_midnight = last_timespec.millisecond / 1000 / 60;
@@ -8,7 +8,6 @@
#include <hal.h> #include <hal.h>
#include "via.h" // only for EEPROM address
#include "satisfaction_keycodes.h" #include "satisfaction_keycodes.h"
#define EEPROM_ENABLED_ENCODER_MODES_OFFSET 0 #define EEPROM_ENABLED_ENCODER_MODES_OFFSET 0
@@ -3,6 +3,8 @@
#pragma once #pragma once
#include "keycodes.h"
enum my_keycodes { enum my_keycodes {
ENC_PRESS = QK_KB_0, ENC_PRESS = QK_KB_0,
CLOCK_SET, CLOCK_SET,
+1 -8
View File
@@ -34,15 +34,8 @@
// OLED timeout reimplemented in the keyboard-specific code // OLED timeout reimplemented in the keyboard-specific code
#define CUSTOM_OLED_TIMEOUT 60000 #define CUSTOM_OLED_TIMEOUT 60000
// Custom config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
// Custom config Usage: // Custom config Usage:
// 1 for enabled encoder modes (1 byte) // 1 for enabled encoder modes (1 byte)
// 1 for OLED default mode (1 byte) // 1 for OLED default mode (1 byte)
// 6 for 3x custom encoder settings, left, right, and press (18 bytes) // 6 for 3x custom encoder settings, left, right, and press (18 bytes)
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 20 #define EECONFIG_KB_DATA_SIZE 20
// And if VIA isn't enabled, fall back to using standard QMK for configuration
#ifndef VIA_ENABLE
#define EECONFIG_KB_DATA_SIZE VIA_EEPROM_CUSTOM_CONFIG_SIZE
#endif
@@ -32,18 +32,11 @@
// OLED timeout reimplemented in the keyboard-specific code // OLED timeout reimplemented in the keyboard-specific code
#define CUSTOM_OLED_TIMEOUT 60000 #define CUSTOM_OLED_TIMEOUT 60000
// Custom config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
// Custom config Usage: // Custom config Usage:
// 1 for enabled encoder modes (1 byte) // 1 for enabled encoder modes (1 byte)
// 1 for OLED default mode (1 byte) // 1 for OLED default mode (1 byte)
// 6 for 3x custom encoder settings, left, right, and press (18 bytes) // 6 for 3x custom encoder settings, left, right, and press (18 bytes)
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 20 #define EECONFIG_KB_DATA_SIZE 20
// And if VIA isn't enabled, fall back to using standard QMK for configuration
#ifndef VIA_ENABLE
#define EECONFIG_KB_DATA_SIZE VIA_EEPROM_CUSTOM_CONFIG_SIZE
#endif
// VIA lighting is handled by the keyboard-level code // VIA lighting is handled by the keyboard-level code
#define VIA_CUSTOM_LIGHTING_ENABLE #define VIA_CUSTOM_LIGHTING_ENABLE
+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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 32
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 32
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 32
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 32
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 32
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 32
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_3 0b0111000000000001
#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b1111111111111111 #define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b1111111111111111
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#endif #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_3 0b0111100000000001
# define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b1111111111111111 # define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b1111111111111111
// Backlight config starts after VIA's EEPROM usage, # define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
#endif #endif
@@ -85,6 +85,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
@@ -85,6 +85,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
@@ -68,6 +68,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 51
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 51
@@ -69,6 +69,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
@@ -85,6 +85,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
@@ -69,6 +69,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
@@ -69,6 +69,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
@@ -20,6 +20,4 @@
// NOTE: M6-A doesn't use RGB backlight, but we keep this // NOTE: M6-A doesn't use RGB backlight, but we keep this
// consistent with M6-B which does. // consistent with M6-B which does.
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 43
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 43
@@ -65,6 +65,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 43
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 43
@@ -87,6 +87,4 @@
#define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } #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 } #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3) // the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0 #define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 7
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96 #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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3) // the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0 #define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 7
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96 #define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3) // the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0 #define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 7
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96 #define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3) // the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0 #define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 7
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96 #define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3) // the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0 #define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 7
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96 #define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3) // the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 000 #define MONO_BACKLIGHT_EFFECT_SPEED 000
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 7
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96 #define IS31FL3736_LED_COUNT 96
+1 -3
View File
@@ -53,9 +53,7 @@
// the default effect speed (0-3) // the default effect speed (0-3)
#define MONO_BACKLIGHT_EFFECT_SPEED 0 #define MONO_BACKLIGHT_EFFECT_SPEED 0
// Backlight config starts after VIA's EEPROM usage, #define EECONFIG_KB_DATA_SIZE 7
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 7
#define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND #define IS31FL3736_I2C_ADDRESS_1 IS31FL3736_I2C_ADDRESS_GND_GND
#define IS31FL3736_LED_COUNT 96 #define IS31FL3736_LED_COUNT 96
+5 -39
View File
@@ -24,51 +24,19 @@
#include "keyboards/wilba_tech/wt_mono_backlight.h" #include "keyboards/wilba_tech/wt_mono_backlight.h"
#endif // MONO_BACKLIGHT_ENABLED #endif // MONO_BACKLIGHT_ENABLED
#ifndef VIA_ENABLE void keyboard_post_init_kb(void) {
#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()) {
#if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED #if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
backlight_config_load(); // Must be called after quantum_init
#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED backlight_config_load();
} 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
// DO NOT set EEPROM valid here, let caller do this
}
#if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
// Initialize LED drivers for backlight. // Initialize LED drivers for backlight.
backlight_init_drivers(); backlight_init_drivers();
backlight_timer_init(); backlight_timer_init();
backlight_timer_enable(); backlight_timer_enable();
#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED #endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
}
void matrix_init_kb(void) keyboard_post_init_user();
{
// 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();
} }
void matrix_scan_kb(void) 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 // Moving this to the bottom of this source file is a workaround
// for an intermittent compiler error for Atmel compiler. // for an intermittent compiler error for Atmel compiler.
#ifdef VIA_ENABLE #ifdef VIA_ENABLE
void via_init_kb(void) { # include "via.h"
wt_main_init();
}
void via_custom_value_command_kb(uint8_t *data, uint8_t length) { void via_custom_value_command_kb(uint8_t *data, uint8_t length) {
uint8_t *command_id = &(data[0]); uint8_t *command_id = &(data[0]);
+12 -16
View File
@@ -23,16 +23,8 @@
#include "i2c_master.h" #include "i2c_master.h"
#include "host.h" #include "host.h"
#include "progmem.h" #include "progmem.h"
#include "eeprom.h" #include "eeconfig.h"
#include "compiler_support.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 "drivers/led/issi/is31fl3736-mono.h" #include "drivers/led/issi/is31fl3736-mono.h"
@@ -51,6 +43,8 @@ backlight_config g_config = {
.color_1 = MONO_BACKLIGHT_COLOR_1, .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; bool g_suspend_state = false;
// Global tick at 20 Hz // Global tick at 20 Hz
@@ -341,14 +335,16 @@ void backlight_config_get_value( uint8_t *data )
} }
} }
void backlight_config_load(void) void eeconfig_init_kb_datablock(void) {
{ backlight_config_save();
eeprom_read_block( &g_config, ((void*)MONO_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) );
} }
void backlight_config_save(void) void backlight_config_load(void) {
{ eeconfig_read_kb_datablock( &g_config, 0, sizeof(backlight_config) );
eeprom_update_block( &g_config, ((void*)MONO_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); }
void backlight_config_save(void) {
eeconfig_update_kb_datablock( &g_config, 0, sizeof(backlight_config) );
} }
void backlight_update_pwm_buffers(void) void backlight_update_pwm_buffers(void)
+12 -16
View File
@@ -64,16 +64,8 @@
#include "progmem.h" #include "progmem.h"
#include "quantum/color.h" #include "quantum/color.h"
#include "eeprom.h" #include "eeconfig.h"
#include "compiler_support.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
#if defined(RGB_BACKLIGHT_M6_B) #if defined(RGB_BACKLIGHT_M6_B)
#include "drivers/led/issi/is31fl3218.h" #include "drivers/led/issi/is31fl3218.h"
@@ -140,6 +132,8 @@ backlight_config g_config = {
#endif #endif
}; };
STATIC_ASSERT(sizeof(backlight_config) == EECONFIG_KB_DATA_SIZE, "Mismatch in keyboard EECONFIG stored data");
bool g_suspend_state = false; bool g_suspend_state = false;
// Global tick at 20 Hz // Global tick at 20 Hz
@@ -2097,14 +2091,16 @@ void backlight_config_set_alphas_mods( uint16_t *alphas_mods )
backlight_config_save(); backlight_config_save();
} }
void backlight_config_load(void) void eeconfig_init_kb_datablock(void) {
{ backlight_config_save();
eeprom_read_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) );
} }
void backlight_config_save(void) void backlight_config_load(void) {
{ eeconfig_read_kb_datablock( &g_config, 0, sizeof(backlight_config) );
eeprom_update_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); }
void backlight_config_save(void) {
eeconfig_update_kb_datablock( &g_config, 0, sizeof(backlight_config) );
} }
void backlight_init_drivers(void) 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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_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_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 }
#define RGB_BACKLIGHT_LAYER_3_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, #define EECONFIG_KB_DATA_SIZE 31
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31