parameters.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. ******************************************************************************
  3. * @file : parameters.h
  4. * @brief : Header for parameters.c file.
  5. * This file contains the common defines of the application.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2025 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef __PARAMETERS_H
  20. #define __PARAMETERS_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32l4xx_hal.h"
  26. #define CONFIG_MAGIC 0xA5A5
  27. #define DEFAULT_ADDR 0x01
  28. #define BROADCAST_ADDR 0xFF
  29. /* IAP 标志 */
  30. #define Startup_Normal 0xBBBB ///< run bootloader
  31. #define Startup_Update 0xAAAA ///< copy app2 to app1
  32. #define Startup_APP1 0x55BB ///< jump and run app1,
  33. /*
  34. * sizeof(Config_type) 不能超出2KB
  35. * sizeof(Config_type) 采用固定大小, 256 字节, 对于传感器来说足够用了。 最后是IAP 升级需要的信息; 要与前面的参数分开
  36. */
  37. typedef struct
  38. {
  39. uint16_t magic;
  40. uint8_t addr;
  41. uint8_t br_index;
  42. uint32_t res[58];
  43. uint16_t hw_version;
  44. uint16_t devicetype;
  45. uint32_t deviceid;
  46. uint32_t App1Size;
  47. uint32_t App2Size;
  48. uint16_t IapFlag;
  49. uint16_t res2;
  50. }Config_type;
  51. extern Config_type *config;
  52. extern int Config_Init(void);
  53. extern int SaveConfig(void);
  54. extern int ResetConfig(void);
  55. /* Exported functions prototypes ---------------------------------------------*/
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* __PARAMETERS_H */