MHVLib
20111011
An efficiency oriented runtime library for AVR microcontrollers
|
00001 /* 00002 * Copyright (c) 2011, Make, Hack, Void Inc 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 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 the 00011 * documentation and/or other materials provided with the distribution. 00012 * * Neither the name of the Make, Hack, Void nor the 00013 * names of its contributors may be used to endorse or promote products 00014 * derived from this software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00017 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 * DISCLAIMED. IN NO EVENT SHALL MAKE, HACK, VOID BE LIABLE FOR ANY 00020 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00023 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 00029 #ifndef MHV_IO_ATTINY85_H_ 00030 #define MHV_IO_ATTINY85_H_ 00031 00032 #include <avr/io.h> 00033 00034 // 8 bit timers 00035 // type, ctrlRegA,ctrlRegB,overflow1,overflow2,counter,interrupt,intEnable 00036 #define MHV_TIMER8_0 MHV_TIMER_TYPE_5_PRESCALERS, &TCCR0A, &TCCR0B, &OCR0A, &OCR0B, &TCNT0, &TIMSK, OCIE0A 00037 #define MHV_TIMER8_1 MHV_TIMER_TYPE_5_PRESCALERS, &TCCR1A, &TCCR1B, &OCR1A, &OCR1B, &TCNT1, &TIMSK, OCIE1A 00038 00039 #define MHV_TIMER0_INTERRUPTS SIG_OUTPUT_COMPARE0A, SIG_OUTPUT_COMPARE0B, 0 00040 #define MHV_TIMER1_INTERRUPTS SIG_OUTPUT_COMPARE1A, SIG_OUTPUT_COMPARE1B, 0 00041 00042 #define MHV_AD_RESOLUTION 1024 00043 00044 #define MHV_AD_REFERENCE_VCC (uint8_t)(0x00 << 4) 00045 #define MHV_AD_REFERENCE_AREF (uint8_t)(0x04 << 4) 00046 #define MHV_AD_REFERENCE_1V1 (uint8_t)(0x08 << 6) 00047 #define MHV_AD_REFERENCE_2V56 (uint8_t)(0x09 << 6) 00048 #define MHV_AD_REFERENCE_2V56_AREF (uint8_t)(0x0d << 6) 00049 00050 #define MHV_AD_CHANNEL_0 0x00 00051 #define MHV_AD_CHANNEL_1 0x01 00052 #define MHV_AD_CHANNEL_2 0x02 00053 #define MHV_AD_CHANNEL_3 0x03 00054 #define MHV_AD_CHANNEL_2_X1_2 0x04 00055 #define MHV_AD_CHANNEL_2_X20_2 0x05 00056 #define MHV_AD_CHANNEL_2_X1_3 0x06 00057 #define MHV_AD_CHANNEL_2_X20_3 0x07 00058 #define MHV_AD_CHANNEL_0_X1_0 0x08 00059 #define MHV_AD_CHANNEL_0_X20_0 0x09 00060 #define MHV_AD_CHANNEL_0_X1_1 0x0a 00061 #define MHV_AD_CHANNEL_0_X20_1 0x0b 00062 #define MHV_AD_V_BANDGAP 0x0c 00063 #define MHV_AD_0V 0x0d 00064 #define MHV_AD_TEMPERATURE 0x0f 00065 00066 // Power reduction register for ADC 00067 #define MHV_AD_PRR PRR 00068 00069 00070 // Dir, Output, Input, Bit,PCINT 00071 #define MHV_PIN_B0 &DDRB, &PORTB, &PINB, 0, 0 00072 #define MHV_PIN_B1 &DDRB, &PORTB, &PINB, 1, 1 00073 #define MHV_PIN_B2 &DDRB, &PORTB, &PINB, 2, 2 00074 #define MHV_PIN_B3 &DDRB, &PORTB, &PINB, 3, 3 00075 #define MHV_PIN_B4 &DDRB, &PORTB, &PINB, 4, 4 00076 #define MHV_PIN_B5 &DDRB, &PORTB, &PINB, 5, 5 00077 00078 #define MHV_PIN_TIMER_0_A MHV_PIN_B0 00079 #define MHV_PIN_TIMER_0_B MHV_PIN_B1 00080 #define MHV_PIN_TIMER_1_A MHV_PIN_B1 00081 #define MHV_PIN_TIMER_1_B MHV_PIN_B4 00082 00083 #define MHV_INTERRUPT_INT0 INT0_vect, &MCUCR, ISC00 00084 00085 #define MHV_PC_INT_COUNT 6 00086 00087 #define MHV_EEPROM_VECT EE_RDY_vect 00088 00089 #endif /* MHV_IO_ATTINY85_H_ */