From 21756ada63412558ef0a99976bbddb4d33e99f7f Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 3 Sep 2024 17:21:56 +1000 Subject: [PATCH] thievery --- keyboards/cipulot/common/eeprom_tools.h | 26 ------------------------- keyboards/cipulot/common/via_ec.c | 2 +- quantum/eeconfig.h | 4 ++++ 3 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 keyboards/cipulot/common/eeprom_tools.h diff --git a/keyboards/cipulot/common/eeprom_tools.h b/keyboards/cipulot/common/eeprom_tools.h deleted file mode 100644 index b38ec69a782..00000000000 --- a/keyboards/cipulot/common/eeprom_tools.h +++ /dev/null @@ -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 . - */ -#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 diff --git a/keyboards/cipulot/common/via_ec.c b/keyboards/cipulot/common/via_ec.c index df45d7704d3..e20fbc69d8f 100644 --- a/keyboards/cipulot/common/via_ec.c +++ b/keyboards/cipulot/common/via_ec.c @@ -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: { diff --git a/quantum/eeconfig.h b/quantum/eeconfig.h index e1459bb262b..8fadbfaf743 100644 --- a/quantum/eeconfig.h +++ b/quantum/eeconfig.h @@ -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: