/* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* * AP_Compass_HIL.cpp - HIL backend for AP_Compass * */ #include #include "AP_Compass_HIL.h" extern const AP_HAL::HAL& hal; // constructor AP_Compass_HIL::AP_Compass_HIL() { memset(_compass_instance, 0, sizeof(_compass_instance)); _compass._setup_earth_field(); } // detect the sensor AP_Compass_Backend *AP_Compass_HIL::detect() { AP_Compass_HIL *sensor = new AP_Compass_HIL(); if (sensor == nullptr) { return nullptr; } if (!sensor->init()) { delete sensor; return nullptr; } return sensor; } bool AP_Compass_HIL::init(void) { // register two compass instances for (uint8_t i=0; i