| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 6 | kaklik | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
||
| 3 | <title>Procyon AVRlib: ds1631.h Source File</title> |
||
| 4 | <link href="dox.css" rel="stylesheet" type="text/css"> |
||
| 5 | </head><body> |
||
| 6 | <!-- Generated by Doxygen 1.4.2 --> |
||
| 7 | <div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
||
| 8 | <h1>ds1631.h</h1><a href="ds1631_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file ds1631.h \brief Dallas DS1631 Temperature Sensor Driver Library. */</span> |
||
| 9 | 00002 <span class="comment">//*****************************************************************************</span> |
||
| 10 | 00003 <span class="comment">//</span> |
||
| 11 | 00004 <span class="comment">// File Name : 'ds1631.h'</span> |
||
| 12 | 00005 <span class="comment">// Title : Dallas DS1631 Temperature Sensor Driver Library</span> |
||
| 13 | 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2004</span> |
||
| 14 | 00007 <span class="comment">// Created : 2004.02.10</span> |
||
| 15 | 00008 <span class="comment">// Revised : 2004.02.19</span> |
||
| 16 | 00009 <span class="comment">// Version : 0.1</span> |
||
| 17 | 00010 <span class="comment">// Target MCU : Atmel AVR Series</span> |
||
| 18 | 00011 <span class="comment">// Editor Tabs : 4</span> |
||
| 19 | 00012 <span class="comment">//</span> |
||
| 20 | 00013 <span class="comment">// NOTE: This code is currently below version 1.0, and therefore is considered</span> |
||
| 21 | 00014 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span> |
||
| 22 | 00015 <span class="comment">// tested. Nonetheless, you can expect most functions to work.</span> |
||
| 23 | 00016 <span class="comment">//</span><span class="comment"></span> |
||
| 24 | 00017 <span class="comment">/// \ingroup driver_hw</span> |
||
| 25 | 00018 <span class="comment">/// \defgroup ds1631 Dallas DS1631 Temperature Sensor Driver (ds1631.c)</span> |
||
| 26 | 00019 <span class="comment">/// \code #include "ds1632.h" \endcode</span> |
||
| 27 | 00020 <span class="comment">/// \par Overview</span> |
||
| 28 | 00021 <span class="comment">/// This library provides high-level functions for accessing the Dallas</span> |
||
| 29 | 00022 <span class="comment">/// Semiconductor DS1631 I2C Temperature Sensor.</span> |
||
| 30 | 00023 <span class="comment">///</span> |
||
| 31 | 00024 <span class="comment">/// The basic specs of the DS1631 are:</span> |
||
| 32 | 00025 <span class="comment">/// - operating temperature range -55 to +125 degrees C</span> |
||
| 33 | 00026 <span class="comment">/// - high accuracy of +/-0.5C over 0 to +70 degrees C</span> |
||
| 34 | 00027 <span class="comment">/// - 8 to 12-bit signed output</span> |
||
| 35 | 00028 <span class="comment">/// - thermostat functionality</span> |
||
| 36 | 00029 <span class="comment"></span><span class="comment">//</span> |
||
| 37 | 00030 <span class="comment">// This code is distributed under the GNU Public License</span> |
||
| 38 | 00031 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span> |
||
| 39 | 00032 <span class="comment">//</span> |
||
| 40 | 00033 <span class="comment">//*****************************************************************************</span> |
||
| 41 | 00034 |
||
| 42 | 00035 <span class="preprocessor">#ifndef DS1631_H</span> |
||
| 43 | 00036 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_H</span> |
||
| 44 | 00037 <span class="preprocessor"></span> |
||
| 45 | 00038 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span> |
||
| 46 | 00039 |
||
| 47 | 00040 <span class="comment">// constants/macros/typdefs</span> |
||
| 48 | <a name="l00041"></a><a class="code" href="ds1631_8h.html#a0">00041</a> <span class="preprocessor">#define DS1631_I2C_ADDR 0x90 </span><span class="comment">///< Base I2C address of DS1631 devices</span> |
||
| 49 | 00042 <span class="comment"></span> |
||
| 50 | <a name="l00043"></a><a class="code" href="ds1631_8h.html#a1">00043</a> <span class="preprocessor">#define DS1631_CMD_STARTCONV 0x51 </span><span class="comment">///< DS1631 Start conversion command byte</span> |
||
| 51 | <a name="l00044"></a><a class="code" href="ds1631_8h.html#a2">00044</a> <span class="comment"></span>#define DS1631_CMD_STOPCONV 0x22 <span class="comment">///< DS1631 Stop conversion command byte</span> |
||
| 52 | <a name="l00045"></a><a class="code" href="ds1631_8h.html#a3">00045</a> <span class="comment"></span>#define DS1631_CMD_READTEMP 0xAA <span class="comment">///< DS1631 Read Temperature command byte</span> |
||
| 53 | <a name="l00046"></a><a class="code" href="ds1631_8h.html#a4">00046</a> <span class="comment"></span>#define DS1631_CMD_ACCESSTH 0xA1 <span class="comment">///< DS1631 TH read/write command byte</span> |
||
| 54 | <a name="l00047"></a><a class="code" href="ds1631_8h.html#a5">00047</a> <span class="comment"></span>#define DS1631_CMD_ACCESSTL 0xA2 <span class="comment">///< DS1631 TL read/write command byte</span> |
||
| 55 | <a name="l00048"></a><a class="code" href="ds1631_8h.html#a6">00048</a> <span class="comment"></span>#define DS1631_CMD_ACCESSCONFIG 0xAC <span class="comment">///< DS1631 Config read/write command byte</span> |
||
| 56 | <a name="l00049"></a><a class="code" href="ds1631_8h.html#a7">00049</a> <span class="comment"></span>#define DS1631_CMD_SWPOR 0x54 <span class="comment">///< DS1631 Software Reset command byte</span> |
||
| 57 | 00050 <span class="comment"></span> |
||
| 58 | 00051 <span class="preprocessor">#define DS1631_CONFIG_1SHOT 0x01</span> |
||
| 59 | 00052 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_POL 0x02</span> |
||
| 60 | 00053 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_R0 0x04</span> |
||
| 61 | 00054 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_R1 0x08</span> |
||
| 62 | 00055 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_NVB 0x10</span> |
||
| 63 | 00056 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_TLF 0x20</span> |
||
| 64 | 00057 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_THF 0x40</span> |
||
| 65 | 00058 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_DONE 0x80</span> |
||
| 66 | 00059 <span class="preprocessor"></span> |
||
| 67 | 00060 <span class="comment">// functions</span> |
||
| 68 | 00061 <span class="comment"></span> |
||
| 69 | 00062 <span class="comment">//! Initialize the DS1631 chip</span> |
||
| 70 | 00063 <span class="comment"></span>u08 <a class="code" href="ds1631_8c.html#a0">ds1631Init</a>(u08 i2cAddr); |
||
| 71 | 00064 <span class="comment"></span> |
||
| 72 | 00065 <span class="comment">//! Reset the DS1631 chip to its power-on defaults</span> |
||
| 73 | 00066 <span class="comment"></span>u08 <a class="code" href="ds1631_8c.html#a1">ds1631Reset</a>(u08 i2cAddr); |
||
| 74 | 00067 <span class="comment"></span> |
||
| 75 | 00068 <span class="comment">//! Set the configuration byte of the DS1631</span> |
||
| 76 | 00069 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a2">ds1631SetConfig</a>(u08 i2cAddr, u08 config); |
||
| 77 | 00070 <span class="comment"></span> |
||
| 78 | 00071 <span class="comment">//! Get the configuration byte of the DS1631</span> |
||
| 79 | 00072 <span class="comment"></span>u08 <a class="code" href="ds1631_8c.html#a3">ds1631GetConfig</a>(u08 i2cAddr); |
||
| 80 | 00073 <span class="comment"></span> |
||
| 81 | 00074 <span class="comment">//! Start a temperature conversion</span> |
||
| 82 | 00075 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a4">ds1631StartConvert</a>(u08 i2cAddr); |
||
| 83 | 00076 <span class="comment"></span> |
||
| 84 | 00077 <span class="comment">//! Stop a temperature conversion (or stop continuous conversion mode)</span> |
||
| 85 | 00078 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a5">ds1631StopConvert</a>(u08 i2cAddr); |
||
| 86 | 00079 <span class="comment"></span> |
||
| 87 | 00080 <span class="comment">//! Read the result of a temperature conversion</span> |
||
| 88 | 00081 <span class="comment"></span>s16 <a class="code" href="ds1631_8c.html#a6">ds1631ReadTemp</a>(u08 i2cAddr); |
||
| 89 | 00082 <span class="comment"></span> |
||
| 90 | 00083 <span class="comment">//! Set the Temp-High threshold</span> |
||
| 91 | 00084 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a7">ds1631SetTH</a>(u08 i2cAddr, s16 value); |
||
| 92 | 00085 <span class="comment"></span> |
||
| 93 | 00086 <span class="comment">//! Set the Temp-Low threshold</span> |
||
| 94 | 00087 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8c.html#a8">ds1631SetTL</a>(u08 i2cAddr, s16 value); |
||
| 95 | 00088 <span class="comment"></span> |
||
| 96 | 00089 <span class="comment">//! Get the Temp-High threshold</span> |
||
| 97 | 00090 <span class="comment"></span>s16 <a class="code" href="ds1631_8c.html#a9">ds1631GetTH</a>(u08 i2cAddr); |
||
| 98 | 00091 <span class="comment"></span> |
||
| 99 | 00092 <span class="comment">//! Get the Temp-Low threshold</span> |
||
| 100 | 00093 <span class="comment"></span>s16 <a class="code" href="ds1631_8c.html#a10">ds1631GetTL</a>(u08 i2cAddr); |
||
| 101 | 00094 |
||
| 102 | 00095 <span class="keywordtype">void</span> ds1631WriteTempReg(u08 i2cAddr, u08 cmd, s16 value); |
||
| 103 | 00096 s16 ds1631ReadTempReg(u08 i2cAddr, u08 cmd); |
||
| 104 | 00097 |
||
| 105 | 00098 |
||
| 106 | 00099 <span class="preprocessor">#endif</span> |
||
| 107 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by |
||
| 108 | <a href="http://www.doxygen.org/index.html"> |
||
| 109 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
| 110 | </body> |
||
| 111 | </html> |
Powered by WebSVN v2.8.3