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_Baro/AP_Baro_BMP388.h
Views: 1798
#pragma once12#include "AP_Baro_Backend.h"34#if AP_BARO_BMP388_ENABLED56#include <AP_HAL/AP_HAL.h>7#include <AP_HAL/Device.h>8#include <AP_HAL/utility/OwnPtr.h>910#ifndef HAL_BARO_BMP388_I2C_ADDR11#define HAL_BARO_BMP388_I2C_ADDR (0x76)12#endif13#ifndef HAL_BARO_BMP388_I2C_ADDR214#define HAL_BARO_BMP388_I2C_ADDR2 (0x77)15#endif1617class AP_Baro_BMP388 : public AP_Baro_Backend18{19public:20AP_Baro_BMP388(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> _dev);2122/* AP_Baro public interface: */23void update() override;2425static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> _dev);2627private:2829bool init(void);30void timer(void);31void update_temperature(uint32_t);32void update_pressure(uint32_t);3334AP_HAL::OwnPtr<AP_HAL::Device> dev;3536uint8_t instance;37float pressure_sum;38uint32_t pressure_count;39float temperature;4041// Internal calibration registers42struct PACKED {43int16_t nvm_par_p1; // at 0x3644int16_t nvm_par_p2;45int8_t nvm_par_p3;46int8_t nvm_par_p4;47int16_t nvm_par_p5;48int16_t nvm_par_p6;49int8_t nvm_par_p7;50int8_t nvm_par_p8;51int16_t nvm_par_p9;52int8_t nvm_par_p10;53int8_t nvm_par_p11;54} calib_p;5556struct PACKED {57uint16_t nvm_par_t1; // at 0x3158uint16_t nvm_par_t2;59int8_t nvm_par_t3;60} calib_t;6162// scaled calibration data63struct {64float par_t1;65float par_t2;66float par_t3;67float par_p1;68float par_p2;69float par_p3;70float par_p4;71float par_p5;72float par_p6;73float par_p7;74float par_p8;75float par_p9;76float par_p10;77float par_p11;78float t_lin;79} calib;8081void scale_calibration_data(void);82bool read_registers(uint8_t reg, uint8_t *data, uint8_t len);83};8485#endif // AP_BARO_BMP388_ENABLED868788