settings.h 785 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef __SETTINGS_H
  2. #define __SETTINGS_H
  3. #include "stm32g4xx_hal.h"
  4. #include <stdbool.h>
  5. // общая структура настроек
  6. #pragma pack(push, 4)
  7. typedef struct
  8. {
  9. char fw_version[20];
  10. uint32_t factor_1;
  11. uint32_t factor_2;
  12. bool revers;
  13. } settings_t;
  14. #pragma pack(pop)
  15. //
  16. void settings_crc_init(void);
  17. //
  18. void settings_load(void);
  19. //
  20. bool settings_save(void);
  21. //
  22. bool save_settings_attributes(uint16_t page);
  23. //
  24. bool settings_erase_page(uint16_t page);
  25. //
  26. uint32_t settings_get_bank(uint32_t addr);
  27. //
  28. void settings_set_def(void);
  29. //
  30. uint32_t settings_get_crc(void);
  31. //
  32. void settings_read_from_flash(uint8_t *data, uint32_t size);
  33. //
  34. void settings_test(void);
  35. extern settings_t settings;
  36. #endif /* #ifndef __SETTINGS_H */