settings.h 792 B

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