Non-volatile memory data repository pattern (#24356)
* First batch of eeconfig conversions. * Offset and length for datablocks. * `via`, `dynamic_keymap`. * Fix filename. * Commentary. * wilba leds * satisfaction75 * satisfaction75 * more keyboard whack-a-mole * satisfaction75 * omnikeyish * more whack-a-mole * `generic_features.mk` to automatically pick up nvm repositories * thievery * deferred variable resolve * whitespace * convert api to structs/unions * convert api to structs/unions * convert api to structs/unions * fixups * code-side docs * code size fix * rollback * nvm_xxxxx_erase * Updated location of eeconfig magic numbers so non-EEPROM nvm drivers can use them too. * Fixup build. * Fixup compilation error with encoders. * Build fixes. * Add `via_ci` keymap to onekey to exercise VIA bindings (and thus dynamic keymap et.al.), fixup compilation errors based on preprocessor+sizeof. * Build failure rectification.
This commit is contained in:
parent
c9d62ddc78
commit
2b00b846dc
87 changed files with 1464 additions and 839 deletions
|
@ -16,21 +16,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "eeconfig.h" // for EECONFIG_SIZE
|
||||
#include "action.h"
|
||||
|
||||
// Keyboard level code can change where VIA stores the magic.
|
||||
// The magic is the build date YYMMDD encoded as BCD in 3 bytes,
|
||||
// thus installing firmware built on a different date to the one
|
||||
// already installed can be detected and the EEPROM data is reset.
|
||||
// The only reason this is important is in case EEPROM usage changes
|
||||
// and the EEPROM was not explicitly reset by bootmagic lite.
|
||||
#ifndef VIA_EEPROM_MAGIC_ADDR
|
||||
# define VIA_EEPROM_MAGIC_ADDR (EECONFIG_SIZE)
|
||||
#endif
|
||||
|
||||
#define VIA_EEPROM_LAYOUT_OPTIONS_ADDR (VIA_EEPROM_MAGIC_ADDR + 3)
|
||||
|
||||
// Changing the layout options size after release will invalidate EEPROM,
|
||||
// but this is something that should be set correctly on initial implementation.
|
||||
// 1 byte is enough for most uses (i.e. 8 binary states, or 6 binary + 1 ternary/quaternary )
|
||||
|
@ -46,17 +33,10 @@
|
|||
# define VIA_EEPROM_LAYOUT_OPTIONS_DEFAULT 0x00000000
|
||||
#endif
|
||||
|
||||
// The end of the EEPROM memory used by VIA
|
||||
// By default, dynamic keymaps will start at this if there is no
|
||||
// custom config
|
||||
#define VIA_EEPROM_CUSTOM_CONFIG_ADDR (VIA_EEPROM_LAYOUT_OPTIONS_ADDR + VIA_EEPROM_LAYOUT_OPTIONS_SIZE)
|
||||
|
||||
#ifndef VIA_EEPROM_CUSTOM_CONFIG_SIZE
|
||||
# define VIA_EEPROM_CUSTOM_CONFIG_SIZE 0
|
||||
#endif
|
||||
|
||||
#define VIA_EEPROM_CONFIG_END (VIA_EEPROM_CUSTOM_CONFIG_ADDR + VIA_EEPROM_CUSTOM_CONFIG_SIZE)
|
||||
|
||||
// This is changed only when the command IDs change,
|
||||
// so VIA Configurator can detect compatible firmware.
|
||||
#define VIA_PROTOCOL_VERSION 0x000C
|
||||
|
@ -160,6 +140,11 @@ uint32_t via_get_layout_options(void);
|
|||
void via_set_layout_options(uint32_t value);
|
||||
void via_set_layout_options_kb(uint32_t value);
|
||||
|
||||
#if VIA_EEPROM_CUSTOM_CONFIG_SIZE > 0
|
||||
uint32_t via_read_custom_config(void *buf, uint32_t offset, uint32_t length);
|
||||
uint32_t via_update_custom_config(const void *buf, uint32_t offset, uint32_t length);
|
||||
#endif
|
||||
|
||||
// Used by VIA to tell a device to flash LEDs (or do something else) when that
|
||||
// device becomes the active device being configured, on startup or switching
|
||||
// between devices.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue