LCOV - code coverage report
Current view: top level - AP_TemperatureSensor - AP_TemperatureSensor_SHT3x.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 1 1 100.0 %
Date: 2026-09-09 11:02:08 Functions: 1 1 100.0 %

          Line data    Source code
       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             : /*
      17             :  * I2C driver for Sensiron SHT3x digital temperature sensor
      18             : 
      19             :  https://sensirion.com/media/documents/213E6A3B/63A5A569/Datasheet_SHT3x_DIS.pdf
      20             : 
      21             : 
      22             :  Testing:
      23             : 
      24             : pbarker@fx:~$ cat /tmp/extra.hwdef
      25             : define AP_TEMPERATURE_SENSOR_ENABLED 1
      26             : define AP_TEMPERATURE_SENSOR_BACKEND_DEFAULT_ENABLED 1
      27             : pbarker@fx:~$ ./waf configure --board=CubeOrange --extra-hwdef=/tmp/extra.hwdef
      28             : pbarker@fx:~/rc/ardupilot(pr/SHT3x)$ ./waf rover --upload
      29             : 
      30             : # when plugging into I2C2 on a CubeOrange:
      31             : param set TEMP1_TYPE 8
      32             : param set TEMP1_BUS 0
      33             : param set TEMP1_ADDR 0x44
      34             : 
      35             : this is bad:
      36             : AP: SHT3x reset failed
      37             : AP: SHT3x: SN1841CC41FC5
      38             : 
      39             : param set TEMP_LOG 1
      40             : param set LOG_DISARMED 1
      41             : ...
      42             : param set LOG_DISARMED 0
      43             : 
      44             : Download log and check for temperatures
      45             : 
      46             : */
      47             : 
      48             : #pragma once
      49             : 
      50             : #include "AP_TemperatureSensor_config.h"
      51             : 
      52             : #if AP_TEMPERATURE_SENSOR_SHT3X_ENABLED
      53             : 
      54             : #include "AP_TemperatureSensor_Backend.h"
      55             : 
      56             : class AP_TemperatureSensor_SHT3x : public AP_TemperatureSensor_Backend {
      57             : 
      58             :     using AP_TemperatureSensor_Backend::AP_TemperatureSensor_Backend;
      59             : 
      60             : public:
      61             :     __INITFUNC__ void init(void) override;
      62             : 
      63         278 :     void update() override {};
      64             : 
      65             : private:
      66             :     // reset device
      67             :     bool reset(void) const;
      68             : 
      69             :     // prod device to start preparing a measurement:
      70             :     void start_next_sample();
      71             :     // read measurements from device:
      72             :     bool read_measurements(uint16_t &temp, uint16_t &humidity) const;
      73             : 
      74             :     // update the temperature, called at 20Hz
      75             :     void _timer(void);
      76             : 
      77             : };
      78             : #endif // AP_TEMPERATURE_SENSOR_SHT3X_ENABLED

Generated by: LCOV version 1.14