📄 ds1631_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Procyon AVRlib: ds1631.h Source File</title><link href="dox.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.6 --><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="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>ds1631.h</h1><a href="ds1631_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*! \file ds1631.h \brief Dallas DS1631 Temperature Sensor Driver Library. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name : 'ds1631.h'</span>00005 <span class="comment">// Title : Dallas DS1631 Temperature Sensor Driver Library</span>00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2004</span>00007 <span class="comment">// Created : 2004.02.10</span>00008 <span class="comment">// Revised : 2004.02.19</span>00009 <span class="comment">// Version : 0.1</span>00010 <span class="comment">// Target MCU : Atmel AVR Series</span>00011 <span class="comment">// Editor Tabs : 4</span>00012 <span class="comment">//</span>00013 <span class="comment">// NOTE: This code is currently below version 1.0, and therefore is considered</span>00014 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span>00015 <span class="comment">// tested. Nonetheless, you can expect most functions to work.</span>00016 <span class="comment">//</span>00017 <span class="comment">// This code is distributed under the GNU Public License</span>00018 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>00019 <span class="comment">//</span>00020 <span class="comment">//*****************************************************************************</span>00021 00022 <span class="preprocessor">#ifndef DS1631_H</span>00023 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_H</span>00024 <span class="preprocessor"></span>00025 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00026 00027 <span class="comment">// constants/macros/typdefs</span>00028 <span class="preprocessor">#define DS1631_I2C_ADDR 0x90 //< Base I2C address of DS1631 devices</span>00029 <span class="preprocessor"></span>00030 <span class="preprocessor">#define DS1631_CMD_STARTCONV 0x51 //< DS1631 Start conversion command byte</span>00031 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CMD_STOPCONV 0x22 //< DS1631 Stop conversion command byte</span>00032 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CMD_READTEMP 0xAA //< DS1631 Read Temperature command byte</span>00033 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CMD_ACCESSTH 0xA1 //< DS1631 TH read/write command byte</span>00034 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CMD_ACCESSTL 0xA2 //< DS1631 TL read/write command byte</span>00035 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CMD_ACCESSCONFIG 0xAC //< DS1631 Config read/write command byte</span>00036 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CMD_SWPOR 0x54 //< DS1631 Software Reset command byte</span>00037 <span class="preprocessor"></span>00038 <span class="preprocessor">#define DS1631_CONFIG_1SHOT 0x01</span>00039 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_POL 0x02</span>00040 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_R0 0x04</span>00041 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_R1 0x08</span>00042 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_NVB 0x10</span>00043 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_TLF 0x20</span>00044 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_THF 0x40</span>00045 <span class="preprocessor"></span><span class="preprocessor">#define DS1631_CONFIG_DONE 0x80</span>00046 <span class="preprocessor"></span>00047 <span class="comment">// functions</span>00048 <span class="comment"></span>00049 <span class="comment">//! Initialize the DS1631 chip</span>00050 <span class="comment"></span>u08 <a class="code" href="ds1631_8h.html#a16">ds1631Init</a>(u08 i2cAddr);00051 <span class="comment"></span>00052 <span class="comment">//! Reset the DS1631 chip to its power-on defaults</span>00053 <span class="comment"></span>u08 <a class="code" href="ds1631_8h.html#a17">ds1631Reset</a>(u08 i2cAddr);00054 <span class="comment"></span>00055 <span class="comment">//! Set the configuration byte of the DS1631</span>00056 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8h.html#a18">ds1631SetConfig</a>(u08 i2cAddr, u08 config);00057 <span class="comment"></span>00058 <span class="comment">//! Get the configuration byte of the DS1631</span>00059 <span class="comment"></span>u08 <a class="code" href="ds1631_8h.html#a19">ds1631GetConfig</a>(u08 i2cAddr);00060 <span class="comment"></span>00061 <span class="comment">//! Start a temperature conversion</span>00062 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8h.html#a20">ds1631StartConvert</a>(u08 i2cAddr);00063 <span class="comment"></span>00064 <span class="comment">//! Stop a temperature conversion (or stop continuous conversion mode)</span>00065 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8h.html#a21">ds1631StopConvert</a>(u08 i2cAddr);00066 <span class="comment"></span>00067 <span class="comment">//! Read the result of a temperature conversion</span>00068 <span class="comment"></span>s16 <a class="code" href="ds1631_8h.html#a22">ds1631ReadTemp</a>(u08 i2cAddr);00069 <span class="comment"></span>00070 <span class="comment">//! Set the Temp-High threshold</span>00071 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8h.html#a23">ds1631SetTH</a>(u08 i2cAddr, s16 value);00072 <span class="comment"></span>00073 <span class="comment">//! Set the Temp-Low threshold</span>00074 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="ds1631_8h.html#a24">ds1631SetTL</a>(u08 i2cAddr, s16 value);00075 <span class="comment"></span>00076 <span class="comment">//! Get the Temp-High threshold</span>00077 <span class="comment"></span>s16 <a class="code" href="ds1631_8h.html#a25">ds1631GetTH</a>(u08 i2cAddr);00078 <span class="comment"></span>00079 <span class="comment">//! Get the Temp-Low threshold</span>00080 <span class="comment"></span>s16 <a class="code" href="ds1631_8h.html#a26">ds1631GetTL</a>(u08 i2cAddr);00081 00082 <span class="keywordtype">void</span> ds1631WriteTempReg(u08 i2cAddr, u08 cmd, s16 value);00083 s16 ds1631ReadTempReg(u08 i2cAddr, u08 cmd);00084 00085 00086 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Oct 15 03:50:21 2004 for Procyon AVRlib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 > </a>1.3.6 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -