uavcan.equipment.indication.SingleLightCommand.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <canard.h>
  5. #include <uavcan.equipment.indication.RGB565.h>
  6. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_MAX_SIZE 3
  7. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_SIGNATURE (0xE894B8B589807007ULL)
  8. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_ANTI_COLLISION 246
  9. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_RIGHT_OF_WAY 247
  10. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_STROBE 248
  11. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_WING 249
  12. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_LOGO 250
  13. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_TAXI 251
  14. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_TURN_OFF 252
  15. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_TAKE_OFF 253
  16. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_LANDING 254
  17. #define UAVCAN_EQUIPMENT_INDICATION_SINGLELIGHTCOMMAND_LIGHT_ID_FORMATION 255
  18. struct uavcan_equipment_indication_SingleLightCommand {
  19. uint8_t light_id;
  20. struct uavcan_equipment_indication_RGB565 color;
  21. };
  22. #ifdef __cplusplus
  23. extern "C"
  24. {
  25. #endif
  26. uint32_t _uavcan_equipment_indication_SingleLightCommand_encode(struct uavcan_equipment_indication_SingleLightCommand* msg, uint8_t* buffer
  27. #if CANARD_ENABLE_TAO_OPTION
  28. , bool tao
  29. #endif
  30. );
  31. bool _uavcan_equipment_indication_SingleLightCommand_decode(const CanardRxTransfer* transfer, struct uavcan_equipment_indication_SingleLightCommand* msg);
  32. static inline uint32_t uavcan_equipment_indication_SingleLightCommand_encode(struct uavcan_equipment_indication_SingleLightCommand* msg, uint8_t* buffer
  33. #if CANARD_ENABLE_TAO_OPTION
  34. , bool tao
  35. #endif
  36. ) {
  37. return _uavcan_equipment_indication_SingleLightCommand_encode(msg, buffer
  38. #if CANARD_ENABLE_TAO_OPTION
  39. , tao
  40. #endif
  41. );
  42. }
  43. static inline bool uavcan_equipment_indication_SingleLightCommand_decode(const CanardRxTransfer* transfer, struct uavcan_equipment_indication_SingleLightCommand* msg) {
  44. return _uavcan_equipment_indication_SingleLightCommand_decode(transfer, msg);
  45. }
  46. #if defined(CANARD_DSDLC_INTERNAL)
  47. static inline void __uavcan_equipment_indication_SingleLightCommand_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_equipment_indication_SingleLightCommand* msg, bool tao);
  48. static inline bool __uavcan_equipment_indication_SingleLightCommand_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_equipment_indication_SingleLightCommand* msg, bool tao);
  49. void __uavcan_equipment_indication_SingleLightCommand_encode(uint8_t* buffer, uint32_t* bit_ofs, struct uavcan_equipment_indication_SingleLightCommand* msg, bool tao) {
  50. (void)buffer;
  51. (void)bit_ofs;
  52. (void)msg;
  53. (void)tao;
  54. canardEncodeScalar(buffer, *bit_ofs, 8, &msg->light_id);
  55. *bit_ofs += 8;
  56. __uavcan_equipment_indication_RGB565_encode(buffer, bit_ofs, &msg->color, tao);
  57. }
  58. /*
  59. decode uavcan_equipment_indication_SingleLightCommand, return true on failure, false on success
  60. */
  61. bool __uavcan_equipment_indication_SingleLightCommand_decode(const CanardRxTransfer* transfer, uint32_t* bit_ofs, struct uavcan_equipment_indication_SingleLightCommand* msg, bool tao) {
  62. (void)transfer;
  63. (void)bit_ofs;
  64. (void)msg;
  65. (void)tao;
  66. canardDecodeScalar(transfer, *bit_ofs, 8, false, &msg->light_id);
  67. *bit_ofs += 8;
  68. if (__uavcan_equipment_indication_RGB565_decode(transfer, bit_ofs, &msg->color, tao)) {return true;}
  69. return false; /* success */
  70. }
  71. #endif
  72. #ifdef CANARD_DSDLC_TEST_BUILD
  73. struct uavcan_equipment_indication_SingleLightCommand sample_uavcan_equipment_indication_SingleLightCommand_msg(void);
  74. #endif
  75. #ifdef __cplusplus
  76. } // extern "C"
  77. #ifdef DRONECAN_CXX_WRAPPERS
  78. #include <canard/cxx_wrappers.h>
  79. #endif
  80. #endif