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 Texas Instruments TMP119 high-accuracy digital temperature sensor. 18 : * The TMP119 is a variant of the TMP117 with a different device ID (0x2117). 19 : */ 20 : 21 : #pragma once 22 : 23 : #include "AP_TemperatureSensor_Backend.h" 24 : 25 : #if AP_TEMPERATURE_SENSOR_TMP119_ENABLED 26 : 27 : #ifndef AP_TEMPERATURE_SENSOR_TMP119_DEFAULT_I2C_ADDR 28 : #define AP_TEMPERATURE_SENSOR_TMP119_DEFAULT_I2C_ADDR 0x48 29 : #endif 30 : 31 : class AP_TemperatureSensor_TMP119 : public AP_TemperatureSensor_Backend { 32 : using AP_TemperatureSensor_Backend::AP_TemperatureSensor_Backend; 33 : 34 : public: 35 : __INITFUNC__ void init(void) override; 36 : 37 0 : void update() override {}; 38 : 39 : private: 40 : // update the temperature, called at 20Hz 41 : void _timer(void); 42 : 43 : // read a 16-bit big-endian register 44 : bool read_registers(uint8_t reg, uint16_t &value) const; 45 : 46 : // write a 16-bit big-endian register 47 : bool write_register(uint8_t reg, uint16_t value) const; 48 : }; 49 : 50 : #endif // AP_TEMPERATURE_SENSOR_TMP119_ENABLED