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_LIS3MDL.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#pragma once1516#include "AP_Compass_config.h"1718#if AP_COMPASS_LIS3MDL_ENABLED1920#include <AP_Common/AP_Common.h>21#include <AP_HAL/AP_HAL.h>22#include <AP_HAL/Device.h>23#include <AP_Math/AP_Math.h>2425#include "AP_Compass.h"26#include "AP_Compass_Backend.h"2728#ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR29# define HAL_COMPASS_LIS3MDL_I2C_ADDR 0x1c30#endif3132#ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR233# define HAL_COMPASS_LIS3MDL_I2C_ADDR2 0x1e34#endif3536class AP_Compass_LIS3MDL : public AP_Compass_Backend37{38public:39static AP_Compass_Backend *probe(AP_HAL::OwnPtr<AP_HAL::Device> dev,40bool force_external,41enum Rotation rotation);4243void read() override;4445static constexpr const char *name = "LIS3MDL";4647private:48AP_Compass_LIS3MDL(AP_HAL::OwnPtr<AP_HAL::Device> dev,49bool force_external,50enum Rotation rotation);5152AP_HAL::OwnPtr<AP_HAL::Device> dev;5354/**55* Device periodic callback to read data from the sensor.56*/57bool init();58void timer();5960uint8_t compass_instance;61bool force_external;62enum Rotation rotation;63};6465#endif // AP_COMPASS_LIS3MDL_ENABLED666768