2017-04-02 11:56:15 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AP_Compass.h"
|
|
|
|
#include "AP_Compass_Backend.h"
|
|
|
|
|
|
|
|
#include <AP_UAVCAN/AP_UAVCAN.h>
|
|
|
|
|
|
|
|
class AP_Compass_UAVCAN : public AP_Compass_Backend {
|
|
|
|
public:
|
|
|
|
void read(void) override;
|
|
|
|
|
|
|
|
AP_Compass_UAVCAN(Compass &compass);
|
|
|
|
~AP_Compass_UAVCAN() override;
|
|
|
|
|
2017-05-06 06:13:19 -03:00
|
|
|
static AP_Compass_Backend *probe(Compass &compass);
|
|
|
|
|
|
|
|
bool register_uavcan_compass(uint8_t mgr, uint8_t node);
|
|
|
|
|
2017-04-02 11:56:15 -03:00
|
|
|
// This method is called from UAVCAN thread
|
|
|
|
void handle_mag_msg(Vector3f &mag);
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t _instance;
|
|
|
|
int _mag_fd;
|
|
|
|
Vector3f _sum;
|
|
|
|
uint32_t _count;
|
|
|
|
|
2017-05-06 06:13:19 -03:00
|
|
|
bool _initialized;
|
|
|
|
uint8_t _manager;
|
|
|
|
|
2018-03-11 06:50:49 -03:00
|
|
|
AP_HAL::Semaphore *_sem_mag;
|
2017-04-02 11:56:15 -03:00
|
|
|
};
|