drv_vkweigher_vls300.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #include "canard.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif // __cplusplus
  6. #define VK_WEIGHER_VLS300_DEV_NAME "weigher"
  7. int vkWeigher_Vls300_OnRecieved(CanardInstance *canardIns,
  8. CanardRxTransfer *transfer);
  9. struct _weigher_status {
  10. uint32_t timestamp; /* [ms] 数据更新时间戳 */
  11. uint32_t weight; /* g */
  12. uint16_t weight_dot; /* g/min */
  13. uint16_t status;
  14. float gyro[3]; /* rad/s */
  15. float acce[3]; /* m/s^2 */
  16. float Q[4]; /* 姿态四元数 */
  17. };
  18. struct _weigher_version {
  19. uint32_t timestamp;
  20. uint8_t fw_ver[16];
  21. uint32_t SN_num;
  22. };
  23. struct vk_weigher_vls300 {
  24. // struct weigher_device weigher_dev;
  25. // rt_device_t can_dev;
  26. CanardInstance *canard;
  27. uint8_t iface_mask;
  28. bool data_got;
  29. struct _weigher_status status_data;
  30. struct _weigher_version version;
  31. // rt_event_t _event;
  32. uint16_t _fw_update_send_pack_num; // 从1开始
  33. const char *_fw_file_name;
  34. };
  35. enum {
  36. VLS300_EVENT_GOT_FW_UPDATE_START_ACK = 1,
  37. VLS300_EVENT_GOT_FW_UPDATE_INFO_ACK = (1 << 1),
  38. VLS300_EVENT_GOT_FW_UPDATE_DATA_ACK = (1 << 2),
  39. };
  40. extern struct vk_weigher_vls300 _vk_vls300;
  41. bool vkWeigher_Vls300_shouldAcceptTransfer(const CanardInstance *ins,
  42. uint64_t *out_data_type_signature,
  43. uint16_t data_type_id,
  44. CanardTransferType transfer_type,
  45. uint8_t source_node_id);
  46. uint8_t vklift_weight_calibrate(uint32_t weight);
  47. #ifdef __cplusplus
  48. }
  49. #endif // __cplusplus