user_config.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef __USER_CONFIG_H__
  2. #define __USER_CONFIG_H__
  3. #include "define.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #ifndef DEV_LIC_SIZE
  8. #define DEV_LIC_SIZE 16
  9. #endif
  10. #ifndef DEV_ADDR_SIZE
  11. #define DEV_ADDR_SIZE 6
  12. #endif
  13. #define HEAD_VALUE 0xEFAA
  14. #define UART_BAUD_SIZE 8
  15. #define CALIB_WEIGHT_SIZE 10
  16. #define WEIGHT_RANGE_DEFAULT 350000
  17. typedef enum{
  18. CAN_BAUD_NULL = 0,
  19. CAN_BAUD_100 = 100,
  20. CAN_BAUD_150 = 150,
  21. CAN_BAUD_200 = 200,
  22. CAN_BAUD_250 = 250,
  23. CAN_BAUD_300 = 300,
  24. CAN_BAUD_400 = 400,
  25. CAN_BAUD_500 = 500,
  26. CAN_BAUD_666 = 666,
  27. CAN_BAUD_800 = 800,
  28. CAN_BAUD_1000 = 1000
  29. }can_baud_e;
  30. typedef struct{
  31. uint16_t head;
  32. can_baud_e can_baud;
  33. }__attribute__((packed)) user_config_param_s;
  34. #define USER_CONFIG_STAT_DEFAULT_CONFIG \
  35. { \
  36. .head = HEAD_VALUE, \
  37. .can_baud = CAN_BAUD_1000, \
  38. }
  39. void User_Config_Read_Config(void);
  40. void User_Config_Write_Config(void);
  41. void user_config_init(void);
  42. bool check_can_baud(uint32_t baud);
  43. void set_user_config_param_init(user_config_param_s *param);
  44. void FLASH_read(uint32_t addr, uint8_t *pData, uint32_t len);
  45. bool user_config_save_can_baud(uint32_t baud);
  46. extern user_config_param_s user_config_param;
  47. extern uint32_t ttl_baud[UART_BAUD_SIZE];
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif // USER_CONFIG_H__
  52. /** @} */