/** ****************************************************************************** * @file : parameters.h * @brief : Header for parameters.c file. * This file contains the common defines of the application. ****************************************************************************** * @attention * * Copyright (c) 2025 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __PARAMETERS_H #define __PARAMETERS_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32l4xx_hal.h" #define CONFIG_MAGIC 0xA5A5 #define DEFAULT_ADDR 0x01 #define BROADCAST_ADDR 0xFF /* IAP 标志 */ #define Startup_Normal 0xBBBB ///< run bootloader #define Startup_Update 0xAAAA ///< copy app2 to app1 #define Startup_APP1 0x55BB ///< jump and run app1, /* * sizeof(Config_type) 不能超出2KB * sizeof(Config_type) 采用固定大小, 256 字节, 对于传感器来说足够用了。 最后是IAP 升级需要的信息; 要与前面的参数分开 */ typedef struct { uint16_t magic; uint8_t addr; uint8_t br_index; uint32_t res[58]; uint16_t hw_version; uint16_t devicetype; uint32_t deviceid; uint32_t App1Size; uint32_t App2Size; uint16_t IapFlag; uint16_t res2; }Config_type; extern Config_type *config; extern int Config_Init(void); extern int SaveConfig(void); extern int ResetConfig(void); /* Exported functions prototypes ---------------------------------------------*/ #ifdef __cplusplus } #endif #endif /* __PARAMETERS_H */