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

library

?curdirlinks? -

Blame information for rev 6

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: extint.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&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>
8 <h1>extint.h</h1><a href="extint_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file extint.h \brief External-Interrupt function library. */</span>
9 00002 <span class="comment">//*****************************************************************************</span>
10 00003 <span class="comment">//</span>
11 00004 <span class="comment">// File Name : 'extint.h'</span>
12 00005 <span class="comment">// Title : External-Interrupt function library</span>
13 00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2002-2004</span>
14 00007 <span class="comment">// Created : 5/10/2002</span>
15 00008 <span class="comment">// Revised : 11/16/2004</span>
16 00009 <span class="comment">// Version : 1.0</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">// Notes: This library provides convenient standardized configuration and</span>
21 00014 <span class="comment">// access to external interrupts. The library is designed to make</span>
22 00015 <span class="comment">// it possible to write code that uses external interrupts without</span>
23 00016 <span class="comment">// digging into the processor datasheets to find register names and</span>
24 00017 <span class="comment">// bit-defines. The library also strives to allow code which uses</span>
25 00018 <span class="comment">// external interrupts to more easily cross-compile between different</span>
26 00019 <span class="comment">// microcontrollers.</span>
27 00020 <span class="comment">//</span>
28 00021 <span class="comment">// NOTE: Using this library has certain advantages, but also adds</span>
29 00022 <span class="comment">// overhead and latency to interrupt servicing. If the smallest</span>
30 00023 <span class="comment">// code size or fastest possible latency is needed, do NOT use this</span>
31 00024 <span class="comment">// library; link your interrupts directly.</span>
32 00025 <span class="comment">//</span>
33 00026 <span class="comment">//*****************************************************************************</span>
34 00027
35 00028 <span class="preprocessor">#ifndef EXTINT_H</span>
36 00029 <span class="preprocessor"></span><span class="preprocessor">#define EXTINT_H</span>
37 00030 <span class="preprocessor"></span>
38 00031 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>
39 00032
40 00033 <span class="comment">// constants/macros/typdefs</span>
41 00034
42 00035 <span class="comment">// interrupt macros for attaching user functions to external interrupts</span>
43 00036 <span class="comment">// use these with extintAttach( intNum, function )</span>
44 <a name="l00037"></a><a class="code" href="extint_8h.html#a0">00037</a> <span class="preprocessor">#define EXTINT0 0x00 </span><span class="comment">///&lt; External Interrupt 0</span>
45 <a name="l00038"></a><a class="code" href="extint_8h.html#a1">00038</a> <span class="comment"></span>#define EXTINT1 0x01 <span class="comment">///&lt; External Interrupt 1</span>
46 <a name="l00039"></a><a class="code" href="extint_8h.html#a2">00039</a> <span class="comment"></span>#define EXTINT2 0x02 <span class="comment">///&lt; External Interrupt 2</span>
47 <a name="l00040"></a><a class="code" href="extint_8h.html#a3">00040</a> <span class="comment"></span>#define EXTINT3 0x03 <span class="comment">///&lt; External Interrupt 3</span>
48 <a name="l00041"></a><a class="code" href="extint_8h.html#a4">00041</a> <span class="comment"></span>#define EXTINT4 0x04 <span class="comment">///&lt; External Interrupt 4</span>
49 <a name="l00042"></a><a class="code" href="extint_8h.html#a5">00042</a> <span class="comment"></span>#define EXTINT5 0x05 <span class="comment">///&lt; External Interrupt 5</span>
50 <a name="l00043"></a><a class="code" href="extint_8h.html#a6">00043</a> <span class="comment"></span>#define EXTINT6 0x06 <span class="comment">///&lt; External Interrupt 6</span>
51 <a name="l00044"></a><a class="code" href="extint_8h.html#a7">00044</a> <span class="comment"></span>#define EXTINT7 0x07 <span class="comment">///&lt; External Interrupt 7</span>
52 00045 <span class="comment"></span>
53 <a name="l00046"></a><a class="code" href="extint_8h.html#a8">00046</a> <span class="preprocessor">#define EXTINT_LEVEL_LOW 0x00 </span><span class="comment">///&lt; Trigger on low level</span>
54 <a name="l00047"></a><a class="code" href="extint_8h.html#a9">00047</a> <span class="comment"></span>#define EXTINT_EDGE_ANY 0x01 <span class="comment">///&lt; Trigger on any edge</span>
55 <a name="l00048"></a><a class="code" href="extint_8h.html#a10">00048</a> <span class="comment"></span>#define EXTINT_EDGE_FALLING 0x02 <span class="comment">///&lt; Trigger on falling edge</span>
56 <a name="l00049"></a><a class="code" href="extint_8h.html#a11">00049</a> <span class="comment"></span>#define EXTINT_EDGE_RISING 0x03 <span class="comment">///&lt; Trigger on rising edge</span>
57 00050 <span class="comment"></span>
58 00051 <span class="comment">// type of interrupt handler to use</span>
59 00052 <span class="comment">// *do not change unless you know what you're doing</span>
60 00053 <span class="comment">// Value may be SIGNAL or INTERRUPT</span>
61 00054 <span class="preprocessor">#ifndef EXTINT_INTERRUPT_HANDLER</span>
62 00055 <span class="preprocessor"></span><span class="preprocessor">#define EXTINT_INTERRUPT_HANDLER SIGNAL</span>
63 00056 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
64 00057 <span class="preprocessor"></span>
65 00058 <span class="comment">// processor-adaptive defines</span>
66 00059 <span class="comment">// mainstream AVR processors generally have 1,2,3, or 8 external interrupts</span>
67 00060 <span class="comment">// (if someone has a better idea of how to manage this, let me know)</span>
68 00061 <span class="preprocessor">#ifdef SIG_INTERRUPT7</span>
69 00062 <span class="preprocessor"></span><span class="preprocessor"> #define EXTINT_NUM_INTERRUPTS 8</span>
70 00063 <span class="preprocessor"></span><span class="preprocessor">#else</span>
71 00064 <span class="preprocessor"></span><span class="preprocessor">#ifdef SIG_INTERRUPT2</span>
72 00065 <span class="preprocessor"></span><span class="preprocessor"> #define EXTINT_NUM_INTERRUPTS 3</span>
73 00066 <span class="preprocessor"></span><span class="preprocessor">#else</span>
74 00067 <span class="preprocessor"></span><span class="preprocessor">#ifdef SIG_INTERRUPT1</span>
75 00068 <span class="preprocessor"></span><span class="preprocessor"> #define EXTINT_NUM_INTERRUPTS 2</span>
76 00069 <span class="preprocessor"></span><span class="preprocessor">#else</span>
77 00070 <span class="preprocessor"></span><span class="preprocessor"> #define EXTINT_NUM_INTERRUPTS 1</span>
78 00071 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
79 00072 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
80 00073 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
81 00074 <span class="preprocessor"></span>
82 00075 <span class="comment">// functions</span>
83 00076 <span class="comment"></span>
84 00077 <span class="comment">//! initializes extint library</span>
85 00078 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="extint_8c.html#a2">extintInit</a>(<span class="keywordtype">void</span>);
86 00079 <span class="comment"></span>
87 00080 <span class="comment">//! Configure external interrupt trigger</span>
88 00081 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="extint_8c.html#a3">extintConfigure</a>(u08 interruptNum, u08 configuration);
89 00082
90 00083 <span class="comment">// extintAttach and extintDetach commands</span>
91 00084 <span class="comment">// These functions allow the attachment (or detachment) of any user</span>
92 00085 <span class="comment">// function to an external interrupt. "Attaching" one of your own</span>
93 00086 <span class="comment">// functions to an interrupt means that it will be called whenever</span>
94 00087 <span class="comment">// that interrupt is triggered. Example usage:</span>
95 00088 <span class="comment">//</span>
96 00089 <span class="comment">// extintAttach(EXTINT0, myInterruptHandler);</span>
97 00090 <span class="comment">// extintDetach(EXTINT0);</span>
98 00091 <span class="comment">//</span>
99 00092 <span class="comment">// extintAttach causes the myInterruptHandler() to be attached, and therefore</span>
100 00093 <span class="comment">// execute, whenever the corresponding interrupt occurs. extintDetach removes</span>
101 00094 <span class="comment">// the association and executes no user function when the interrupt occurs.</span>
102 00095 <span class="comment">// myInterruptFunction must be defined with no return value and no arguments:</span>
103 00096 <span class="comment">//</span>
104 00097 <span class="comment">// void myInterruptHandler(void) { ... }</span>
105 00098 <span class="comment"></span>
106 00099 <span class="comment">//! Attach a user function to an external interrupt</span>
107 00100 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="extint_8c.html#a4">extintAttach</a>(u08 interruptNum, <span class="keywordtype">void</span> (*userHandler)(<span class="keywordtype">void</span>) );<span class="comment"></span>
108 00101 <span class="comment">//! Detach a user function from an external interrupt</span>
109 00102 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="extint_8c.html#a5">extintDetach</a>(u08 interruptNum);
110 00103
111 00104 <span class="preprocessor">#endif</span>
112 </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:06 2006 for Procyon AVRlib by&nbsp;
113 <a href="http://www.doxygen.org/index.html">
114 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
115 </body>
116 </html>
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3