Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

timer.h

00001 /* Copyright (c) 2002, Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009    * Redistributions in binary form must reproduce the above copyright
00010      notice, this list of conditions and the following disclaimer in
00011      the documentation and/or other materials provided with the
00012      distribution.
00013 
00014   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00015   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00018   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00019   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00020   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00021   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00022   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00023   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00024   POSSIBILITY OF SUCH DAMAGE. */
00025 
00026 #ifndef _AVR_TIMER_H_
00027 #define _AVR_TIMER_H_
00028 
00029 #include <avr/io.h>
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 enum {
00036   STOP             = 0,
00037   CK               = 1,
00038   CK8              = 2,
00039   CK64             = 3,
00040   CK256            = 4,
00041   CK1024           = 5,
00042   T0_FALLING_EDGE  = 6,
00043   T0_RISING_EDGE   = 7
00044 };
00045 
00046 static inline void timer0_source (unsigned int src)
00047 {
00048   outb(TCCR0, src);
00049 }
00050 
00051 static inline void timer0_stop (void)
00052 {
00053   outb(TCNT0, 0);
00054 }
00055 
00056 static inline void timer0_start (void)
00057 {
00058   outb(TCNT0, 1);
00059 }
00060 
00061 #ifdef __cplusplus
00062 }
00063 #endif
00064 
00065 #endif /* _AVR_TIMER_H_ */

Generated on Thu Jan 30 22:30:52 2003 for EduNet by doxygen1.2.18