23 #include <sys/types.h> 34 #define debug_mag_uavcan(level, fmt, args...) do { if ((level) <= AP_BoardConfig_CAN::get_can_debug()) { printf(fmt, ##args); }} while (0) 49 if (hal.
can_mgr[_manager] !=
nullptr) {
51 if (ap_uavcan !=
nullptr) {
54 debug_mag_uavcan(2,
"AP_Compass_UAVCAN destructed\n\r");
64 if (AP_BoardConfig_CAN::get_can_num_ifaces() != 0) {
65 for (uint8_t i = 0; i < MAX_NUMBER_OF_CAN_DRIVERS; i++) {
66 if (hal.
can_mgr[i] !=
nullptr) {
68 if (uavcan !=
nullptr) {
70 if (freemag != UINT8_MAX) {
73 debug_mag_uavcan(2,
"AP_Compass_UAVCAN probed, drv: %d, node: %d\n\r", i, freemag);
90 if (hal.
can_mgr[mgr] !=
nullptr) {
92 if (ap_uavcan !=
nullptr) {
98 struct DeviceStructure {
105 struct DeviceStructure devid_s;
110 d.devid_s.bus_type = 3;
112 d.devid_s.address = node;
113 d.devid_s.devtype = 1;
123 debug_mag_uavcan(2,
"AP_Compass_UAVCAN loaded\n\r");
void set_external(uint8_t instance, bool external)
bool register_uavcan_compass(uint8_t mgr, uint8_t node)
static AP_Compass_Backend * probe(Compass &compass)
void rotate_field(Vector3f &mag, uint8_t instance)
void publish_filtered_field(const Vector3f &mag, uint8_t instance)
void correct_field(Vector3f &mag, uint8_t i)
#define HAL_SEMAPHORE_BLOCK_FOREVER
virtual Semaphore * new_semaphore(void)
void set_dev_id(uint8_t instance, uint32_t dev_id)
AP_HAL::CANManager ** can_mgr
void remove_mag_listener(AP_Compass_Backend *rem_listener)
uint8_t register_compass(void) const
uint8_t find_smallest_free_mag_node()
uint8_t register_mag_listener_to_node(AP_Compass_Backend *new_listener, uint8_t node)
AP_Compass_UAVCAN(Compass &compass)
virtual void accumulate(void)
~AP_Compass_UAVCAN() override
void publish_raw_field(const Vector3f &mag, uint8_t instance)
void handle_mag_msg(Vector3f &mag)