APM:Libraries
AP_Baro_KellerLD.h
Go to the documentation of this file.
1 /*
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License as published by
4  the Free Software Foundation, either version 3 of the License, or
5  (at your option) any later version.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program. If not, see <http://www.gnu.org/licenses/>.
14 
15 
16  * Driver for 4 LD ... 9 LD line of pressure transducers from Keller:
17  * http://www.keller-druck.com/home_e/paprod_e/4ld_e.asp
18  *
19  * These sensors operate on I2C and come in a variety of form factors.
20  * The measurement range is between 0-200 bar depbending on the model.
21  * They are definitely not the worlds smallest pressure transmitter.
22  *
23  * Default address is 0x40.
24  */
25 
26 #pragma once
27 
28 #include "AP_Baro_Backend.h"
29 
30 #include <AP_HAL/AP_HAL.h>
31 #include <AP_HAL/Semaphores.h>
32 #include <AP_HAL/Device.h>
33 
34 #ifndef HAL_BARO_KELLERLD_I2C_ADDR
35 #define HAL_BARO_KELLERLD_I2C_ADDR 0x40
36 #endif
37 
39 {
40 public:
41  void update();
42 
44 
45 private:
47 
48  bool _init();
49 
50  void _timer();
51 
52  bool _read();
53 
54  void _update_and_wrap_accumulator(uint16_t pressure, uint16_t temperature, uint8_t max_count);
55 
57 
58  /* Shared values between thread sampling the HW and main thread */
59  /* These are raw outputs, not calculated values */
60  struct {
61  uint32_t sum_pressure;
62  uint32_t sum_temperature;
63  uint8_t num_samples;
64  } _accum;
65 
66  uint8_t _instance;
67 
68  // measurement range parameters used in pressure calculation
69  // varies based on model, stored in ROM on device
70  float _p_min;
71  float _p_max;
72 };
AP_Baro_KellerLD(AP_Baro &baro, AP_HAL::OwnPtr< AP_HAL::Device > dev)
AP_HAL::OwnPtr< AP_HAL::Device > _dev
struct AP_Baro_KellerLD::@9 _accum
float temperature
Definition: Airspeed.cpp:32
static AP_HAL::OwnPtr< AP_HAL::Device > dev
Definition: ICM20789.cpp:16
uint32_t sum_temperature
void _update_and_wrap_accumulator(uint16_t pressure, uint16_t temperature, uint8_t max_count)
static AP_Baro baro
Definition: ModuleTest.cpp:18
static AP_Baro_Backend * probe(AP_Baro &baro, AP_HAL::OwnPtr< AP_HAL::Device > dev)