dtt.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * (C) Copyright 2001
  3. * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * Digital Thermometers and Thermostats.
  25. */
  26. #ifndef _DTT_H_
  27. #define _DTT_H_
  28. #if defined(CONFIG_DTT_LM75) || \
  29. defined(CONFIG_DTT_DS1621) || \
  30. defined(CONFIG_DTT_LM81) || \
  31. defined(CONFIG_DTT_ADM1021)
  32. #define CONFIG_DTT /* We have a DTT */
  33. #ifndef CONFIG_DTT_ADM1021
  34. #define DTT_COMMERCIAL_MAX_TEMP 70 /* 0 - +70 C */
  35. #define DTT_INDUSTRIAL_MAX_TEMP 85 /* -40 - +85 C */
  36. #define DTT_AUTOMOTIVE_MAX_TEMP 105 /* -40 - +105 C */
  37. #ifndef CFG_DTT_MAX_TEMP
  38. #define CFG_DTT_MAX_TEMP DTT_COMMERCIAL_MAX_TEMP
  39. #endif
  40. #ifndef CFG_DTT_HYSTERESIS
  41. #define CFG_DTT_HYSTERESIS 5 /* 5 C */
  42. #endif
  43. #endif /* CONFIG_DTT_ADM1021 */
  44. extern int dtt_init (void);
  45. extern int dtt_read(int sensor, int reg);
  46. extern int dtt_write(int sensor, int reg, int val);
  47. extern int dtt_get_temp(int sensor);
  48. #endif
  49. #if defined(CONFIG_DTT_LM75)
  50. #define DTT_READ_TEMP 0x0
  51. #define DTT_CONFIG 0x1
  52. #define DTT_TEMP_HYST 0x2
  53. #define DTT_TEMP_SET 0x3
  54. #endif
  55. #if defined(CONFIG_DTT_LM81)
  56. #define DTT_READ_TEMP 0x27
  57. #define DTT_CONFIG_TEMP 0x4b
  58. #define DTT_TEMP_MAX 0x39
  59. #define DTT_TEMP_HYST 0x3a
  60. #define DTT_CONFIG 0x40
  61. #endif
  62. #if defined(CONFIG_DTT_DS1621)
  63. #define DTT_READ_TEMP 0xAA
  64. #define DTT_READ_COUNTER 0xA8
  65. #define DTT_READ_SLOPE 0xA9
  66. #define DTT_WRITE_START_CONV 0xEE
  67. #define DTT_WRITE_STOP_CONV 0x22
  68. #define DTT_TEMP_HIGH 0xA1
  69. #define DTT_TEMP_LOW 0xA2
  70. #define DTT_CONFIG 0xAC
  71. #endif
  72. #if defined(CONFIG_DTT_ADM1021)
  73. #define DTT_READ_LOC_VALUE 0x00
  74. #define DTT_READ_REM_VALUE 0x01
  75. #define DTT_READ_STATUS 0x02
  76. #define DTT_READ_CONFIG 0x03
  77. #define DTT_READ_CONVRATE 0x04
  78. #define DTT_READ_LOC_HIGHLIM 0x05
  79. #define DTT_READ_LOC_LOWLIM 0x06
  80. #define DTT_READ_REM_HIGHLIM 0x07
  81. #define DTT_READ_REM_LOWLIM 0x08
  82. #define DTT_READ_DEVID 0xfe
  83. #define DTT_WRITE_CONFIG 0x09
  84. #define DTT_WRITE_CONVRATE 0x0a
  85. #define DTT_WRITE_LOC_HIGHLIM 0x0b
  86. #define DTT_WRITE_LOC_LOWLIM 0x0c
  87. #define DTT_WRITE_REM_HIGHLIM 0x0d
  88. #define DTT_WRITE_REM_LOWLIM 0x0e
  89. #define DTT_WRITE_ONESHOT 0x0f
  90. #define DTT_STATUS_BUSY 0x80 /* 1=ADC Converting */
  91. #define DTT_STATUS_LHIGH 0x40 /* 1=Local High Temp Limit Tripped */
  92. #define DTT_STATUS_LLOW 0x20 /* 1=Local Low Temp Limit Tripped */
  93. #define DTT_STATUS_RHIGH 0x10 /* 1=Remote High Temp Limit Tripped */
  94. #define DTT_STATUS_RLOW 0x08 /* 1=Remote Low Temp Limit Tripped */
  95. #define DTT_STATUS_OPEN 0x04 /* 1=Remote Sensor Open-Circuit */
  96. #define DTT_CONFIG_ALERT_MASKED 0x80 /* 0=ALERT Enabled, 1=ALERT Masked */
  97. #define DTT_CONFIG_STANDBY 0x40 /* 0=Run, 1=Standby */
  98. #define DTT_ADM1021_DEVID 0x41
  99. #endif
  100. #endif /* _DTT_H_ */