summaryrefslogtreecommitdiff
path: root/quantum/nvm
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2025-04-21 22:27:56 +0100
committerGitHub <noreply@github.com>2025-04-21 22:27:56 +0100
commitc7cb7ba9765b35930a26ec247e362615ffd10ed2 (patch)
treebbab7782a3c1937f69a8c105dc06cfa1b7f54346 /quantum/nvm
parentec324af22eddff1f89f33a30c77a678b111c420c (diff)
Implement connection keycode logic (#25176)
Diffstat (limited to 'quantum/nvm')
-rw-r--r--quantum/nvm/eeprom/nvm_eeconfig.c13
-rw-r--r--quantum/nvm/eeprom/nvm_eeprom_eeconfig_internal.h2
-rw-r--r--quantum/nvm/nvm_eeconfig.h6
3 files changed, 21 insertions, 0 deletions
diff --git a/quantum/nvm/eeprom/nvm_eeconfig.c b/quantum/nvm/eeprom/nvm_eeconfig.c
index d6c388f3bc..d9495d2753 100644
--- a/quantum/nvm/eeprom/nvm_eeconfig.c
+++ b/quantum/nvm/eeprom/nvm_eeconfig.c
@@ -41,6 +41,10 @@
41# include "haptic.h" 41# include "haptic.h"
42#endif 42#endif
43 43
44#ifdef CONNECTION_ENABLE
45# include "connection.h"
46#endif
47
44void nvm_eeconfig_erase(void) { 48void nvm_eeconfig_erase(void) {
45#ifdef EEPROM_DRIVER 49#ifdef EEPROM_DRIVER
46 eeprom_driver_format(false); 50 eeprom_driver_format(false);
@@ -196,6 +200,15 @@ void nvm_eeconfig_update_haptic(const haptic_config_t *haptic_config) {
196} 200}
197#endif // HAPTIC_ENABLE 201#endif // HAPTIC_ENABLE
198 202
203#ifdef CONNECTION_ENABLE
204void nvm_eeconfig_read_connection(connection_config_t *config) {
205 config->raw = eeprom_read_byte(EECONFIG_CONNECTION);
206}
207void nvm_eeconfig_update_connection(const connection_config_t *config) {
208 eeprom_update_byte(EECONFIG_CONNECTION, config->raw);
209}
210#endif // CONNECTION_ENABLE
211
199bool nvm_eeconfig_read_handedness(void) { 212bool nvm_eeconfig_read_handedness(void) {
200 return !!eeprom_read_byte(EECONFIG_HANDEDNESS); 213 return !!eeprom_read_byte(EECONFIG_HANDEDNESS);
201} 214}
diff --git a/quantum/nvm/eeprom/nvm_eeprom_eeconfig_internal.h b/quantum/nvm/eeprom/nvm_eeprom_eeconfig_internal.h
index 6efbf9480b..41b76f1f65 100644
--- a/quantum/nvm/eeprom/nvm_eeprom_eeconfig_internal.h
+++ b/quantum/nvm/eeprom/nvm_eeprom_eeconfig_internal.h
@@ -27,6 +27,7 @@ typedef struct PACKED {
27 }; 27 };
28 uint32_t haptic; 28 uint32_t haptic;
29 uint8_t rgblight_ext; 29 uint8_t rgblight_ext;
30 uint8_t connection;
30} eeprom_core_t; 31} eeprom_core_t;
31 32
32/* EEPROM parameter address */ 33/* EEPROM parameter address */
@@ -46,6 +47,7 @@ typedef struct PACKED {
46#define EECONFIG_RGB_MATRIX (uint64_t *)(offsetof(eeprom_core_t, rgb_matrix)) 47#define EECONFIG_RGB_MATRIX (uint64_t *)(offsetof(eeprom_core_t, rgb_matrix))
47#define EECONFIG_HAPTIC (uint32_t *)(offsetof(eeprom_core_t, haptic)) 48#define EECONFIG_HAPTIC (uint32_t *)(offsetof(eeprom_core_t, haptic))
48#define EECONFIG_RGBLIGHT_EXTENDED (uint8_t *)(offsetof(eeprom_core_t, rgblight_ext)) 49#define EECONFIG_RGBLIGHT_EXTENDED (uint8_t *)(offsetof(eeprom_core_t, rgblight_ext))
50#define EECONFIG_CONNECTION (uint8_t *)(offsetof(eeprom_core_t, connection))
49 51
50// Size of EEPROM being used for core data storage 52// Size of EEPROM being used for core data storage
51#define EECONFIG_BASE_SIZE ((uint8_t)sizeof(eeprom_core_t)) 53#define EECONFIG_BASE_SIZE ((uint8_t)sizeof(eeprom_core_t))
diff --git a/quantum/nvm/nvm_eeconfig.h b/quantum/nvm/nvm_eeconfig.h
index 131f61d534..40827361ca 100644
--- a/quantum/nvm/nvm_eeconfig.h
+++ b/quantum/nvm/nvm_eeconfig.h
@@ -87,6 +87,12 @@ void nvm_eeconfig_read_haptic(haptic_config_t *haptic_c
87void nvm_eeconfig_update_haptic(const haptic_config_t *haptic_config); 87void nvm_eeconfig_update_haptic(const haptic_config_t *haptic_config);
88#endif // HAPTIC_ENABLE 88#endif // HAPTIC_ENABLE
89 89
90#ifdef CONNECTION_ENABLE
91typedef union connection_config_t connection_config_t;
92void nvm_eeconfig_read_connection(connection_config_t *config);
93void nvm_eeconfig_update_connection(const connection_config_t *config);
94#endif // CONNECTION_ENABLE
95
90bool nvm_eeconfig_read_handedness(void); 96bool nvm_eeconfig_read_handedness(void);
91void nvm_eeconfig_update_handedness(bool val); 97void nvm_eeconfig_update_handedness(bool val);
92 98