Move files to sbc_fw directory to make Arduino IDE shut up

This commit is contained in:
ThePetrovich 2025-09-22 19:57:15 +08:00
parent db8f8408af
commit 63583ce984
11 changed files with 0 additions and 0 deletions

View file

@ -1,50 +0,0 @@
/*
* @file eeprom.cpp
* @brief EEPROM management implementation
*
* Created: 21.09.2025
* Author: ThePetrovich
*
* Copyright YKSA - Sakha Aerospace Systems, LLC.
* See the LICENSE file for details.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "eeprom.h"
#include "config.h"
#include <Arduino.h>
#include <EEPROM.h>
void eeprom_init(void)
{
if (EEPROM.read(EEPROM_MAGIC_ADDR) != EEPROM_MAGIC_VALUE) {
potentiometer_settings_t default_settings = {
.hv_pot = DEFAULT_POT_VALUE, .amp_pot = DEFAULT_POT_VALUE, .det_pot = DEFAULT_POT_VALUE};
eeprom_save_pot_settings(&default_settings);
EEPROM.write(EEPROM_MAGIC_ADDR, EEPROM_MAGIC_VALUE);
}
}
void eeprom_load_pot_settings(potentiometer_settings_t *settings)
{
if (settings == nullptr) {
return;
}
settings->hv_pot = EEPROM.read(EEPROM_POT_HV_ADDR);
settings->amp_pot = EEPROM.read(EEPROM_POT_AMP_ADDR);
settings->det_pot = EEPROM.read(EEPROM_POT_DET_ADDR);
}
void eeprom_save_pot_settings(const potentiometer_settings_t *settings)
{
if (settings == nullptr) {
return;
}
EEPROM.write(EEPROM_POT_HV_ADDR, settings->hv_pot);
EEPROM.write(EEPROM_POT_AMP_ADDR, settings->amp_pot);
EEPROM.write(EEPROM_POT_DET_ADDR, settings->det_pot);
}