Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

timer.h

00001 /*! \file timer.h \brief Timer Support Library for LPC2100. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'timer.h'
00005 // Title        : Timer Support Library for LPC2100
00006 // Author       : Pascal Stang - Copyright (C) 2004
00007 // Created      : 2004.05.05
00008 // Revised      : 2004.07.12
00009 // Version      : 0.1
00010 // Target MCU   : ARM processors
00011 // Editor Tabs  : 4
00012 //
00013 // NOTE: This code is currently below version 1.0, and therefore is considered
00014 // to be lacking in some functionality or documentation, or may not be fully
00015 // tested.  Nonetheless, you can expect most functions to work.
00016 //
00017 // This code is distributed under the GNU Public License
00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00019 //
00020 //*****************************************************************************
00021 
00022 #ifndef TIMER_H
00023 #define TIMER_H
00024 
00025 #include "global.h"
00026 
00027 // defines
00028 #define TIMER0MATCH0_INT        0
00029 #define TIMER0MATCH1_INT        1
00030 #define TIMER0MATCH2_INT        2
00031 #define TIMER0MATCH3_INT        3
00032 #define TIMER0CAPTURE0_INT      4
00033 #define TIMER0CAPTURE1_INT      5
00034 #define TIMER0CAPTURE2_INT      6
00035 //#define TIMER0CAPTURE3_INT    7
00036 #define TIMER1MATCH0_INT        8
00037 #define TIMER1MATCH1_INT        9
00038 #define TIMER1MATCH2_INT        10
00039 #define TIMER1MATCH3_INT        11
00040 #define TIMER1CAPTURE0_INT      12
00041 #define TIMER1CAPTURE1_INT      13
00042 #define TIMER1CAPTURE2_INT      14
00043 #define TIMER1CAPTURE3_INT      15
00044 
00045 #define TIMER_NUM_INTERRUPTS    16
00046 
00047 // edges
00048 #define TIMER_CAPTURE_NONE      0x00
00049 #define TIMER_CAPTURE_RISING    0x01
00050 #define TIMER_CAPTURE_FALLING   0x02
00051 
00052 // functions
00053 void delay(unsigned long d);
00054 #define delay_ms    timerPause
00055 
00056 void timerInit(void);
00057 void timer0Init(void);
00058 void timer1Init(void);
00059 
00060 //! Attach a user function to a timer interrupt
00061 void timerAttach(u08 interruptNum, void (*userFunc)(void) );
00062 //! Detach a user function from a timer interrupt
00063 void timerDetach(u08 interruptNum);
00064 
00065 
00066 void timer0PrescalerSet(u32 clockDiv);
00067 void timer1PrescalerSet(u32 clockDiv);
00068 
00069 void timerPause(unsigned long pause_ms);
00070 
00071 void timer0ClearOverflowCount(void);
00072 u32 timer0GetOverflowCount(void);
00073 void timer1ClearOverflowCount(void);
00074 u32 timer1GetOverflowCount(void);
00075 
00076 
00077 void timer0Match0Set(u32 value);
00078 void timer0Match1Set(u32 value);
00079 
00080 void timer1Match0Set(u32 value);
00081 void timer1Match1Set(u32 value);
00082 
00083 void timer0Capture0Init(unsigned int edge);
00084 void timer0Capture1Init(unsigned int edge);
00085 void timer1Capture0Init(unsigned int edge);
00086 void timer1Capture1Init(unsigned int edge);
00087 
00088 void timer0Service(void) __attribute__((naked));
00089 void timer1Service(void) __attribute__((naked));
00090 
00091 #endif

Generated on Mon Nov 6 23:36:58 2006 for Procyon ARMlib by  doxygen 1.4.2