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_IIS2MDC.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*/15#pragma once1617#include "AP_Compass_config.h"1819#if AP_COMPASS_IIS2MDC_ENABLED2021#include <AP_HAL/AP_HAL.h>22#include <AP_HAL/I2CDevice.h>2324#include "AP_Compass.h"25#include "AP_Compass_Backend.h"2627#ifndef HAL_COMPASS_IIS2MDC_I2C_ADDR28#define HAL_COMPASS_IIS2MDC_I2C_ADDR 0x1E29#endif3031#ifndef HAL_COMPASS_IIS2MDC_ORIENTATION_EXTERNAL32#define HAL_COMPASS_IIS2MDC_ORIENTATION_EXTERNAL ROTATION_NONE33#endif3435#ifndef HAL_COMPASS_IIS2MDC_ORIENTATION_INTERNAL36#define HAL_COMPASS_IIS2MDC_ORIENTATION_INTERNAL ROTATION_NONE37#endif3839class AP_Compass_IIS2MDC : public AP_Compass_Backend40{41public:42static AP_Compass_Backend *probe(AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev,43bool force_external,44enum Rotation rotation);4546void read() override;4748static constexpr const char *name = "IIS2MDC";4950private:51AP_Compass_IIS2MDC(AP_HAL::OwnPtr<AP_HAL::Device> dev,52bool force_external,53enum Rotation rotation);5455bool check_whoami();56void timer();57bool init();5859AP_HAL::OwnPtr<AP_HAL::Device> _dev;6061enum Rotation _rotation;62uint8_t _instance;63bool _force_external;64};6566#endif // AP_COMPASS_IIS2MDC_ENABLED676869