?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{FILE START}

library

?curdirlinks? - Rev 6

?prevdifflink? - Blame - ?getfile?

<!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: lis3l02.h Source File</title>
<link href="dox.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>lis3l02.h</h1><a href="lis3l02_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file lis3l02.h \brief ST LIS3L02 3-axis I2C Accelerometer Library. */</span>
00002 <span class="comment">//*****************************************************************************</span>
00003 <span class="comment">//</span>
00004 <span class="comment">// File Name    : 'lis3l02.h'</span>
00005 <span class="comment">// Title        : ST LIS3L02 3-axis I2C Accelerometer Library</span>
00006 <span class="comment">// Author       : Pascal Stang - Copyright (C) 2004</span>
00007 <span class="comment">// Created      : 2004.10.23</span>
00008 <span class="comment">// Revised      : 2004.12.14</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><span class="comment"></span>
00017 <span class="comment">/// \ingroup driver_hw</span>
00018 <span class="comment">/// \defgroup lis3l02 ST LIS3L02 3-axis I2C Accelerometer Library (lis3l02.c)</span>
00019 <span class="comment">/// \code #include "lis3l02.h" \endcode</span>
00020 <span class="comment">/// \par Overview</span>
00021 <span class="comment">///     This library provides an interface to the ST LIS3L02 integrated 3-axis</span>
00022 <span class="comment">/// accelerometer.  The LIS3L02 has a built-in A/D converter to capture analog</span>
00023 <span class="comment">/// acceleration data and make it available over an I2C interface.</span>
00024 <span class="comment"></span><span class="comment">//</span>
00025 <span class="comment">// This code is distributed under the GNU Public License</span>
00026 <span class="comment">//      which can be found at http://www.gnu.org/licenses/gpl.txt</span>
00027 <span class="comment">//</span>
00028 <span class="comment">//*****************************************************************************</span>
00029 
00030 <span class="preprocessor">#ifndef LIS3L02_H</span>
00031 <span class="preprocessor"></span><span class="preprocessor">#define LIS3L02_H</span>
00032 <span class="preprocessor"></span>
00033 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>
00034 
00035 <span class="comment">// constants/macros/typdefs</span>
<a name="l00036"></a><a class="code" href="lis3l02_8h.html#a0">00036</a> <span class="preprocessor">#define LIS3L02_I2C_ADDR        0x3A    </span><span class="comment">///&lt; Base I2C address of LIS3L02 device</span>
00037 <span class="comment"></span>
00038 <span class="comment">// LIS3L02 register address defines</span>
<a name="l00039"></a><a class="code" href="lis3l02_8h.html#a1">00039</a> <span class="preprocessor">#define LIS3L02_REG_OFFSETX     0x16    </span><span class="comment">///&lt; LIS3L02 X-axis digital offset trim</span>
<a name="l00040"></a><a class="code" href="lis3l02_8h.html#a2">00040</a> <span class="comment"></span>#define LIS3L02_REG_OFFSETY     0x17    <span class="comment">///&lt; LIS3L02 Y-axis digital offset trim</span>
<a name="l00041"></a><a class="code" href="lis3l02_8h.html#a3">00041</a> <span class="comment"></span>#define LIS3L02_REG_OFFSETZ     0x18    <span class="comment">///&lt; LIS3L02 Z-axis digital offset trim</span>
<a name="l00042"></a><a class="code" href="lis3l02_8h.html#a4">00042</a> <span class="comment"></span>#define LIS3L02_REG_GAINX       0x19    <span class="comment">///&lt; LIS3L02 X-axis digital gain trim</span>
<a name="l00043"></a><a class="code" href="lis3l02_8h.html#a5">00043</a> <span class="comment"></span>#define LIS3L02_REG_GAINY       0x1A    <span class="comment">///&lt; LIS3L02 Y-axis digital gain trim</span>
<a name="l00044"></a><a class="code" href="lis3l02_8h.html#a6">00044</a> <span class="comment"></span>#define LIS3L02_REG_GAINZ       0x1B    <span class="comment">///&lt; LIS3L02 Z-axis digital gain trim</span>
<a name="l00045"></a><a class="code" href="lis3l02_8h.html#a7">00045</a> <span class="comment"></span>#define LIS3L02_REG_CTRLREG1    0x20    <span class="comment">///&lt; LIS3L02 interface/operation control</span>
<a name="l00046"></a><a class="code" href="lis3l02_8h.html#a8">00046</a> <span class="comment"></span>#define LIS3L02_REG_CTRLREG2    0x21    <span class="comment">///&lt; LIS3L02 interface/operation control</span>
<a name="l00047"></a><a class="code" href="lis3l02_8h.html#a9">00047</a> <span class="comment"></span>#define LIS3L02_REG_WAKEUPCFG   0x23    <span class="comment">///&lt; LIS3L02 interrupt/wakeup config</span>
<a name="l00048"></a><a class="code" href="lis3l02_8h.html#a10">00048</a> <span class="comment"></span>#define LIS3L02_REG_WAKEUPSRC   0x24    <span class="comment">///&lt; LIS3L02 interrupt/wakeup source indicator</span>
<a name="l00049"></a><a class="code" href="lis3l02_8h.html#a11">00049</a> <span class="comment"></span>#define LIS3L02_REG_WAKEUPACK   0x25    <span class="comment">///&lt; LIS3L02 wakeup source clear</span>
<a name="l00050"></a><a class="code" href="lis3l02_8h.html#a12">00050</a> <span class="comment"></span>#define LIS3L02_REG_STATUS      0x27    <span class="comment">///&lt; LIS3L02 Accelerometer Status</span>
<a name="l00051"></a><a class="code" href="lis3l02_8h.html#a13">00051</a> <span class="comment"></span>#define LIS3L02_REG_OUTXL       0x28    <span class="comment">///&lt; LIS3L02 Accelerometer X Output Low-byte</span>
<a name="l00052"></a><a class="code" href="lis3l02_8h.html#a14">00052</a> <span class="comment"></span>#define LIS3L02_REG_OUTXH       0x29    <span class="comment">///&lt; LIS3L02 Accelerometer X Output High-byte</span>
<a name="l00053"></a><a class="code" href="lis3l02_8h.html#a15">00053</a> <span class="comment"></span>#define LIS3L02_REG_OUTYL       0x2A    <span class="comment">///&lt; LIS3L02 Accelerometer Y Output Low-byte</span>
<a name="l00054"></a><a class="code" href="lis3l02_8h.html#a16">00054</a> <span class="comment"></span>#define LIS3L02_REG_OUTYH       0x2B    <span class="comment">///&lt; LIS3L02 Accelerometer Y Output High-byte</span>
<a name="l00055"></a><a class="code" href="lis3l02_8h.html#a17">00055</a> <span class="comment"></span>#define LIS3L02_REG_OUTZL       0x2C    <span class="comment">///&lt; LIS3L02 Accelerometer Z Output Low-byte</span>
<a name="l00056"></a><a class="code" href="lis3l02_8h.html#a18">00056</a> <span class="comment"></span>#define LIS3L02_REG_OUTZH       0x2D    <span class="comment">///&lt; LIS3L02 Accelerometer Z Output High-byte</span>
<a name="l00057"></a><a class="code" href="lis3l02_8h.html#a19">00057</a> <span class="comment"></span>#define LIS3L02_REG_THSL        0x2E    <span class="comment">///&lt; LIS3L02 Accelerometer Threshold Low-byte</span>
<a name="l00058"></a><a class="code" href="lis3l02_8h.html#a20">00058</a> <span class="comment"></span>#define LIS3L02_REG_THSH        0x2F    <span class="comment">///&lt; LIS3L02 Accelerometer Threshold High-byte</span>
<a name="l00059"></a><a class="code" href="lis3l02_8h.html#a21">00059</a> <span class="comment"></span>#define LIS3L02_REG_MULTIREAD   0x80    <span class="comment">///&lt; LIS3L02 Mutliple Read Bit</span>
00060 <span class="comment"></span>
00061 <span class="comment">// LIS3L02 control register 1 bit defines</span>
<a name="l00062"></a><a class="code" href="lis3l02_8h.html#a22">00062</a> <span class="preprocessor">#define LIS3L02_CTRLREG1_XEN    0x01    </span><span class="comment">///&lt; LIS3L02 CtrlReg1 X-axis Enable</span>
<a name="l00063"></a><a class="code" href="lis3l02_8h.html#a23">00063</a> <span class="comment"></span>#define LIS3L02_CTRLREG1_YEN    0x02    <span class="comment">///&lt; LIS3L02 CtrlReg1 Y-axis Enable</span>
<a name="l00064"></a><a class="code" href="lis3l02_8h.html#a24">00064</a> <span class="comment"></span>#define LIS3L02_CTRLREG1_ZEN    0x04    <span class="comment">///&lt; LIS3L02 CtrlReg1 Z-axis Enable</span>
<a name="l00065"></a><a class="code" href="lis3l02_8h.html#a25">00065</a> <span class="comment"></span>#define LIS3L02_CTRLREG1_ST     0x08    <span class="comment">///&lt; LIS3L02 CtrlReg1 Self-Test Enable</span>
<a name="l00066"></a><a class="code" href="lis3l02_8h.html#a26">00066</a> <span class="comment"></span>#define LIS3L02_CTRLREG1_DF0    0x10    <span class="comment">///&lt; LIS3L02 CtrlReg1 Decimation Factor 0</span>
<a name="l00067"></a><a class="code" href="lis3l02_8h.html#a27">00067</a> <span class="comment"></span>#define LIS3L02_CTRLREG1_DF1    0x20    <span class="comment">///&lt; LIS3L02 CtrlReg1 Decimation Factor 0</span>
<a name="l00068"></a><a class="code" href="lis3l02_8h.html#a28">00068</a> <span class="comment"></span>#define LIS3L02_CTRLREG1_PD0    0x40    <span class="comment">///&lt; LIS3L02 CtrlReg1 Power-down Control 0</span>
<a name="l00069"></a><a class="code" href="lis3l02_8h.html#a29">00069</a> <span class="comment"></span>#define LIS3L02_CTRLREG1_PD1    0x80    <span class="comment">///&lt; LIS3L02 CtrlReg1 Power-down Control 1</span>
00070 <span class="comment"></span>
00071 <span class="comment">// LIS3L02 control register 2 bit defines</span>
<a name="l00072"></a><a class="code" href="lis3l02_8h.html#a30">00072</a> <span class="preprocessor">#define LIS3L02_CTRLREG2_DAS    0x01    </span><span class="comment">///&lt; LIS3L02 CtrlReg2 Data Alignment Selection</span>
<a name="l00073"></a><a class="code" href="lis3l02_8h.html#a31">00073</a> <span class="comment"></span>#define LIS3L02_CTRLREG2_SIM    0x02    <span class="comment">///&lt; LIS3L02 CtrlReg2 SPI Mode Select</span>
<a name="l00074"></a><a class="code" href="lis3l02_8h.html#a32">00074</a> <span class="comment"></span>#define LIS3L02_CTRLREG2_DRDY   0x04    <span class="comment">///&lt; LIS3L02 CtrlReg2 Enable Data-Ready generation</span>
<a name="l00075"></a><a class="code" href="lis3l02_8h.html#a33">00075</a> <span class="comment"></span>#define LIS3L02_CTRLREG2_IEN    0x08    <span class="comment">///&lt; LIS3L02 CtrlReg2 Interrupt Enable</span>
<a name="l00076"></a><a class="code" href="lis3l02_8h.html#a34">00076</a> <span class="comment"></span>#define LIS3L02_CTRLREG2_BOOT   0x10    <span class="comment">///&lt; LIS3L02 CtrlReg2 Reboot from memory</span>
<a name="l00077"></a><a class="code" href="lis3l02_8h.html#a35">00077</a> <span class="comment"></span>#define LIS3L02_CTRLREG2_FS     0x80    <span class="comment">///&lt; LIS3L02 CtrlReg2 Full-scale Select (0=2g, 1=6g)</span>
00078 <span class="comment"></span>
00079 <span class="comment">// LIS3L02 WAKEUPCFG register bit defines</span>
<a name="l00080"></a><a class="code" href="lis3l02_8h.html#a36">00080</a> <span class="preprocessor">#define LIS3L02_WAKEUPCFG_MXL   0x01    </span><span class="comment">///&lt; LIS3L02 WAKEUPCFG Mask X Low Interrupt</span>
<a name="l00081"></a><a class="code" href="lis3l02_8h.html#a37">00081</a> <span class="comment"></span>#define LIS3L02_WAKEUPCFG_MXH   0x02    <span class="comment">///&lt; LIS3L02 WAKEUPCFG Mask X High Interrupt</span>
<a name="l00082"></a><a class="code" href="lis3l02_8h.html#a38">00082</a> <span class="comment"></span>#define LIS3L02_WAKEUPCFG_MYL   0x04    <span class="comment">///&lt; LIS3L02 WAKEUPCFG Mask Y Low Interrupt</span>
<a name="l00083"></a><a class="code" href="lis3l02_8h.html#a39">00083</a> <span class="comment"></span>#define LIS3L02_WAKEUPCFG_MYH   0x08    <span class="comment">///&lt; LIS3L02 WAKEUPCFG Mask Y High Interrupt</span>
<a name="l00084"></a><a class="code" href="lis3l02_8h.html#a40">00084</a> <span class="comment"></span>#define LIS3L02_WAKEUPCFG_MZL   0x10    <span class="comment">///&lt; LIS3L02 WAKEUPCFG Mask Z Low Interrupt</span>
<a name="l00085"></a><a class="code" href="lis3l02_8h.html#a41">00085</a> <span class="comment"></span>#define LIS3L02_WAKEUPCFG_MZH   0x20    <span class="comment">///&lt; LIS3L02 WAKEUPCFG Mask Z High Interrupt</span>
<a name="l00086"></a><a class="code" href="lis3l02_8h.html#a42">00086</a> <span class="comment"></span>#define LIS3L02_WAKEUPCFG_LIR   0x40    <span class="comment">///&lt; LIS3L02 WAKEUPCFG Latch Intr Request</span>
00087 <span class="comment"></span>
00088 <span class="comment">// LIS3L02 WAKEUPSRC register bit defines</span>
<a name="l00089"></a><a class="code" href="lis3l02_8h.html#a43">00089</a> <span class="preprocessor">#define LIS3L02_WAKEUPSRC_XL    0x01    </span><span class="comment">///&lt; LIS3L02 WAKEUPSRC X Low Interrupt</span>
<a name="l00090"></a><a class="code" href="lis3l02_8h.html#a44">00090</a> <span class="comment"></span>#define LIS3L02_WAKEUPSRC_XH    0x02    <span class="comment">///&lt; LIS3L02 WAKEUPSRC X High Interrupt</span>
<a name="l00091"></a><a class="code" href="lis3l02_8h.html#a45">00091</a> <span class="comment"></span>#define LIS3L02_WAKEUPSRC_YL    0x04    <span class="comment">///&lt; LIS3L02 WAKEUPSRC Y Low Interrupt</span>
<a name="l00092"></a><a class="code" href="lis3l02_8h.html#a46">00092</a> <span class="comment"></span>#define LIS3L02_WAKEUPSRC_YH    0x08    <span class="comment">///&lt; LIS3L02 WAKEUPSRC Y High Interrupt</span>
<a name="l00093"></a><a class="code" href="lis3l02_8h.html#a47">00093</a> <span class="comment"></span>#define LIS3L02_WAKEUPSRC_ZL    0x10    <span class="comment">///&lt; LIS3L02 WAKEUPSRC Z Low Interrupt</span>
<a name="l00094"></a><a class="code" href="lis3l02_8h.html#a48">00094</a> <span class="comment"></span>#define LIS3L02_WAKEUPSRC_ZH    0x20    <span class="comment">///&lt; LIS3L02 WAKEUPSRC Z High Interrupt</span>
<a name="l00095"></a><a class="code" href="lis3l02_8h.html#a49">00095</a> <span class="comment"></span>#define LIS3L02_WAKEUPSRC_IA    0x40    <span class="comment">///&lt; LIS3L02 WAKEUPSRC Interrupt Active</span>
00096 <span class="comment"></span>
00097 <span class="comment">// LIS3L02 WAKEUPSRC register bit defines</span>
<a name="l00098"></a><a class="code" href="lis3l02_8h.html#a50">00098</a> <span class="preprocessor">#define LIS3L02_STATUS_XDA      0x01    </span><span class="comment">///&lt; LIS3L02 STATUS X New Data Available</span>
<a name="l00099"></a><a class="code" href="lis3l02_8h.html#a51">00099</a> <span class="comment"></span>#define LIS3L02_STATUS_YDA      0x02    <span class="comment">///&lt; LIS3L02 STATUS Y New Data Available</span>
<a name="l00100"></a><a class="code" href="lis3l02_8h.html#a52">00100</a> <span class="comment"></span>#define LIS3L02_STATUS_ZDA      0x04    <span class="comment">///&lt; LIS3L02 STATUS Z New Data Available</span>
<a name="l00101"></a><a class="code" href="lis3l02_8h.html#a53">00101</a> <span class="comment"></span>#define LIS3L02_STATUS_ZYXDA    0x08    <span class="comment">///&lt; LIS3L02 STATUS XYZ New Data Available</span>
<a name="l00102"></a><a class="code" href="lis3l02_8h.html#a54">00102</a> <span class="comment"></span>#define LIS3L02_STATUS_XOR      0x10    <span class="comment">///&lt; LIS3L02 STATUS X-axis Data Overrun</span>
<a name="l00103"></a><a class="code" href="lis3l02_8h.html#a55">00103</a> <span class="comment"></span>#define LIS3L02_STATUS_YOR      0x20    <span class="comment">///&lt; LIS3L02 STATUS Y-axis Data Overrun</span>
<a name="l00104"></a><a class="code" href="lis3l02_8h.html#a56">00104</a> <span class="comment"></span>#define LIS3L02_STATUS_ZOR      0x40    <span class="comment">///&lt; LIS3L02 STATUS Z-axis Data Overrun</span>
<a name="l00105"></a><a class="code" href="lis3l02_8h.html#a57">00105</a> <span class="comment"></span>#define LIS3L02_STATUS_ZYXOR    0x80    <span class="comment">///&lt; LIS3L02 STATUS XYZ-axis Data Overrun</span>
00106 <span class="comment"></span>
00107 <span class="comment">// functions</span>
00108 <span class="comment"></span>
00109 <span class="comment">//! Initialize the LIS3L02 chip.</span>
00110 <span class="comment">/// returns:</span>
00111 <span class="comment">/// 0 if successful, </span>
00112 <span class="comment">/// non-zero if unsuccessful (chip not present).</span>
00113 <span class="comment"></span>u08 <a class="code" href="lis3l02_8c.html#a0">lis3l02Init</a>(<span class="keywordtype">void</span>);
00114 <span class="comment"></span>
00115 <span class="comment">//! Reset the LIS3L02 chip.</span>
00116 <span class="comment"></span>u08 <a class="code" href="lis3l02_8c.html#a1">lis3l02Reset</a>(<span class="keywordtype">void</span>);
00117 <span class="comment"></span>
00118 <span class="comment">//! Read a LIS3L02 register.</span>
00119 <span class="comment"></span>u08 <a class="code" href="lis3l02_8c.html#a2">lis3l02ReadReg</a>(u08 reg);
00120 <span class="comment"></span>
00121 <span class="comment">//! Write a LIS3L02 register.</span>
00122 <span class="comment"></span>u08 <a class="code" href="lis3l02_8c.html#a3">lis3l02WriteReg</a>(u08 reg, u08 data);
00123 <span class="comment"></span>
00124 <span class="comment">//! Get an acceleration reading from the LIS3L02 sensor.</span>
00125 <span class="comment"></span>s16 <a class="code" href="lis3l02_8c.html#a4">lis3l02GetAccel</a>(u08 chxyz);
00126 
00127 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
{FILE END}
{FOOTER START}

Powered by WebSVN v2.8.3