1*5e9ae4b1SCorey Minyard /* 2*5e9ae4b1SCorey Minyard * Texas Instruments TMP105 Temperature Sensor 3*5e9ae4b1SCorey Minyard * 4*5e9ae4b1SCorey Minyard * Browse the data sheet: 5*5e9ae4b1SCorey Minyard * 6*5e9ae4b1SCorey Minyard * http://www.ti.com/lit/gpn/tmp105 7*5e9ae4b1SCorey Minyard * 8*5e9ae4b1SCorey Minyard * Copyright (C) 2012 Alex Horn <alex.horn@cs.ox.ac.uk> 9*5e9ae4b1SCorey Minyard * Copyright (C) 2008-2012 Andrzej Zaborowski <balrogg@gmail.com> 10*5e9ae4b1SCorey Minyard * 11*5e9ae4b1SCorey Minyard * This work is licensed under the terms of the GNU GPL, version 2 or 12*5e9ae4b1SCorey Minyard * later. See the COPYING file in the top-level directory. 13*5e9ae4b1SCorey Minyard */ 14*5e9ae4b1SCorey Minyard #ifndef QEMU_TMP105_H 15*5e9ae4b1SCorey Minyard #define QEMU_TMP105_H 16*5e9ae4b1SCorey Minyard 17*5e9ae4b1SCorey Minyard #include "hw/i2c/i2c.h" 18*5e9ae4b1SCorey Minyard #include "hw/sensor/tmp105_regs.h" 19*5e9ae4b1SCorey Minyard #include "qom/object.h" 20*5e9ae4b1SCorey Minyard 21*5e9ae4b1SCorey Minyard #define TYPE_TMP105 "tmp105" 22*5e9ae4b1SCorey Minyard OBJECT_DECLARE_SIMPLE_TYPE(TMP105State, TMP105) 23*5e9ae4b1SCorey Minyard 24*5e9ae4b1SCorey Minyard /** 25*5e9ae4b1SCorey Minyard * TMP105State: 26*5e9ae4b1SCorey Minyard * @config: Bits 5 and 6 (value 32 and 64) determine the precision of the 27*5e9ae4b1SCorey Minyard * temperature. See Table 8 in the data sheet. 28*5e9ae4b1SCorey Minyard * 29*5e9ae4b1SCorey Minyard * @see_also: http://www.ti.com/lit/gpn/tmp105 30*5e9ae4b1SCorey Minyard */ 31*5e9ae4b1SCorey Minyard struct TMP105State { 32*5e9ae4b1SCorey Minyard /*< private >*/ 33*5e9ae4b1SCorey Minyard I2CSlave i2c; 34*5e9ae4b1SCorey Minyard /*< public >*/ 35*5e9ae4b1SCorey Minyard 36*5e9ae4b1SCorey Minyard uint8_t len; 37*5e9ae4b1SCorey Minyard uint8_t buf[2]; 38*5e9ae4b1SCorey Minyard qemu_irq pin; 39*5e9ae4b1SCorey Minyard 40*5e9ae4b1SCorey Minyard uint8_t pointer; 41*5e9ae4b1SCorey Minyard uint8_t config; 42*5e9ae4b1SCorey Minyard int16_t temperature; 43*5e9ae4b1SCorey Minyard int16_t limit[2]; 44*5e9ae4b1SCorey Minyard int faults; 45*5e9ae4b1SCorey Minyard uint8_t alarm; 46*5e9ae4b1SCorey Minyard /* 47*5e9ae4b1SCorey Minyard * The TMP105 initially looks for a temperature rising above T_high; 48*5e9ae4b1SCorey Minyard * once this is detected, the condition it looks for next is the 49*5e9ae4b1SCorey Minyard * temperature falling below T_low. This flag is false when initially 50*5e9ae4b1SCorey Minyard * looking for T_high, true when looking for T_low. 51*5e9ae4b1SCorey Minyard */ 52*5e9ae4b1SCorey Minyard bool detect_falling; 53*5e9ae4b1SCorey Minyard }; 54*5e9ae4b1SCorey Minyard 55*5e9ae4b1SCorey Minyard #endif 56