Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_Baro/AP_Baro_DroneCAN.h
Views: 1798
#pragma once12#include "AP_Baro_Backend.h"34#if AP_BARO_DRONECAN_ENABLED56#include <AP_DroneCAN/AP_DroneCAN.h>7#if AP_TEST_DRONECAN_DRIVERS8#include <SITL/SITL.h>9#endif1011class AP_Baro_DroneCAN : public AP_Baro_Backend {12public:13AP_Baro_DroneCAN(AP_Baro &baro);1415void update() override;1617static bool subscribe_msgs(AP_DroneCAN* ap_dronecan);18static AP_Baro_DroneCAN* get_dronecan_backend(AP_DroneCAN* ap_dronecan, uint8_t node_id, bool create_new);19static AP_Baro_Backend* probe(AP_Baro &baro);2021static void handle_pressure(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const uavcan_equipment_air_data_StaticPressure &msg);22static void handle_temperature(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const uavcan_equipment_air_data_StaticTemperature &msg);23#if AP_TEST_DRONECAN_DRIVERS24void update_healthy_flag(uint8_t instance) override { _frontend.sensors[instance].healthy = !AP::sitl()->baro[instance].disable; };25#endif26private:2728static void _update_and_wrap_accumulator(float *accum, float val, uint8_t *count, const uint8_t max_count);2930uint8_t _instance;3132bool new_pressure;33float _pressure;34float _temperature;35uint8_t _pressure_count;36HAL_Semaphore _sem_baro;3738AP_DroneCAN* _ap_dronecan;39uint8_t _node_id;4041// Module Detection Registry42static struct DetectedModules {43AP_DroneCAN* ap_dronecan;44uint8_t node_id;45AP_Baro_DroneCAN* driver;46} _detected_modules[BARO_MAX_DRIVERS];4748static HAL_Semaphore _sem_registry;49};5051#endif // AP_BARO_DRONECAN_ENABLED525354