Path: blob/master/libraries/AP_Compass/AP_Compass_IST8308.h
9634 views
/*1* Copyright (C) 2018 Lucas De Marchi. All rights reserved.2*3* This file is free software: you can redistribute it and/or modify it4* under the terms of the GNU General Public License as published by the5* Free Software Foundation, either version 2 of the License, or6* (at your option) any later version.7*8* This file is distributed in the hope that it will be useful, but9* WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.11* See the GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License along14* with this program. If not, see <http://www.gnu.org/licenses/>.15*/16#pragma once1718#include "AP_Compass_config.h"1920#if AP_COMPASS_IST8308_ENABLED2122#include <AP_Common/AP_Common.h>23#include <AP_HAL/AP_HAL.h>24#include <AP_HAL/Device.h>2526#include "AP_Compass_Backend.h"2728#ifndef HAL_COMPASS_IST8308_I2C_ADDR29#define HAL_COMPASS_IST8308_I2C_ADDR 0x0C30#endif3132class AP_Compass_IST8308 : public AP_Compass_Backend33{34public:35static AP_Compass_Backend *probe(AP_HAL::OwnPtr<AP_HAL::Device> dev,36bool force_external,37enum Rotation rotation);3839void read() override;4041static constexpr const char *name = "IST8308";4243private:44AP_Compass_IST8308(AP_HAL::OwnPtr<AP_HAL::Device> dev,45bool force_external,46enum Rotation rotation);4748void timer();49bool init();5051AP_HAL::OwnPtr<AP_HAL::Device> _dev;5253enum Rotation _rotation;54bool _force_external;55};5657#endif // AP_COMPASS_IST8308_ENABLED585960