sys_api.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 "7020000"
  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. uint32_t controlword;
  34. uint32_t crc;
  35. } SYS_t;
  36. bool SYS_BackupInfo(char *mac, char *serial);
  37. bool SYS_RestoreInfo(SYS_t *settings);
  38. /**
  39. * @brief
  40. * @retval
  41. */
  42. uint32_t SYS_GetCRC(SYS_t *settings);
  43. /**
  44. * @brief Загрузка структуры системных настроек из flash
  45. */
  46. bool SYS_Load(SYS_t *settings);
  47. /**
  48. * @brief Запись структуры настроек во flash
  49. */
  50. bool SYS_Save(SYS_t *settings);
  51. #endif /* SYS_API_H_ */