sys_api.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #define MB_PASSWORD (uint16_t)1234
  10. // Cтруктура системных настроек
  11. typedef struct
  12. {
  13. char sn[SN_LEN]; // Серийный номер
  14. char prod_date[PROD_LEN]; // Дата производства
  15. char test_state[TS_LEN]; // Статус тестирования
  16. uint32_t control_word; // Контрольное слово
  17. uint32_t crc; // CRC
  18. } sys_settings_t;
  19. bool SYS_BackupInfo(char *mac, char *serial);
  20. bool SYS_RestoreInfo(sys_settings_t *settings);
  21. //
  22. uint32_t SYS_GetCRC(sys_settings_t *settings);
  23. // Загрузка структуры системных настроек из flash
  24. bool sys_settings_load(sys_settings_t *settings);
  25. // Запись структуры настроек во flash
  26. bool sys_save(sys_settings_t *settings);
  27. //
  28. void sys_print(sys_settings_t *settings);
  29. // Очистить сектор системных настроек
  30. void sys_clear(void);
  31. #endif /* SYS_API_H_ */