可用的文件,全部
This commit is contained in:
42
Core/Bsp/bsp_flash.h
Normal file
42
Core/Bsp/bsp_flash.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file bsp_flash.h
|
||||
* @brief Flash storage driver for saving settings
|
||||
*/
|
||||
|
||||
#ifndef __BSP_FLASH_H
|
||||
#define __BSP_FLASH_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Settings structure - stored in Flash */
|
||||
typedef struct {
|
||||
float fan_threshold; // Temperature threshold
|
||||
uint8_t fan_mode; // Fan mode: 0=manual, 1=auto
|
||||
uint8_t light_state; // Light state: 0=off, 1=on
|
||||
uint8_t valid; // Valid flag (0xAA = valid)
|
||||
} system_settings_t;
|
||||
|
||||
#define SETTINGS_VALID_FLAG 0xAA
|
||||
#define SETTINGS_ADDR 0x0801F800 // Last page of 64KB Flash
|
||||
|
||||
/* Exported functions ---------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Load settings from Flash
|
||||
* @return true if valid settings found
|
||||
*/
|
||||
bool BSP_Flash_LoadSettings(system_settings_t *settings);
|
||||
|
||||
/**
|
||||
* @brief Save settings to Flash
|
||||
* @return true if success
|
||||
*/
|
||||
bool BSP_Flash_SaveSettings(const system_settings_t *settings);
|
||||
|
||||
/**
|
||||
* @brief Reset settings to default
|
||||
*/
|
||||
void BSP_Flash_ResetSettings(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user