tmp105.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Texas Instruments TMP105 Temperature Sensor
  3. *
  4. * Browse the data sheet:
  5. *
  6. * http://www.ti.com/lit/gpn/tmp105
  7. *
  8. * Copyright (C) 2012 Alex Horn <alex.horn@cs.ox.ac.uk>
  9. * Copyright (C) 2008-2012 Andrzej Zaborowski <balrogg@gmail.com>
  10. *
  11. * This work is licensed under the terms of the GNU GPL, version 2 or
  12. * later. See the COPYING file in the top-level directory.
  13. */
  14. #ifndef QEMU_TMP105_H
  15. #define QEMU_TMP105_H
  16. #include "hw/i2c/i2c.h"
  17. #include "hw/misc/tmp105_regs.h"
  18. #define TYPE_TMP105 "tmp105"
  19. #define TMP105(obj) OBJECT_CHECK(TMP105State, (obj), TYPE_TMP105)
  20. /**
  21. * TMP105State:
  22. * @config: Bits 5 and 6 (value 32 and 64) determine the precision of the
  23. * temperature. See Table 8 in the data sheet.
  24. *
  25. * @see_also: http://www.ti.com/lit/gpn/tmp105
  26. */
  27. typedef struct TMP105State {
  28. /*< private >*/
  29. I2CSlave i2c;
  30. /*< public >*/
  31. uint8_t len;
  32. uint8_t buf[2];
  33. qemu_irq pin;
  34. uint8_t pointer;
  35. uint8_t config;
  36. int16_t temperature;
  37. int16_t limit[2];
  38. int faults;
  39. uint8_t alarm;
  40. } TMP105State;
  41. #endif