sys_api.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * sys_api.h
  3. *
  4. * Created on: 12.03.2017
  5. * Author: jesstr
  6. */
  7. #ifndef SYS_API_H_
  8. #define SYS_API_H_
  9. #include <stdbool.h>
  10. #include <stdint.h>
  11. #ifndef DEVICE_MAC
  12. #define DEVICE_MAC "EC-4C-4D-00-C7-FF"
  13. #endif
  14. #ifndef DEVICE_SERIAL
  15. #define DEVICE_SERIAL "7023000"
  16. #endif
  17. #define SYS_MAC DEVICE_MAC
  18. #define SYS_SERIAL DEVICE_SERIAL
  19. #define SYS_CUSTOMER "Rotek"
  20. #define MAC_LEN 18
  21. #define SER_LEN 16
  22. #define CUST_LEN 16
  23. #define PROD_LEN 20
  24. /**
  25. * @brief Cтруктура системных настроек
  26. */
  27. typedef struct
  28. {
  29. char mac[MAC_LEN]; // MAC адрес
  30. char serial[SER_LEN]; // Серийный номер
  31. char customer[CUST_LEN]; // Заказчик
  32. char proddate[PROD_LEN]; // Дата производства
  33. char testState[16];
  34. uint32_t controlword;
  35. uint32_t crc;
  36. } SYS_t;
  37. bool SYS_BackupInfo(char *mac, char *serial);
  38. bool SYS_RestoreInfo(SYS_t *settings);
  39. /**
  40. * @brief
  41. * @retval
  42. */
  43. uint32_t SYS_GetCRC(SYS_t *settings);
  44. /**
  45. * @brief Загрузка структуры системных настроек из flash
  46. */
  47. bool SYS_Load(SYS_t *settings);
  48. /**
  49. * @brief Запись структуры настроек во flash
  50. */
  51. bool SYS_Save(SYS_t *settings);
  52. #endif /* SYS_API_H_ */