mos/dev/include/avr-adc.h

Go to the documentation of this file.
00001 //  This file is part of MOS, the MANTIS Operating System
00002 //  See http://mantis.cs.colorado.edu/
00003 //
00004 //  Copyright (c) 2002 - 2007 University of Colorado, Boulder
00005 //
00006 //   All rights reserved.
00007 //
00008 //   Redistribution and use in source and binary forms, with or without
00009 //   modification, are permitted provided that the following conditions are
00010 //   met:
00011 //
00012 //       * Redistributions of source code must retain the above copyright
00013 //         notice, this list of conditions and the following disclaimer.
00014 //       * Redistributions in binary form must reproduce the above
00015 //         copyright notice, this list of conditions and the following
00016 //         disclaimer in the documentation and/or other materials provided
00017 //         with the distribution. 
00018 //       * Neither the name of the MANTIS Project nor the names of its
00019 //         contributors may be used to endorse or promote products derived
00020 //         from this software without specific prior written permission.
00021 //
00022 //   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 //   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 //   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025 //   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026 //   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027 //   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028 //   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029 //   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030 //   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 //   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032 //   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033 //   POSSIBILITY OF SUCH DAMAGE.
00034 
00053 #ifndef _AVR_ADC_H_
00054 #define _AVR_ADC_H_
00055 
00056 
00057 #define AVR_ADC_AVERAGING_ON 1
00058 #define AVR_ADC_AVERAGING_OFF 2
00059 //function prototype
00060 
00061 
00062 uint16_t rssi_poll (void);
00063 
00064 /* ADC clock prescaler values:
00065    (Slower conversion is more accurate and uses less power, but the
00066    conversion rate (clk. freq. / prescaler) should be at least 50 khz.)
00067 */
00068 #define AVR_ADC_PRESCALE_2 0x00 // Fastest
00069 #define AVR_ADC_PRESCALE_4 0x02 
00070 #define AVR_ADC_PRESCALE_8 0x03 
00071 #define AVR_ADC_PRESCALE_16 0x04        
00072 #define AVR_ADC_PRESCALE_32 0x05        
00073 #define AVR_ADC_PRESCALE_64 0x06 // Recommended level for 4mhz clock
00074 #define AVR_ADC_PRESCALE_128 0x07 // Slowest
00075 
00076 #define AVR_ADC_PRESCALE_MASK 0x07 // Register mask for setting prescaler
00077 
00078 /* ADC voltage reference:
00079    (Either an internal voltage reference of 2.56v or the AVCC pin)
00080 */
00081 #define AVR_ADC_VREF_AVCC 0x01 // AVCC 
00082 #define AVR_ADC_VREF_IREF 0x03 // Internal 2.56v reference
00083 
00084 #define AVR_ADC_VREF_MASK 0xC0 // Register mask for setting vref
00085 
00086 
00087 /* ADC channel selection:
00088    (Selects which input pin to use for the conversion.)
00089 */
00090 #define AVR_ADC_CH_0            0x00
00091 #define AVR_ADC_CH_1            0x01
00092 #define AVR_ADC_CH_2            0x02
00093 #define AVR_ADC_CH_3            0x03
00094 #define AVR_ADC_CH_4            0x04
00095 #define AVR_ADC_CH_5            0x05
00096 #define AVR_ADC_CH_6            0x06
00097 #define AVR_ADC_CH_7            0x07
00098 
00099 #define AVR_ADC_CH_MASK         0x07
00100 
00101 #endif

Generated on Mon Nov 23 06:25:59 2009 for MANTIS by  doxygen 1.4.6