mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-07 19:02:35 +02:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
#include "eeprom.h"
|
||||
#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*/
|
||||
#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) {
|
||||
#ifdef VIA_ENABLE
|
||||
return via_read_custom_config(data, offset, length);
|
||||
#else
|
||||
return eeconfig_read_kb_datablock(data, offset, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
custom_config_load();
|
||||
|
||||
/*
|
||||
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.
|
||||
@@ -305,14 +303,8 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void custom_config_reset(void){
|
||||
for(int i = 0; i < VIA_EEPROM_CUSTOM_CONFIG_SIZE; ++i) {
|
||||
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_reset(void) {
|
||||
eeconfig_init_kb_datablock();
|
||||
}
|
||||
|
||||
void custom_config_load(void){
|
||||
@@ -322,40 +314,20 @@ void custom_config_load(void){
|
||||
#endif
|
||||
}
|
||||
|
||||
// Called from via_init() if VIA_ENABLE
|
||||
// Called from matrix_init_kb() if not VIA_ENABLE
|
||||
void satisfaction_core_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()) {
|
||||
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 eeconfig_init_kb_datablock(void) {
|
||||
uint8_t default_data[EECONFIG_KB_DATA_SIZE] = { 0 };
|
||||
|
||||
default_data[EEPROM_ENABLED_ENCODER_MODES_OFFSET] = 0x1F;
|
||||
|
||||
eeconfig_update_kb_datablock(default_data, 0, sizeof(default_data));
|
||||
}
|
||||
|
||||
void matrix_init_kb(void)
|
||||
{
|
||||
#ifndef VIA_ENABLE
|
||||
satisfaction_core_init();
|
||||
#endif // VIA_ENABLE
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
rtcGetTime(&RTCD1, &last_timespec);
|
||||
matrix_init_user();
|
||||
oled_request_wakeup();
|
||||
}
|
||||
|
||||
#ifdef VIA_ENABLE
|
||||
void via_init_kb(void) {
|
||||
satisfaction_core_init();
|
||||
}
|
||||
#endif // VIA_ENABLE
|
||||
|
||||
void housekeeping_task_kb(void) {
|
||||
rtcGetTime(&RTCD1, &last_timespec);
|
||||
uint16_t minutes_since_midnight = last_timespec.millisecond / 1000 / 60;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <hal.h>
|
||||
|
||||
#include "via.h" // only for EEPROM address
|
||||
#include "satisfaction_keycodes.h"
|
||||
|
||||
#define EEPROM_ENABLED_ENCODER_MODES_OFFSET 0
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keycodes.h"
|
||||
|
||||
enum my_keycodes {
|
||||
ENC_PRESS = QK_KB_0,
|
||||
CLOCK_SET,
|
||||
|
||||
@@ -34,15 +34,8 @@
|
||||
// OLED timeout reimplemented in the keyboard-specific code
|
||||
#define CUSTOM_OLED_TIMEOUT 60000
|
||||
|
||||
// Custom config starts after VIA's EEPROM usage,
|
||||
// dynamic keymaps start after this.
|
||||
// Custom config Usage:
|
||||
// 1 for enabled encoder modes (1 byte)
|
||||
// 1 for OLED default mode (1 byte)
|
||||
// 6 for 3x custom encoder settings, left, right, and press (18 bytes)
|
||||
#define VIA_EEPROM_CUSTOM_CONFIG_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
|
||||
#define EECONFIG_KB_DATA_SIZE 20
|
||||
|
||||
@@ -32,18 +32,11 @@
|
||||
// OLED timeout reimplemented in the keyboard-specific code
|
||||
#define CUSTOM_OLED_TIMEOUT 60000
|
||||
|
||||
// Custom config starts after VIA's EEPROM usage,
|
||||
// dynamic keymaps start after this.
|
||||
// Custom config Usage:
|
||||
// 1 for enabled encoder modes (1 byte)
|
||||
// 1 for OLED default mode (1 byte)
|
||||
// 6 for 3x custom encoder settings, left, right, and press (18 bytes)
|
||||
#define VIA_EEPROM_CUSTOM_CONFIG_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
|
||||
#define EECONFIG_KB_DATA_SIZE 20
|
||||
|
||||
// VIA lighting is handled by the keyboard-level code
|
||||
#define VIA_CUSTOM_LIGHTING_ENABLE
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user