375 lines
8.3 KiB
C
375 lines
8.3 KiB
C
|
//io_atmega2560.h
|
||
|
#ifndef _IO_ATMEGA2560
|
||
|
#define _IO_ATMEGA2560
|
||
|
|
||
|
|
||
|
#define __PIN_P0 PINE
|
||
|
#define __PIN_P1 PINE
|
||
|
#define __PIN_P2 PINE
|
||
|
#define __PIN_P3 PINE
|
||
|
#define __PIN_P4 PING
|
||
|
#define __PIN_P5 PINE
|
||
|
#define __PIN_P6 PINH
|
||
|
#define __PIN_P7 PINH
|
||
|
#define __PIN_P8 PINH
|
||
|
#define __PIN_P9 PINH
|
||
|
#define __PIN_P10 PINB
|
||
|
#define __PIN_P11 PINB
|
||
|
#define __PIN_P12 PINB
|
||
|
#define __PIN_P13 PINB
|
||
|
#define __PIN_P14 PINJ
|
||
|
#define __PIN_P15 PINJ
|
||
|
#define __PIN_P16 PINH
|
||
|
#define __PIN_P17 PINH
|
||
|
#define __PIN_P18 PIND
|
||
|
#define __PIN_P19 PIND
|
||
|
#define __PIN_P20 PIND
|
||
|
#define __PIN_P21 PIND
|
||
|
#define __PIN_P22 PINA
|
||
|
#define __PIN_P23 PINA
|
||
|
#define __PIN_P24 PINA
|
||
|
#define __PIN_P25 PINA
|
||
|
#define __PIN_P26 PINA
|
||
|
#define __PIN_P27 PINA
|
||
|
#define __PIN_P28 PINA
|
||
|
#define __PIN_P29 PINA
|
||
|
#define __PIN_P30 PINC
|
||
|
#define __PIN_P31 PINC
|
||
|
#define __PIN_P32 PINC
|
||
|
#define __PIN_P33 PINC
|
||
|
#define __PIN_P34 PINC
|
||
|
#define __PIN_P35 PINC
|
||
|
#define __PIN_P36 PINC
|
||
|
#define __PIN_P37 PINC
|
||
|
#define __PIN_P38 PIND
|
||
|
#define __PIN_P39 PING
|
||
|
#define __PIN_P40 PING
|
||
|
#define __PIN_P41 PING
|
||
|
#define __PIN_P42 PINL
|
||
|
#define __PIN_P43 PINL
|
||
|
#define __PIN_P44 PINL
|
||
|
#define __PIN_P45 PINL
|
||
|
#define __PIN_P46 PINL
|
||
|
#define __PIN_P47 PINL
|
||
|
#define __PIN_P48 PINL
|
||
|
#define __PIN_P49 PINL
|
||
|
#define __PIN_P50 PINB
|
||
|
#define __PIN_P51 PINB
|
||
|
#define __PIN_P52 PINB
|
||
|
#define __PIN_P53 PINB
|
||
|
#define __PIN_P54 PINF
|
||
|
#define __PIN_P55 PINF
|
||
|
#define __PIN_P56 PINF
|
||
|
#define __PIN_P57 PINF
|
||
|
#define __PIN_P58 PINF
|
||
|
#define __PIN_P59 PINF
|
||
|
#define __PIN_P60 PINF
|
||
|
#define __PIN_P61 PINF
|
||
|
#define __PIN_P62 PINK
|
||
|
#define __PIN_P63 PINK
|
||
|
#define __PIN_P64 PINK
|
||
|
#define __PIN_P65 PINK
|
||
|
#define __PIN_P66 PINK
|
||
|
#define __PIN_P67 PINK
|
||
|
#define __PIN_P68 PINK
|
||
|
#define __PIN_P69 PINK
|
||
|
#define __PIN_P70 PING
|
||
|
#define __PIN_P71 PING
|
||
|
#define __PIN_P72 PINJ
|
||
|
#define __PIN_P73 PINJ
|
||
|
#define __PIN_P74 PINJ
|
||
|
#define __PIN_P75 PINJ
|
||
|
#define __PIN_P76 PINJ
|
||
|
#define __PIN_P77 PINJ
|
||
|
#define __PIN_P78 PINE
|
||
|
#define __PIN_P79 PINE
|
||
|
#define __PIN_P80 PINE
|
||
|
#define __PIN_P81 PIND
|
||
|
#define __PIN_P82 PIND
|
||
|
#define __PIN_P83 PIND
|
||
|
#define __PIN_P84 PINH
|
||
|
#define __PIN_P85 PINH
|
||
|
|
||
|
#define __PORT_P0 PORTE
|
||
|
#define __PORT_P1 PORTE
|
||
|
#define __PORT_P2 PORTE
|
||
|
#define __PORT_P3 PORTE
|
||
|
#define __PORT_P4 PORTG
|
||
|
#define __PORT_P5 PORTE
|
||
|
#define __PORT_P6 PORTH
|
||
|
#define __PORT_P7 PORTH
|
||
|
#define __PORT_P8 PORTH
|
||
|
#define __PORT_P9 PORTH
|
||
|
#define __PORT_P10 PORTB
|
||
|
#define __PORT_P11 PORTB
|
||
|
#define __PORT_P12 PORTB
|
||
|
#define __PORT_P13 PORTB
|
||
|
#define __PORT_P14 PORTJ
|
||
|
#define __PORT_P15 PORTJ
|
||
|
#define __PORT_P16 PORTH
|
||
|
#define __PORT_P17 PORTH
|
||
|
#define __PORT_P18 PORTD
|
||
|
#define __PORT_P19 PORTD
|
||
|
#define __PORT_P20 PORTD
|
||
|
#define __PORT_P21 PORTD
|
||
|
#define __PORT_P22 PORTA
|
||
|
#define __PORT_P23 PORTA
|
||
|
#define __PORT_P24 PORTA
|
||
|
#define __PORT_P25 PORTA
|
||
|
#define __PORT_P26 PORTA
|
||
|
#define __PORT_P27 PORTA
|
||
|
#define __PORT_P28 PORTA
|
||
|
#define __PORT_P29 PORTA
|
||
|
#define __PORT_P30 PORTC
|
||
|
#define __PORT_P31 PORTC
|
||
|
#define __PORT_P32 PORTC
|
||
|
#define __PORT_P33 PORTC
|
||
|
#define __PORT_P34 PORTC
|
||
|
#define __PORT_P35 PORTC
|
||
|
#define __PORT_P36 PORTC
|
||
|
#define __PORT_P37 PORTC
|
||
|
#define __PORT_P38 PORTD
|
||
|
#define __PORT_P39 PORTG
|
||
|
#define __PORT_P40 PORTG
|
||
|
#define __PORT_P41 PORTG
|
||
|
#define __PORT_P42 PORTL
|
||
|
#define __PORT_P43 PORTL
|
||
|
#define __PORT_P44 PORTL
|
||
|
#define __PORT_P45 PORTL
|
||
|
#define __PORT_P46 PORTL
|
||
|
#define __PORT_P47 PORTL
|
||
|
#define __PORT_P48 PORTL
|
||
|
#define __PORT_P49 PORTL
|
||
|
#define __PORT_P50 PORTB
|
||
|
#define __PORT_P51 PORTB
|
||
|
#define __PORT_P52 PORTB
|
||
|
#define __PORT_P53 PORTB
|
||
|
#define __PORT_P54 PORTF
|
||
|
#define __PORT_P55 PORTF
|
||
|
#define __PORT_P56 PORTF
|
||
|
#define __PORT_P57 PORTF
|
||
|
#define __PORT_P58 PORTF
|
||
|
#define __PORT_P59 PORTF
|
||
|
#define __PORT_P60 PORTF
|
||
|
#define __PORT_P61 PORTF
|
||
|
#define __PORT_P62 PORTK
|
||
|
#define __PORT_P63 PORTK
|
||
|
#define __PORT_P64 PORTK
|
||
|
#define __PORT_P65 PORTK
|
||
|
#define __PORT_P66 PORTK
|
||
|
#define __PORT_P67 PORTK
|
||
|
#define __PORT_P68 PORTK
|
||
|
#define __PORT_P69 PORTK
|
||
|
#define __PORT_P70 PORTG
|
||
|
#define __PORT_P71 PORTG
|
||
|
#define __PORT_P72 PORTJ
|
||
|
#define __PORT_P73 PORTJ
|
||
|
#define __PORT_P74 PORTJ
|
||
|
#define __PORT_P75 PORTJ
|
||
|
#define __PORT_P76 PORTJ
|
||
|
#define __PORT_P77 PORTJ
|
||
|
#define __PORT_P78 PORTE
|
||
|
#define __PORT_P79 PORTE
|
||
|
#define __PORT_P80 PORTE
|
||
|
#define __PORT_P81 PORTD
|
||
|
#define __PORT_P82 PORTD
|
||
|
#define __PORT_P83 PORTD
|
||
|
#define __PORT_P84 PORTH
|
||
|
#define __PORT_P85 PORTH
|
||
|
|
||
|
#define __DDR_P0 DDRE
|
||
|
#define __DDR_P1 DDRE
|
||
|
#define __DDR_P2 DDRE
|
||
|
#define __DDR_P3 DDRE
|
||
|
#define __DDR_P4 DDRG
|
||
|
#define __DDR_P5 DDRE
|
||
|
#define __DDR_P6 DDRH
|
||
|
#define __DDR_P7 DDRH
|
||
|
#define __DDR_P8 DDRH
|
||
|
#define __DDR_P9 DDRH
|
||
|
#define __DDR_P10 DDRB
|
||
|
#define __DDR_P11 DDRB
|
||
|
#define __DDR_P12 DDRB
|
||
|
#define __DDR_P13 DDRB
|
||
|
#define __DDR_P14 DDRJ
|
||
|
#define __DDR_P15 DDRJ
|
||
|
#define __DDR_P16 DDRH
|
||
|
#define __DDR_P17 DDRH
|
||
|
#define __DDR_P18 DDRD
|
||
|
#define __DDR_P19 DDRD
|
||
|
#define __DDR_P20 DDRD
|
||
|
#define __DDR_P21 DDRD
|
||
|
#define __DDR_P22 DDRA
|
||
|
#define __DDR_P23 DDRA
|
||
|
#define __DDR_P24 DDRA
|
||
|
#define __DDR_P25 DDRA
|
||
|
#define __DDR_P26 DDRA
|
||
|
#define __DDR_P27 DDRA
|
||
|
#define __DDR_P28 DDRA
|
||
|
#define __DDR_P29 DDRA
|
||
|
#define __DDR_P30 DDRC
|
||
|
#define __DDR_P31 DDRC
|
||
|
#define __DDR_P32 DDRC
|
||
|
#define __DDR_P33 DDRC
|
||
|
#define __DDR_P34 DDRC
|
||
|
#define __DDR_P35 DDRC
|
||
|
#define __DDR_P36 DDRC
|
||
|
#define __DDR_P37 DDRC
|
||
|
#define __DDR_P38 DDRD
|
||
|
#define __DDR_P39 DDRG
|
||
|
#define __DDR_P40 DDRG
|
||
|
#define __DDR_P41 DDRG
|
||
|
#define __DDR_P42 DDRL
|
||
|
#define __DDR_P43 DDRL
|
||
|
#define __DDR_P44 DDRL
|
||
|
#define __DDR_P45 DDRL
|
||
|
#define __DDR_P46 DDRL
|
||
|
#define __DDR_P47 DDRL
|
||
|
#define __DDR_P48 DDRL
|
||
|
#define __DDR_P49 DDRL
|
||
|
#define __DDR_P50 DDRB
|
||
|
#define __DDR_P51 DDRB
|
||
|
#define __DDR_P52 DDRB
|
||
|
#define __DDR_P53 DDRB
|
||
|
#define __DDR_P54 DDRF
|
||
|
#define __DDR_P55 DDRF
|
||
|
#define __DDR_P56 DDRF
|
||
|
#define __DDR_P57 DDRF
|
||
|
#define __DDR_P58 DDRF
|
||
|
#define __DDR_P59 DDRF
|
||
|
#define __DDR_P60 DDRF
|
||
|
#define __DDR_P61 DDRF
|
||
|
#define __DDR_P62 DDRK
|
||
|
#define __DDR_P63 DDRK
|
||
|
#define __DDR_P64 DDRK
|
||
|
#define __DDR_P65 DDRK
|
||
|
#define __DDR_P66 DDRK
|
||
|
#define __DDR_P67 DDRK
|
||
|
#define __DDR_P68 DDRK
|
||
|
#define __DDR_P69 DDRK
|
||
|
#define __DDR_P70 DDRG
|
||
|
#define __DDR_P71 DDRG
|
||
|
#define __DDR_P72 DDRJ
|
||
|
#define __DDR_P73 DDRJ
|
||
|
#define __DDR_P74 DDRJ
|
||
|
#define __DDR_P75 DDRJ
|
||
|
#define __DDR_P76 DDRJ
|
||
|
#define __DDR_P77 DDRJ
|
||
|
#define __DDR_P78 DDRE
|
||
|
#define __DDR_P79 DDRE
|
||
|
#define __DDR_P80 DDRE
|
||
|
#define __DDR_P81 DDRD
|
||
|
#define __DDR_P82 DDRD
|
||
|
#define __DDR_P83 DDRD
|
||
|
#define __DDR_P84 DDRH
|
||
|
#define __DDR_P85 DDRH
|
||
|
|
||
|
#define __BIT_P0 0
|
||
|
#define __BIT_P1 1
|
||
|
#define __BIT_P2 4
|
||
|
#define __BIT_P3 5
|
||
|
#define __BIT_P4 5
|
||
|
#define __BIT_P5 3
|
||
|
#define __BIT_P6 3
|
||
|
#define __BIT_P7 4
|
||
|
#define __BIT_P8 5
|
||
|
#define __BIT_P9 6
|
||
|
#define __BIT_P10 4
|
||
|
#define __BIT_P11 5
|
||
|
#define __BIT_P12 6
|
||
|
#define __BIT_P13 7
|
||
|
#define __BIT_P14 1
|
||
|
#define __BIT_P15 0
|
||
|
#define __BIT_P16 0
|
||
|
#define __BIT_P17 1
|
||
|
#define __BIT_P18 3
|
||
|
#define __BIT_P19 2
|
||
|
#define __BIT_P20 1
|
||
|
#define __BIT_P21 0
|
||
|
#define __BIT_P22 0
|
||
|
#define __BIT_P23 1
|
||
|
#define __BIT_P24 2
|
||
|
#define __BIT_P25 3
|
||
|
#define __BIT_P26 4
|
||
|
#define __BIT_P27 5
|
||
|
#define __BIT_P28 6
|
||
|
#define __BIT_P29 7
|
||
|
#define __BIT_P30 7
|
||
|
#define __BIT_P31 6
|
||
|
#define __BIT_P32 5
|
||
|
#define __BIT_P33 4
|
||
|
#define __BIT_P34 3
|
||
|
#define __BIT_P35 2
|
||
|
#define __BIT_P36 1
|
||
|
#define __BIT_P37 0
|
||
|
#define __BIT_P38 7
|
||
|
#define __BIT_P39 2
|
||
|
#define __BIT_P40 1
|
||
|
#define __BIT_P41 0
|
||
|
#define __BIT_P42 7
|
||
|
#define __BIT_P43 6
|
||
|
#define __BIT_P44 5
|
||
|
#define __BIT_P45 4
|
||
|
#define __BIT_P46 3
|
||
|
#define __BIT_P47 2
|
||
|
#define __BIT_P48 1
|
||
|
#define __BIT_P49 0
|
||
|
#define __BIT_P50 3
|
||
|
#define __BIT_P51 2
|
||
|
#define __BIT_P52 1
|
||
|
#define __BIT_P53 0
|
||
|
#define __BIT_P54 0
|
||
|
#define __BIT_P55 1
|
||
|
#define __BIT_P56 2
|
||
|
#define __BIT_P57 3
|
||
|
#define __BIT_P58 4
|
||
|
#define __BIT_P59 5
|
||
|
#define __BIT_P60 6
|
||
|
#define __BIT_P61 7
|
||
|
#define __BIT_P62 0
|
||
|
#define __BIT_P63 1
|
||
|
#define __BIT_P64 2
|
||
|
#define __BIT_P65 3
|
||
|
#define __BIT_P66 4
|
||
|
#define __BIT_P67 5
|
||
|
#define __BIT_P68 6
|
||
|
#define __BIT_P69 7
|
||
|
#define __BIT_P70 4
|
||
|
#define __BIT_P71 3
|
||
|
#define __BIT_P72 2
|
||
|
#define __BIT_P73 3
|
||
|
#define __BIT_P74 7
|
||
|
#define __BIT_P75 4
|
||
|
#define __BIT_P76 5
|
||
|
#define __BIT_P77 6
|
||
|
#define __BIT_P78 2
|
||
|
#define __BIT_P79 6
|
||
|
#define __BIT_P80 7
|
||
|
#define __BIT_P81 4
|
||
|
#define __BIT_P82 5
|
||
|
#define __BIT_P83 6
|
||
|
#define __BIT_P84 2
|
||
|
#define __BIT_P85 7
|
||
|
|
||
|
#define __BIT(pin) __BIT_P##pin
|
||
|
#define __MSK(pin) (1 << __BIT(pin))
|
||
|
|
||
|
#define __PIN(pin) __PIN_P##pin
|
||
|
#define __PORT(pin) __PORT_P##pin
|
||
|
#define __DDR(pin) __DDR_P##pin
|
||
|
|
||
|
#define PIN(pin) __PIN(pin)
|
||
|
#define PORT(pin) __PORT(pin)
|
||
|
#define DDR(pin) __DDR(pin)
|
||
|
|
||
|
#define PIN_INP(pin) DDR(pin) &= ~__MSK(pin)
|
||
|
#define PIN_OUT(pin) DDR(pin) |= __MSK(pin)
|
||
|
#define PIN_CLR(pin) PORT(pin) &= ~__MSK(pin)
|
||
|
#define PIN_SET(pin) PORT(pin) |= __MSK(pin)
|
||
|
#define PIN_VAL(pin, val) if (val) PIN_SET(pin); else PIN_CLR(pin);
|
||
|
#define PIN_GET(pin) (PIN(pin) & __MSK(pin))
|
||
|
#define PIN_INQ(pin) (PORT(pin) & __MSK(pin))
|
||
|
|
||
|
|
||
|
#endif //_IO_ATMEGA2560
|