Line data Source code
1 : /* 2 : This program is free software: you can redistribute it and/or modify 3 : it under the terms of the GNU General Public License as published by 4 : the Free Software Foundation, either version 3 of the License, or 5 : (at your option) any later version. 6 : 7 : This program is distributed in the hope that it will be useful, 8 : but WITHOUT ANY WARRANTY; without even the implied warranty of 9 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 : GNU General Public License for more details. 11 : 12 : You should have received a copy of the GNU General Public License 13 : along with this program. If not, see <http://www.gnu.org/licenses/>. 14 : */ 15 : 16 : #pragma once 17 : 18 : #include "AP_TemperatureSensor_config.h" 19 : 20 : #if AP_TEMPERATURE_SENSOR_DRONECAN_ENABLED 21 : 22 : #include "AP_TemperatureSensor_Backend.h" 23 : #include <AP_Param/AP_Param.h> 24 : 25 : #include <AP_DroneCAN/AP_DroneCAN.h> 26 : 27 : class AP_TemperatureSensor_DroneCAN : public AP_TemperatureSensor_Backend { 28 : public: 29 : AP_TemperatureSensor_DroneCAN(AP_TemperatureSensor &front, AP_TemperatureSensor::TemperatureSensor_State &state, AP_TemperatureSensor_Params ¶ms); 30 : 31 : static bool subscribe_msgs(AP_DroneCAN* ap_dronecan); 32 : 33 : // Don't do anything in update, but still need to override the pure virtual method. 34 0 : void update(void) override {}; 35 : 36 : static const struct AP_Param::GroupInfo var_info[]; 37 : 38 : private: 39 : 40 : static void handle_temperature(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const uavcan_equipment_device_Temperature &msg); 41 : 42 : // Static list of drivers 43 : static AP_TemperatureSensor_DroneCAN *_drivers[AP_TEMPERATURE_SENSOR_MAX_INSTANCES]; 44 : static uint8_t _driver_instance; 45 : static HAL_Semaphore _driver_sem; 46 : 47 : // DroneCAN temperature ID to listen for 48 : AP_Int32 _ID; 49 : 50 : }; 51 : 52 : #endif // AP_TEMPERATURE_SENSOR_DRONECAN_ENABLED