sys_api.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef SYS_API_H_
  2. #define SYS_API_H_
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #define SN_LEN 7
  6. #define PROD_LEN 20
  7. #define TS_LEN 16 // Статус тестирования
  8. #define SN_DEFAULT "0000001"
  9. // Cтруктура системных настроек
  10. typedef struct
  11. {
  12. char sn[SN_LEN]; // Серийный номер
  13. char prod_date[PROD_LEN]; // Дата производства
  14. char test_state[TS_LEN]; // Статус тестирования
  15. uint32_t control_word; // Контрольное слово
  16. uint32_t crc; // CRC
  17. } sys_settings_t;
  18. bool SYS_BackupInfo(char *mac, char *serial);
  19. bool SYS_RestoreInfo(sys_settings_t *settings);
  20. //
  21. uint32_t SYS_GetCRC(sys_settings_t *settings);
  22. // Загрузка структуры системных настроек из flash
  23. bool sys_settings_load(sys_settings_t *settings);
  24. // Запись структуры настроек во flash
  25. bool sys_save(sys_settings_t *settings);
  26. //
  27. void sys_print(sys_settings_t *settings);
  28. // Очистить сектор системных настроек
  29. void sys_clear(void);
  30. #endif /* SYS_API_H_ */