AP_Baro_LPS2XH.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include <AP_HAL/AP_HAL.h>
  3. #include <AP_HAL/Device.h>
  4. #include <AP_HAL/utility/OwnPtr.h>
  5. #include "AP_Baro_Backend.h"
  6. #define HAL_BARO_LPS25H_I2C_BUS 0
  7. #ifndef HAL_BARO_LPS25H_I2C_ADDR
  8. # define HAL_BARO_LPS25H_I2C_ADDR 0x5D
  9. #endif
  10. class AP_Baro_LPS2XH : public AP_Baro_Backend
  11. {
  12. public:
  13. enum LPS2XH_TYPE {
  14. BARO_LPS22H = 0,
  15. BARO_LPS25H = 1,
  16. };
  17. AP_Baro_LPS2XH(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
  18. /* AP_Baro public interface: */
  19. void update() override;
  20. static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
  21. static AP_Baro_Backend *probe_InvensenseIMU(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev, uint8_t imu_address);
  22. private:
  23. virtual ~AP_Baro_LPS2XH(void) {};
  24. bool _init(void);
  25. void _timer(void);
  26. void _update_temperature(void);
  27. void _update_pressure(void);
  28. bool _imu_i2c_init(uint8_t imu_address);
  29. bool _check_whoami(void);
  30. AP_HAL::OwnPtr<AP_HAL::Device> _dev;
  31. bool _has_sample;
  32. uint8_t _instance;
  33. float _pressure;
  34. float _temperature;
  35. uint32_t CallTime = 0;
  36. enum LPS2XH_TYPE _lps2xh_type;
  37. };