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_ATTINY2313_H_ 00030 #define MHV_IO_ATTINY2313_H_ 00031 00032 #include <avr/io.h> 00033 00034 // 8 bit timers 00035 // type, ctrlRegA,ctrlRegB,overflow1,overflow2,counter,interrupt,intEnableA 00036 #define MHV_TIMER8_0 MHV_TIMER_TYPE_5_PRESCALERS, &TCCR0A, &TCCR0B, &OCR0A, &OCR0B, &TCNT0, &TIMSK, OCIE0A 00037 00038 #define MHV_TIMER0_INTERRUPTS SIG_OUTPUT_COMPARE0A, SIG_OUTPUT_COMPARE0B 00039 00040 // 16 bit timers 00041 // ctrlRegA,ctrlRegB,ctrlRegC,overflow1,overflow2,overflow3,counter,interrupt,inputCapture1 00042 #define MHV_TIMER16_1 &TCCR1A, &TCCR1B, 0, &OCR1A, &OCR1B, 0, &TCNT1, &TIMSK, &ICR1 00043 00044 #define MHV_TIMER1_INTERRUPTS SIG_OUTPUT_COMPARE1A, SIG_OUTPUT_COMPARE1B 00045 #define MHV_USART0 &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, TXCIE, UDRE, U2X 00046 #define MHV_USART0_INTERRUPTS USART_RX_vect, USART_TX_vect 00047 00048 // Dir, Output, Input, Bit,PCINT 00049 #define MHV_PIN_A0 &DDRA, &PORTA, &PINA, 0, -1 00050 #define MHV_PIN_A1 &DDRA, &PORTA, &PINA, 1, -1 00051 #define MHV_PIN_A2 &DDRA, &PORTA, &PINA, 2, -1 00052 #define MHV_PIN_B0 &DDRB, &PORTB, &PINB, 0, 0 00053 #define MHV_PIN_B1 &DDRB, &PORTB, &PINB, 1, 1 00054 #define MHV_PIN_B2 &DDRB, &PORTB, &PINB, 2, 2 00055 #define MHV_PIN_B3 &DDRB, &PORTB, &PINB, 3, 3 00056 #define MHV_PIN_B4 &DDRB, &PORTB, &PINB, 4, 4 00057 #define MHV_PIN_B5 &DDRB, &PORTB, &PINB, 5, 5 00058 #define MHV_PIN_B6 &DDRB, &PORTB, &PINB, 6, 6 00059 #define MHV_PIN_B7 &DDRB, &PORTB, &PINB, 7, 7 00060 #define MHV_PIN_D0 &DDRD, &PORTD, &PIND, 0, -1 00061 #define MHV_PIN_D1 &DDRD, &PORTD, &PIND, 1, -1 00062 #define MHV_PIN_D2 &DDRD, &PORTD, &PIND, 2, -1 00063 #define MHV_PIN_D3 &DDRD, &PORTD, &PIND, 3, -1 00064 #define MHV_PIN_D4 &DDRD, &PORTD, &PIND, 4, -1 00065 #define MHV_PIN_D5 &DDRD, &PORTD, &PIND, 5, -1 00066 #define MHV_PIN_D6 &DDRD, &PORTD, &PIND, 6, -1 00067 00068 #define MHV_PIN_TIMER_0_A MHV_PIN_B2 00069 #define MHV_PIN_TIMER_0_B MHV_PIN_D5 00070 #define MHV_PIN_TIMER_1_A MHV_PIN_B3 00071 #define MHV_PIN_TIMER_1_B MHV_PIN_B4 00072 00073 #define MHV_INTERRUPT_INT0 INT0_vect, &MCUCR, ISC00 00074 #define MHV_INTERRUPT_INT1 INT1_vect, &MCUCR, ISC10 00075 00076 #define MHV_PC_INT_COUNT 8 00077 00078 #define MHV_EEPROM_VECT EEPROM_READY_vect 00079 00080 #endif /* MHV_IO_ATTINY2313_H_ */