⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 extint_8h-source.html

📁 国外牛人公开的AVR代码
💻 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: extint.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>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>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name    : 'extint.h'</span>00005 <span class="comment">// Title        : External-Interrupt function library</span>00006 <span class="comment">// Author       : Pascal Stang - Copyright (C) 2002-2004</span>00007 <span class="comment">// Created      : 5/10/2002</span>00008 <span class="comment">// Revised      : 11/16/2004</span>00009 <span class="comment">// Version      : 1.0</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">// Notes:   This library provides convenient standardized configuration and</span>00014 <span class="comment">//          access to external interrupts.  The library is designed to make</span>00015 <span class="comment">//          it possible to write code that uses external interrupts without</span>00016 <span class="comment">//          digging into the processor datasheets to find register names and</span>00017 <span class="comment">//          bit-defines.  The library also strives to allow code which uses</span>00018 <span class="comment">//          external interrupts to more easily cross-compile between different</span>00019 <span class="comment">//          microcontrollers.</span>00020 <span class="comment">//</span>00021 <span class="comment">//          NOTE: Using this library has certain advantages, but also adds</span>00022 <span class="comment">//          overhead and latency to interrupt servicing.  If the smallest</span>00023 <span class="comment">//          code size or fastest possible latency is needed, do NOT use this</span>00024 <span class="comment">//          library; link your interrupts directly.</span>00025 <span class="comment">//</span>00026 <span class="comment">//*****************************************************************************</span>00027 00028 <span class="preprocessor">#ifndef EXTINT_H</span>00029 <span class="preprocessor"></span><span class="preprocessor">#define EXTINT_H</span>00030 <span class="preprocessor"></span>00031 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00032 00033 <span class="comment">// constants/macros/typdefs</span>00034 00035 <span class="comment">// interrupt macros for attaching user functions to external interrupts</span>00036 <span class="comment">// use these with extintAttach( intNum, function )</span><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><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><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><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><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><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><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><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>00045 <span class="comment"></span><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><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><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><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>00050 <span class="comment"></span>00051 <span class="comment">// type of interrupt handler to use</span>00052 <span class="comment">// *do not change unless you know what you're doing</span>00053 <span class="comment">// Value may be SIGNAL or INTERRUPT</span>00054 <span class="preprocessor">#ifndef EXTINT_INTERRUPT_HANDLER</span>00055 <span class="preprocessor"></span><span class="preprocessor">#define EXTINT_INTERRUPT_HANDLER    SIGNAL</span>00056 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00057 <span class="preprocessor"></span>00058 <span class="comment">// processor-adaptive defines</span>00059 <span class="comment">// mainstream AVR processors generally have 1,2,3, or 8 external interrupts</span>00060 <span class="comment">// (if someone has a better idea of how to manage this, let me know)</span>00061 <span class="preprocessor">#ifdef SIG_INTERRUPT7</span>00062 <span class="preprocessor"></span><span class="preprocessor">    #define EXTINT_NUM_INTERRUPTS   8</span>00063 <span class="preprocessor"></span><span class="preprocessor">#else</span>00064 <span class="preprocessor"></span><span class="preprocessor">#ifdef SIG_INTERRUPT2</span>00065 <span class="preprocessor"></span><span class="preprocessor">    #define EXTINT_NUM_INTERRUPTS   3</span>00066 <span class="preprocessor"></span><span class="preprocessor">#else</span>00067 <span class="preprocessor"></span><span class="preprocessor">#ifdef SIG_INTERRUPT1</span>00068 <span class="preprocessor"></span><span class="preprocessor">    #define EXTINT_NUM_INTERRUPTS   2</span>00069 <span class="preprocessor"></span><span class="preprocessor">#else</span>00070 <span class="preprocessor"></span><span class="preprocessor">    #define EXTINT_NUM_INTERRUPTS   1</span>00071 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00072 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00073 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00074 <span class="preprocessor"></span>00075 <span class="comment">// functions</span>00076 <span class="comment"></span>00077 <span class="comment">//! initializes extint library</span>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>);00079 <span class="comment"></span>00080 <span class="comment">//! Configure external interrupt trigger</span>00081 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="extint_8c.html#a3">extintConfigure</a>(u08 interruptNum, u08 configuration);00082 00083 <span class="comment">// extintAttach and extintDetach commands</span>00084 <span class="comment">//      These functions allow the attachment (or detachment) of any user</span>00085 <span class="comment">//      function to an external interrupt.  "Attaching" one of your own</span>00086 <span class="comment">//      functions to an interrupt means that it will be called whenever</span>00087 <span class="comment">//      that interrupt is triggered.  Example usage:</span>00088 <span class="comment">//</span>00089 <span class="comment">//      extintAttach(EXTINT0, myInterruptHandler);</span>00090 <span class="comment">//      extintDetach(EXTINT0);</span>00091 <span class="comment">//</span>00092 <span class="comment">//      extintAttach causes the myInterruptHandler() to be attached, and therefore</span>00093 <span class="comment">//      execute, whenever the corresponding interrupt occurs.  extintDetach removes</span>00094 <span class="comment">//      the association and executes no user function when the interrupt occurs.</span>00095 <span class="comment">//      myInterruptFunction must be defined with no return value and no arguments:</span>00096 <span class="comment">//</span>00097 <span class="comment">//      void myInterruptHandler(void) { ... }</span>00098 <span class="comment"></span>00099 <span class="comment">//! Attach a user function to an external interrupt</span>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>00101 <span class="comment">//! Detach a user function from an external interrupt</span>00102 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="extint_8c.html#a5">extintDetach</a>(u08 interruptNum);00103 00104 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Oct 24 16:03:54 2005 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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -