This commit is contained in:
Nick Brassel 2024-09-03 17:21:56 +10:00
parent 5917a1dcd5
commit 21756ada63
No known key found for this signature in database
3 changed files with 5 additions and 27 deletions

View File

@ -1,26 +0,0 @@
/* Copyright 2023 Cipulot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "eeprom.h"
#if (EECONFIG_KB_DATA_SIZE) > 0
# define EEPROM_KB_PARTIAL_UPDATE(__struct, __field) eeconfig_update_kb_datablock(&(__struct.__field), (void *)((void *)(EECONFIG_KB_DATABLOCK) + offsetof(typeof(__struct), __field)), sizeof(__struct.__field))
#endif
#if (EECONFIG_USER_DATA_SIZE) > 0
# define EEPROM_USER_PARTIAL_UPDATE(__struct, __field) eeconfig_update_user_datablock(&(__struct.__field), (void *)((void *)(EECONFIG_USER_DATABLOCK) + offsetof(typeof(__struct), __field)), sizeof(__struct.__field))
#endif

View File

@ -63,7 +63,7 @@ void via_config_set_value(uint8_t *data) {
uprintf("# Actuation Mode: Rapid Trigger #\n");
uprintf("#################################\n");
}
EEPROM_KB_PARTIAL_UPDATE(eeprom_ec_config, actuation_mode);
eeconfig_update_kb_datablock_field(eeprom_ec_config, actuation_mode);
break;
}
case id_mode_0_actuation_threshold: {

View File

@ -141,6 +141,8 @@ bool eeconfig_is_kb_datablock_valid(void);
uint32_t eeconfig_read_kb_datablock(void *data, uint32_t offset, uint32_t length);
uint32_t eeconfig_update_kb_datablock(const void *data, uint32_t offset, uint32_t length);
void eeconfig_init_kb_datablock(void);
# define eeconfig_read_kb_datablock_field(__object, __field) eeconfig_read_kb_datablock(&(__object.__field), offsetof(__object, __field), sizeof(__object.__field))
# define eeconfig_update_kb_datablock_field(__object, __field) eeconfig_update_kb_datablock(&(__object.__field), offsetof(__object, __field), sizeof(__object.__field))
#endif // (EECONFIG_KB_DATA_SIZE) > 0
#if (EECONFIG_USER_DATA_SIZE) > 0
@ -148,6 +150,8 @@ bool eeconfig_is_user_datablock_valid(void);
uint32_t eeconfig_read_user_datablock(void *data, uint32_t offset, uint32_t length);
uint32_t eeconfig_update_user_datablock(const void *data, uint32_t offset, uint32_t length);
void eeconfig_init_user_datablock(void);
# define eeconfig_read_user_datablock_field(__object, __field) eeconfig_read_user_datablock(&(__object.__field), offsetof(__object, __field), sizeof(__object.__field))
# define eeconfig_update_user_datablock_field(__object, __field) eeconfig_update_user_datablock(&(__object.__field), offsetof(__object, __field), sizeof(__object.__field))
#endif // (EECONFIG_USER_DATA_SIZE) > 0
// Any "checked" debounce variant used requires implementation of: