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_Compass/AP_Compass_QMC5883P.h
Views: 1798
/*1* This file is free software: you can redistribute it and/or modify it2* under the terms of the GNU General Public License as published by the3* Free Software Foundation, either version 3 of the License, or4* (at your option) any later version.5*6* This file is distributed in the hope that it will be useful, but7* WITHOUT ANY WARRANTY; without even the implied warranty of8* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.9* See the GNU General Public License for more details.10*11* You should have received a copy of the GNU General Public License along12* with this program. If not, see <http://www.gnu.org/licenses/>.13*14* Driver by Lokesh Ramina, Jan 202215*/16#pragma once1718#include <AP_HAL/AP_HAL.h>19#include <AP_HAL/I2CDevice.h>20#include <AP_Math/AP_Math.h>2122#include "AP_Compass_config.h"2324#ifdef AP_COMPASS_QMC5883P_ENABLED2526#include "AP_Compass.h"27#include "AP_Compass_Backend.h"2829#ifndef HAL_COMPASS_QMC5883P_I2C_ADDR30#define HAL_COMPASS_QMC5883P_I2C_ADDR 0x2C31#endif3233/*34setup default orientations35*/36#ifndef HAL_COMPASS_QMC5883P_ORIENTATION_EXTERNAL37#define HAL_COMPASS_QMC5883P_ORIENTATION_EXTERNAL ROTATION_ROLL_18038#endif3940#ifndef HAL_COMPASS_QMC5883P_ORIENTATION_INTERNAL41#define HAL_COMPASS_QMC5883P_ORIENTATION_INTERNAL ROTATION_ROLL_180_YAW_27042#endif4344class AP_Compass_QMC5883P : public AP_Compass_Backend45{46public:47static AP_Compass_Backend *probe(AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev,48bool force_external,49enum Rotation rotation);5051void read() override;5253static constexpr const char *name = "QMC5883P";5455private:56AP_Compass_QMC5883P(AP_HAL::OwnPtr<AP_HAL::Device> dev,57bool force_external,58enum Rotation rotation);5960void _dump_registers();61bool _check_whoami();62void timer();63bool init();6465AP_HAL::OwnPtr<AP_HAL::Device> _dev;6667enum Rotation _rotation;68uint8_t _instance;69bool _force_external:1;70};7172#endif // AP_COMPASS_QMC5883P_ENABLED737475