Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generated @ Sun 10-11-2013 11:44PM 20sec
- /*
- TITLE: AVR Augmentation for io.h
- Purpose: Increase portability, Readability, Save time
- AUTHOR: Brian Khuu
- Version: V1.0
- Assumption:
- That you are using io.h (For avr MCU) and
- that it splits IOs into banks of Port letters each with an word sized of pin numbers
- e.g. ( PA5 -> Port A pin 5 . Is a macro within io.h )
- Port letters Supported: A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P
- Pin numbers Supported: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16
- cite: initial inspiration from cinderblock "[CODE] [C] Simplifying PORT and DDR #defines for Portability
- http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=73829
- cite: "GET" and "SET" macros from David Jahshan's game_console Template
- Example blink code for the arduino UNO in C located in bottom of this header file
- */
- // These accept letter + number reference only.
- // e.g. for PA5 -> SET_PORT(A5,0xFF)
- // ( R_ was a cinderblock suggestion, to allow for nested concat operations)
- #define SET_PORT(PIN,VALUE) R_SET_PORT( PIN , VALUE )
- #define SET_DDR(PIN,VALUE) R_SET_DDR( PIN , VALUE )
- #define SET_PIN(PIN,VALUE) R_SET_PIN( PIN , VALUE )
- #define GET_PORT(PIN) R_GET_PORT( PIN )
- #define GET_DDR(PIN) R_GET_DDR( PIN )
- #define GET_PIN(PIN) R_GET_PIN( PIN )
- #define R_SET_PORT(PIN,VALUE) SET( PORT_P##PIN , BITMASK_P##PIN , VALUE )
- #define R_SET_DDR(PIN,VALUE) SET( DDR_P##PIN , BITMASK_P##PIN , VALUE )
- #define R_SET_PIN(PIN,VALUE) SET( PIN_P##PIN , BITMASK_P##PIN , VALUE )
- #define R_GET_PORT(PIN) GET( PORT_P##PIN , BITMASK_P##PIN )
- #define R_GET_DDR(PIN) GET( DDR_P##PIN , BITMASK_P##PIN )
- #define R_GET_PIN(PIN) GET( PIN_P##PIN , BITMASK_P##PIN )
- //// From David Jahshan's SET and GET macro
- // This will not accept letter+number reference, must give PORT and MASK reference
- // e.g. SET_REGISTER( PORTA, _BV(PA6), 0xFF);
- #define SET(REGISTER,MASK,VALUE) REGISTER = ((MASK & VALUE) | (REGISTER & ~MASK))
- #define GET(REGISTER,MASK) REGISTER & MASK
- // ~~~~~~~~~~ PORT PIN DDR references ~~~~~~~~~~
- //## PORT:A
- //PA1
- #define BITMASK_PA1 _BV(PA1)
- #define PORT_PA1 PORTA
- #define DDR_PA1 DDRA
- #define PIN_PA1 PINA
- //PA2
- #define BITMASK_PA2 _BV(PA2)
- #define PORT_PA2 PORTA
- #define DDR_PA2 DDRA
- #define PIN_PA2 PINA
- //PA3
- #define BITMASK_PA3 _BV(PA3)
- #define PORT_PA3 PORTA
- #define DDR_PA3 DDRA
- #define PIN_PA3 PINA
- //PA4
- #define BITMASK_PA4 _BV(PA4)
- #define PORT_PA4 PORTA
- #define DDR_PA4 DDRA
- #define PIN_PA4 PINA
- //PA5
- #define BITMASK_PA5 _BV(PA5)
- #define PORT_PA5 PORTA
- #define DDR_PA5 DDRA
- #define PIN_PA5 PINA
- //PA6
- #define BITMASK_PA6 _BV(PA6)
- #define PORT_PA6 PORTA
- #define DDR_PA6 DDRA
- #define PIN_PA6 PINA
- //PA7
- #define BITMASK_PA7 _BV(PA7)
- #define PORT_PA7 PORTA
- #define DDR_PA7 DDRA
- #define PIN_PA7 PINA
- //PA8
- #define BITMASK_PA8 _BV(PA8)
- #define PORT_PA8 PORTA
- #define DDR_PA8 DDRA
- #define PIN_PA8 PINA
- //PA9
- #define BITMASK_PA9 _BV(PA9)
- #define PORT_PA9 PORTA
- #define DDR_PA9 DDRA
- #define PIN_PA9 PINA
- //PA10
- #define BITMASK_PA10 _BV(PA10)
- #define PORT_PA10 PORTA
- #define DDR_PA10 DDRA
- #define PIN_PA10 PINA
- //PA12
- #define BITMASK_PA12 _BV(PA12)
- #define PORT_PA12 PORTA
- #define DDR_PA12 DDRA
- #define PIN_PA12 PINA
- //PA13
- #define BITMASK_PA13 _BV(PA13)
- #define PORT_PA13 PORTA
- #define DDR_PA13 DDRA
- #define PIN_PA13 PINA
- //PA14
- #define BITMASK_PA14 _BV(PA14)
- #define PORT_PA14 PORTA
- #define DDR_PA14 DDRA
- #define PIN_PA14 PINA
- //PA15
- #define BITMASK_PA15 _BV(PA15)
- #define PORT_PA15 PORTA
- #define DDR_PA15 DDRA
- #define PIN_PA15 PINA
- //PA16
- #define BITMASK_PA16 _BV(PA16)
- #define PORT_PA16 PORTA
- #define DDR_PA16 DDRA
- #define PIN_PA16 PINA
- //## PORT:B
- //PB1
- #define BITMASK_PB1 _BV(PB1)
- #define PORT_PB1 PORTB
- #define DDR_PB1 DDRB
- #define PIN_PB1 PINB
- //PB2
- #define BITMASK_PB2 _BV(PB2)
- #define PORT_PB2 PORTB
- #define DDR_PB2 DDRB
- #define PIN_PB2 PINB
- //PB3
- #define BITMASK_PB3 _BV(PB3)
- #define PORT_PB3 PORTB
- #define DDR_PB3 DDRB
- #define PIN_PB3 PINB
- //PB4
- #define BITMASK_PB4 _BV(PB4)
- #define PORT_PB4 PORTB
- #define DDR_PB4 DDRB
- #define PIN_PB4 PINB
- //PB5
- #define BITMASK_PB5 _BV(PB5)
- #define PORT_PB5 PORTB
- #define DDR_PB5 DDRB
- #define PIN_PB5 PINB
- //PB6
- #define BITMASK_PB6 _BV(PB6)
- #define PORT_PB6 PORTB
- #define DDR_PB6 DDRB
- #define PIN_PB6 PINB
- //PB7
- #define BITMASK_PB7 _BV(PB7)
- #define PORT_PB7 PORTB
- #define DDR_PB7 DDRB
- #define PIN_PB7 PINB
- //PB8
- #define BITMASK_PB8 _BV(PB8)
- #define PORT_PB8 PORTB
- #define DDR_PB8 DDRB
- #define PIN_PB8 PINB
- //PB9
- #define BITMASK_PB9 _BV(PB9)
- #define PORT_PB9 PORTB
- #define DDR_PB9 DDRB
- #define PIN_PB9 PINB
- //PB10
- #define BITMASK_PB10 _BV(PB10)
- #define PORT_PB10 PORTB
- #define DDR_PB10 DDRB
- #define PIN_PB10 PINB
- //PB12
- #define BITMASK_PB12 _BV(PB12)
- #define PORT_PB12 PORTB
- #define DDR_PB12 DDRB
- #define PIN_PB12 PINB
- //PB13
- #define BITMASK_PB13 _BV(PB13)
- #define PORT_PB13 PORTB
- #define DDR_PB13 DDRB
- #define PIN_PB13 PINB
- //PB14
- #define BITMASK_PB14 _BV(PB14)
- #define PORT_PB14 PORTB
- #define DDR_PB14 DDRB
- #define PIN_PB14 PINB
- //PB15
- #define BITMASK_PB15 _BV(PB15)
- #define PORT_PB15 PORTB
- #define DDR_PB15 DDRB
- #define PIN_PB15 PINB
- //PB16
- #define BITMASK_PB16 _BV(PB16)
- #define PORT_PB16 PORTB
- #define DDR_PB16 DDRB
- #define PIN_PB16 PINB
- //## PORT:C
- //PC1
- #define BITMASK_PC1 _BV(PC1)
- #define PORT_PC1 PORTC
- #define DDR_PC1 DDRC
- #define PIN_PC1 PINC
- //PC2
- #define BITMASK_PC2 _BV(PC2)
- #define PORT_PC2 PORTC
- #define DDR_PC2 DDRC
- #define PIN_PC2 PINC
- //PC3
- #define BITMASK_PC3 _BV(PC3)
- #define PORT_PC3 PORTC
- #define DDR_PC3 DDRC
- #define PIN_PC3 PINC
- //PC4
- #define BITMASK_PC4 _BV(PC4)
- #define PORT_PC4 PORTC
- #define DDR_PC4 DDRC
- #define PIN_PC4 PINC
- //PC5
- #define BITMASK_PC5 _BV(PC5)
- #define PORT_PC5 PORTC
- #define DDR_PC5 DDRC
- #define PIN_PC5 PINC
- //PC6
- #define BITMASK_PC6 _BV(PC6)
- #define PORT_PC6 PORTC
- #define DDR_PC6 DDRC
- #define PIN_PC6 PINC
- //PC7
- #define BITMASK_PC7 _BV(PC7)
- #define PORT_PC7 PORTC
- #define DDR_PC7 DDRC
- #define PIN_PC7 PINC
- //PC8
- #define BITMASK_PC8 _BV(PC8)
- #define PORT_PC8 PORTC
- #define DDR_PC8 DDRC
- #define PIN_PC8 PINC
- //PC9
- #define BITMASK_PC9 _BV(PC9)
- #define PORT_PC9 PORTC
- #define DDR_PC9 DDRC
- #define PIN_PC9 PINC
- //PC10
- #define BITMASK_PC10 _BV(PC10)
- #define PORT_PC10 PORTC
- #define DDR_PC10 DDRC
- #define PIN_PC10 PINC
- //PC12
- #define BITMASK_PC12 _BV(PC12)
- #define PORT_PC12 PORTC
- #define DDR_PC12 DDRC
- #define PIN_PC12 PINC
- //PC13
- #define BITMASK_PC13 _BV(PC13)
- #define PORT_PC13 PORTC
- #define DDR_PC13 DDRC
- #define PIN_PC13 PINC
- //PC14
- #define BITMASK_PC14 _BV(PC14)
- #define PORT_PC14 PORTC
- #define DDR_PC14 DDRC
- #define PIN_PC14 PINC
- //PC15
- #define BITMASK_PC15 _BV(PC15)
- #define PORT_PC15 PORTC
- #define DDR_PC15 DDRC
- #define PIN_PC15 PINC
- //PC16
- #define BITMASK_PC16 _BV(PC16)
- #define PORT_PC16 PORTC
- #define DDR_PC16 DDRC
- #define PIN_PC16 PINC
- //## PORT:D
- //PD1
- #define BITMASK_PD1 _BV(PD1)
- #define PORT_PD1 PORTD
- #define DDR_PD1 DDRD
- #define PIN_PD1 PIND
- //PD2
- #define BITMASK_PD2 _BV(PD2)
- #define PORT_PD2 PORTD
- #define DDR_PD2 DDRD
- #define PIN_PD2 PIND
- //PD3
- #define BITMASK_PD3 _BV(PD3)
- #define PORT_PD3 PORTD
- #define DDR_PD3 DDRD
- #define PIN_PD3 PIND
- //PD4
- #define BITMASK_PD4 _BV(PD4)
- #define PORT_PD4 PORTD
- #define DDR_PD4 DDRD
- #define PIN_PD4 PIND
- //PD5
- #define BITMASK_PD5 _BV(PD5)
- #define PORT_PD5 PORTD
- #define DDR_PD5 DDRD
- #define PIN_PD5 PIND
- //PD6
- #define BITMASK_PD6 _BV(PD6)
- #define PORT_PD6 PORTD
- #define DDR_PD6 DDRD
- #define PIN_PD6 PIND
- //PD7
- #define BITMASK_PD7 _BV(PD7)
- #define PORT_PD7 PORTD
- #define DDR_PD7 DDRD
- #define PIN_PD7 PIND
- //PD8
- #define BITMASK_PD8 _BV(PD8)
- #define PORT_PD8 PORTD
- #define DDR_PD8 DDRD
- #define PIN_PD8 PIND
- //PD9
- #define BITMASK_PD9 _BV(PD9)
- #define PORT_PD9 PORTD
- #define DDR_PD9 DDRD
- #define PIN_PD9 PIND
- //PD10
- #define BITMASK_PD10 _BV(PD10)
- #define PORT_PD10 PORTD
- #define DDR_PD10 DDRD
- #define PIN_PD10 PIND
- //PD12
- #define BITMASK_PD12 _BV(PD12)
- #define PORT_PD12 PORTD
- #define DDR_PD12 DDRD
- #define PIN_PD12 PIND
- //PD13
- #define BITMASK_PD13 _BV(PD13)
- #define PORT_PD13 PORTD
- #define DDR_PD13 DDRD
- #define PIN_PD13 PIND
- //PD14
- #define BITMASK_PD14 _BV(PD14)
- #define PORT_PD14 PORTD
- #define DDR_PD14 DDRD
- #define PIN_PD14 PIND
- //PD15
- #define BITMASK_PD15 _BV(PD15)
- #define PORT_PD15 PORTD
- #define DDR_PD15 DDRD
- #define PIN_PD15 PIND
- //PD16
- #define BITMASK_PD16 _BV(PD16)
- #define PORT_PD16 PORTD
- #define DDR_PD16 DDRD
- #define PIN_PD16 PIND
- //## PORT:E
- //PE1
- #define BITMASK_PE1 _BV(PE1)
- #define PORT_PE1 PORTE
- #define DDR_PE1 DDRE
- #define PIN_PE1 PINE
- //PE2
- #define BITMASK_PE2 _BV(PE2)
- #define PORT_PE2 PORTE
- #define DDR_PE2 DDRE
- #define PIN_PE2 PINE
- //PE3
- #define BITMASK_PE3 _BV(PE3)
- #define PORT_PE3 PORTE
- #define DDR_PE3 DDRE
- #define PIN_PE3 PINE
- //PE4
- #define BITMASK_PE4 _BV(PE4)
- #define PORT_PE4 PORTE
- #define DDR_PE4 DDRE
- #define PIN_PE4 PINE
- //PE5
- #define BITMASK_PE5 _BV(PE5)
- #define PORT_PE5 PORTE
- #define DDR_PE5 DDRE
- #define PIN_PE5 PINE
- //PE6
- #define BITMASK_PE6 _BV(PE6)
- #define PORT_PE6 PORTE
- #define DDR_PE6 DDRE
- #define PIN_PE6 PINE
- //PE7
- #define BITMASK_PE7 _BV(PE7)
- #define PORT_PE7 PORTE
- #define DDR_PE7 DDRE
- #define PIN_PE7 PINE
- //PE8
- #define BITMASK_PE8 _BV(PE8)
- #define PORT_PE8 PORTE
- #define DDR_PE8 DDRE
- #define PIN_PE8 PINE
- //PE9
- #define BITMASK_PE9 _BV(PE9)
- #define PORT_PE9 PORTE
- #define DDR_PE9 DDRE
- #define PIN_PE9 PINE
- //PE10
- #define BITMASK_PE10 _BV(PE10)
- #define PORT_PE10 PORTE
- #define DDR_PE10 DDRE
- #define PIN_PE10 PINE
- //PE12
- #define BITMASK_PE12 _BV(PE12)
- #define PORT_PE12 PORTE
- #define DDR_PE12 DDRE
- #define PIN_PE12 PINE
- //PE13
- #define BITMASK_PE13 _BV(PE13)
- #define PORT_PE13 PORTE
- #define DDR_PE13 DDRE
- #define PIN_PE13 PINE
- //PE14
- #define BITMASK_PE14 _BV(PE14)
- #define PORT_PE14 PORTE
- #define DDR_PE14 DDRE
- #define PIN_PE14 PINE
- //PE15
- #define BITMASK_PE15 _BV(PE15)
- #define PORT_PE15 PORTE
- #define DDR_PE15 DDRE
- #define PIN_PE15 PINE
- //PE16
- #define BITMASK_PE16 _BV(PE16)
- #define PORT_PE16 PORTE
- #define DDR_PE16 DDRE
- #define PIN_PE16 PINE
- //## PORT:F
- //PF1
- #define BITMASK_PF1 _BV(PF1)
- #define PORT_PF1 PORTF
- #define DDR_PF1 DDRF
- #define PIN_PF1 PINF
- //PF2
- #define BITMASK_PF2 _BV(PF2)
- #define PORT_PF2 PORTF
- #define DDR_PF2 DDRF
- #define PIN_PF2 PINF
- //PF3
- #define BITMASK_PF3 _BV(PF3)
- #define PORT_PF3 PORTF
- #define DDR_PF3 DDRF
- #define PIN_PF3 PINF
- //PF4
- #define BITMASK_PF4 _BV(PF4)
- #define PORT_PF4 PORTF
- #define DDR_PF4 DDRF
- #define PIN_PF4 PINF
- //PF5
- #define BITMASK_PF5 _BV(PF5)
- #define PORT_PF5 PORTF
- #define DDR_PF5 DDRF
- #define PIN_PF5 PINF
- //PF6
- #define BITMASK_PF6 _BV(PF6)
- #define PORT_PF6 PORTF
- #define DDR_PF6 DDRF
- #define PIN_PF6 PINF
- //PF7
- #define BITMASK_PF7 _BV(PF7)
- #define PORT_PF7 PORTF
- #define DDR_PF7 DDRF
- #define PIN_PF7 PINF
- //PF8
- #define BITMASK_PF8 _BV(PF8)
- #define PORT_PF8 PORTF
- #define DDR_PF8 DDRF
- #define PIN_PF8 PINF
- //PF9
- #define BITMASK_PF9 _BV(PF9)
- #define PORT_PF9 PORTF
- #define DDR_PF9 DDRF
- #define PIN_PF9 PINF
- //PF10
- #define BITMASK_PF10 _BV(PF10)
- #define PORT_PF10 PORTF
- #define DDR_PF10 DDRF
- #define PIN_PF10 PINF
- //PF12
- #define BITMASK_PF12 _BV(PF12)
- #define PORT_PF12 PORTF
- #define DDR_PF12 DDRF
- #define PIN_PF12 PINF
- //PF13
- #define BITMASK_PF13 _BV(PF13)
- #define PORT_PF13 PORTF
- #define DDR_PF13 DDRF
- #define PIN_PF13 PINF
- //PF14
- #define BITMASK_PF14 _BV(PF14)
- #define PORT_PF14 PORTF
- #define DDR_PF14 DDRF
- #define PIN_PF14 PINF
- //PF15
- #define BITMASK_PF15 _BV(PF15)
- #define PORT_PF15 PORTF
- #define DDR_PF15 DDRF
- #define PIN_PF15 PINF
- //PF16
- #define BITMASK_PF16 _BV(PF16)
- #define PORT_PF16 PORTF
- #define DDR_PF16 DDRF
- #define PIN_PF16 PINF
- //## PORT:G
- //PG1
- #define BITMASK_PG1 _BV(PG1)
- #define PORT_PG1 PORTG
- #define DDR_PG1 DDRG
- #define PIN_PG1 PING
- //PG2
- #define BITMASK_PG2 _BV(PG2)
- #define PORT_PG2 PORTG
- #define DDR_PG2 DDRG
- #define PIN_PG2 PING
- //PG3
- #define BITMASK_PG3 _BV(PG3)
- #define PORT_PG3 PORTG
- #define DDR_PG3 DDRG
- #define PIN_PG3 PING
- //PG4
- #define BITMASK_PG4 _BV(PG4)
- #define PORT_PG4 PORTG
- #define DDR_PG4 DDRG
- #define PIN_PG4 PING
- //PG5
- #define BITMASK_PG5 _BV(PG5)
- #define PORT_PG5 PORTG
- #define DDR_PG5 DDRG
- #define PIN_PG5 PING
- //PG6
- #define BITMASK_PG6 _BV(PG6)
- #define PORT_PG6 PORTG
- #define DDR_PG6 DDRG
- #define PIN_PG6 PING
- //PG7
- #define BITMASK_PG7 _BV(PG7)
- #define PORT_PG7 PORTG
- #define DDR_PG7 DDRG
- #define PIN_PG7 PING
- //PG8
- #define BITMASK_PG8 _BV(PG8)
- #define PORT_PG8 PORTG
- #define DDR_PG8 DDRG
- #define PIN_PG8 PING
- //PG9
- #define BITMASK_PG9 _BV(PG9)
- #define PORT_PG9 PORTG
- #define DDR_PG9 DDRG
- #define PIN_PG9 PING
- //PG10
- #define BITMASK_PG10 _BV(PG10)
- #define PORT_PG10 PORTG
- #define DDR_PG10 DDRG
- #define PIN_PG10 PING
- //PG12
- #define BITMASK_PG12 _BV(PG12)
- #define PORT_PG12 PORTG
- #define DDR_PG12 DDRG
- #define PIN_PG12 PING
- //PG13
- #define BITMASK_PG13 _BV(PG13)
- #define PORT_PG13 PORTG
- #define DDR_PG13 DDRG
- #define PIN_PG13 PING
- //PG14
- #define BITMASK_PG14 _BV(PG14)
- #define PORT_PG14 PORTG
- #define DDR_PG14 DDRG
- #define PIN_PG14 PING
- //PG15
- #define BITMASK_PG15 _BV(PG15)
- #define PORT_PG15 PORTG
- #define DDR_PG15 DDRG
- #define PIN_PG15 PING
- //PG16
- #define BITMASK_PG16 _BV(PG16)
- #define PORT_PG16 PORTG
- #define DDR_PG16 DDRG
- #define PIN_PG16 PING
- //## PORT:H
- //PH1
- #define BITMASK_PH1 _BV(PH1)
- #define PORT_PH1 PORTH
- #define DDR_PH1 DDRH
- #define PIN_PH1 PINH
- //PH2
- #define BITMASK_PH2 _BV(PH2)
- #define PORT_PH2 PORTH
- #define DDR_PH2 DDRH
- #define PIN_PH2 PINH
- //PH3
- #define BITMASK_PH3 _BV(PH3)
- #define PORT_PH3 PORTH
- #define DDR_PH3 DDRH
- #define PIN_PH3 PINH
- //PH4
- #define BITMASK_PH4 _BV(PH4)
- #define PORT_PH4 PORTH
- #define DDR_PH4 DDRH
- #define PIN_PH4 PINH
- //PH5
- #define BITMASK_PH5 _BV(PH5)
- #define PORT_PH5 PORTH
- #define DDR_PH5 DDRH
- #define PIN_PH5 PINH
- //PH6
- #define BITMASK_PH6 _BV(PH6)
- #define PORT_PH6 PORTH
- #define DDR_PH6 DDRH
- #define PIN_PH6 PINH
- //PH7
- #define BITMASK_PH7 _BV(PH7)
- #define PORT_PH7 PORTH
- #define DDR_PH7 DDRH
- #define PIN_PH7 PINH
- //PH8
- #define BITMASK_PH8 _BV(PH8)
- #define PORT_PH8 PORTH
- #define DDR_PH8 DDRH
- #define PIN_PH8 PINH
- //PH9
- #define BITMASK_PH9 _BV(PH9)
- #define PORT_PH9 PORTH
- #define DDR_PH9 DDRH
- #define PIN_PH9 PINH
- //PH10
- #define BITMASK_PH10 _BV(PH10)
- #define PORT_PH10 PORTH
- #define DDR_PH10 DDRH
- #define PIN_PH10 PINH
- //PH12
- #define BITMASK_PH12 _BV(PH12)
- #define PORT_PH12 PORTH
- #define DDR_PH12 DDRH
- #define PIN_PH12 PINH
- //PH13
- #define BITMASK_PH13 _BV(PH13)
- #define PORT_PH13 PORTH
- #define DDR_PH13 DDRH
- #define PIN_PH13 PINH
- //PH14
- #define BITMASK_PH14 _BV(PH14)
- #define PORT_PH14 PORTH
- #define DDR_PH14 DDRH
- #define PIN_PH14 PINH
- //PH15
- #define BITMASK_PH15 _BV(PH15)
- #define PORT_PH15 PORTH
- #define DDR_PH15 DDRH
- #define PIN_PH15 PINH
- //PH16
- #define BITMASK_PH16 _BV(PH16)
- #define PORT_PH16 PORTH
- #define DDR_PH16 DDRH
- #define PIN_PH16 PINH
- //## PORT:I
- //PI1
- #define BITMASK_PI1 _BV(PI1)
- #define PORT_PI1 PORTI
- #define DDR_PI1 DDRI
- #define PIN_PI1 PINI
- //PI2
- #define BITMASK_PI2 _BV(PI2)
- #define PORT_PI2 PORTI
- #define DDR_PI2 DDRI
- #define PIN_PI2 PINI
- //PI3
- #define BITMASK_PI3 _BV(PI3)
- #define PORT_PI3 PORTI
- #define DDR_PI3 DDRI
- #define PIN_PI3 PINI
- //PI4
- #define BITMASK_PI4 _BV(PI4)
- #define PORT_PI4 PORTI
- #define DDR_PI4 DDRI
- #define PIN_PI4 PINI
- //PI5
- #define BITMASK_PI5 _BV(PI5)
- #define PORT_PI5 PORTI
- #define DDR_PI5 DDRI
- #define PIN_PI5 PINI
- //PI6
- #define BITMASK_PI6 _BV(PI6)
- #define PORT_PI6 PORTI
- #define DDR_PI6 DDRI
- #define PIN_PI6 PINI
- //PI7
- #define BITMASK_PI7 _BV(PI7)
- #define PORT_PI7 PORTI
- #define DDR_PI7 DDRI
- #define PIN_PI7 PINI
- //PI8
- #define BITMASK_PI8 _BV(PI8)
- #define PORT_PI8 PORTI
- #define DDR_PI8 DDRI
- #define PIN_PI8 PINI
- //PI9
- #define BITMASK_PI9 _BV(PI9)
- #define PORT_PI9 PORTI
- #define DDR_PI9 DDRI
- #define PIN_PI9 PINI
- //PI10
- #define BITMASK_PI10 _BV(PI10)
- #define PORT_PI10 PORTI
- #define DDR_PI10 DDRI
- #define PIN_PI10 PINI
- //PI12
- #define BITMASK_PI12 _BV(PI12)
- #define PORT_PI12 PORTI
- #define DDR_PI12 DDRI
- #define PIN_PI12 PINI
- //PI13
- #define BITMASK_PI13 _BV(PI13)
- #define PORT_PI13 PORTI
- #define DDR_PI13 DDRI
- #define PIN_PI13 PINI
- //PI14
- #define BITMASK_PI14 _BV(PI14)
- #define PORT_PI14 PORTI
- #define DDR_PI14 DDRI
- #define PIN_PI14 PINI
- //PI15
- #define BITMASK_PI15 _BV(PI15)
- #define PORT_PI15 PORTI
- #define DDR_PI15 DDRI
- #define PIN_PI15 PINI
- //PI16
- #define BITMASK_PI16 _BV(PI16)
- #define PORT_PI16 PORTI
- #define DDR_PI16 DDRI
- #define PIN_PI16 PINI
- //## PORT:J
- //PJ1
- #define BITMASK_PJ1 _BV(PJ1)
- #define PORT_PJ1 PORTJ
- #define DDR_PJ1 DDRJ
- #define PIN_PJ1 PINJ
- //PJ2
- #define BITMASK_PJ2 _BV(PJ2)
- #define PORT_PJ2 PORTJ
- #define DDR_PJ2 DDRJ
- #define PIN_PJ2 PINJ
- //PJ3
- #define BITMASK_PJ3 _BV(PJ3)
- #define PORT_PJ3 PORTJ
- #define DDR_PJ3 DDRJ
- #define PIN_PJ3 PINJ
- //PJ4
- #define BITMASK_PJ4 _BV(PJ4)
- #define PORT_PJ4 PORTJ
- #define DDR_PJ4 DDRJ
- #define PIN_PJ4 PINJ
- //PJ5
- #define BITMASK_PJ5 _BV(PJ5)
- #define PORT_PJ5 PORTJ
- #define DDR_PJ5 DDRJ
- #define PIN_PJ5 PINJ
- //PJ6
- #define BITMASK_PJ6 _BV(PJ6)
- #define PORT_PJ6 PORTJ
- #define DDR_PJ6 DDRJ
- #define PIN_PJ6 PINJ
- //PJ7
- #define BITMASK_PJ7 _BV(PJ7)
- #define PORT_PJ7 PORTJ
- #define DDR_PJ7 DDRJ
- #define PIN_PJ7 PINJ
- //PJ8
- #define BITMASK_PJ8 _BV(PJ8)
- #define PORT_PJ8 PORTJ
- #define DDR_PJ8 DDRJ
- #define PIN_PJ8 PINJ
- //PJ9
- #define BITMASK_PJ9 _BV(PJ9)
- #define PORT_PJ9 PORTJ
- #define DDR_PJ9 DDRJ
- #define PIN_PJ9 PINJ
- //PJ10
- #define BITMASK_PJ10 _BV(PJ10)
- #define PORT_PJ10 PORTJ
- #define DDR_PJ10 DDRJ
- #define PIN_PJ10 PINJ
- //PJ12
- #define BITMASK_PJ12 _BV(PJ12)
- #define PORT_PJ12 PORTJ
- #define DDR_PJ12 DDRJ
- #define PIN_PJ12 PINJ
- //PJ13
- #define BITMASK_PJ13 _BV(PJ13)
- #define PORT_PJ13 PORTJ
- #define DDR_PJ13 DDRJ
- #define PIN_PJ13 PINJ
- //PJ14
- #define BITMASK_PJ14 _BV(PJ14)
- #define PORT_PJ14 PORTJ
- #define DDR_PJ14 DDRJ
- #define PIN_PJ14 PINJ
- //PJ15
- #define BITMASK_PJ15 _BV(PJ15)
- #define PORT_PJ15 PORTJ
- #define DDR_PJ15 DDRJ
- #define PIN_PJ15 PINJ
- //PJ16
- #define BITMASK_PJ16 _BV(PJ16)
- #define PORT_PJ16 PORTJ
- #define DDR_PJ16 DDRJ
- #define PIN_PJ16 PINJ
- //## PORT:K
- //PK1
- #define BITMASK_PK1 _BV(PK1)
- #define PORT_PK1 PORTK
- #define DDR_PK1 DDRK
- #define PIN_PK1 PINK
- //PK2
- #define BITMASK_PK2 _BV(PK2)
- #define PORT_PK2 PORTK
- #define DDR_PK2 DDRK
- #define PIN_PK2 PINK
- //PK3
- #define BITMASK_PK3 _BV(PK3)
- #define PORT_PK3 PORTK
- #define DDR_PK3 DDRK
- #define PIN_PK3 PINK
- //PK4
- #define BITMASK_PK4 _BV(PK4)
- #define PORT_PK4 PORTK
- #define DDR_PK4 DDRK
- #define PIN_PK4 PINK
- //PK5
- #define BITMASK_PK5 _BV(PK5)
- #define PORT_PK5 PORTK
- #define DDR_PK5 DDRK
- #define PIN_PK5 PINK
- //PK6
- #define BITMASK_PK6 _BV(PK6)
- #define PORT_PK6 PORTK
- #define DDR_PK6 DDRK
- #define PIN_PK6 PINK
- //PK7
- #define BITMASK_PK7 _BV(PK7)
- #define PORT_PK7 PORTK
- #define DDR_PK7 DDRK
- #define PIN_PK7 PINK
- //PK8
- #define BITMASK_PK8 _BV(PK8)
- #define PORT_PK8 PORTK
- #define DDR_PK8 DDRK
- #define PIN_PK8 PINK
- //PK9
- #define BITMASK_PK9 _BV(PK9)
- #define PORT_PK9 PORTK
- #define DDR_PK9 DDRK
- #define PIN_PK9 PINK
- //PK10
- #define BITMASK_PK10 _BV(PK10)
- #define PORT_PK10 PORTK
- #define DDR_PK10 DDRK
- #define PIN_PK10 PINK
- //PK12
- #define BITMASK_PK12 _BV(PK12)
- #define PORT_PK12 PORTK
- #define DDR_PK12 DDRK
- #define PIN_PK12 PINK
- //PK13
- #define BITMASK_PK13 _BV(PK13)
- #define PORT_PK13 PORTK
- #define DDR_PK13 DDRK
- #define PIN_PK13 PINK
- //PK14
- #define BITMASK_PK14 _BV(PK14)
- #define PORT_PK14 PORTK
- #define DDR_PK14 DDRK
- #define PIN_PK14 PINK
- //PK15
- #define BITMASK_PK15 _BV(PK15)
- #define PORT_PK15 PORTK
- #define DDR_PK15 DDRK
- #define PIN_PK15 PINK
- //PK16
- #define BITMASK_PK16 _BV(PK16)
- #define PORT_PK16 PORTK
- #define DDR_PK16 DDRK
- #define PIN_PK16 PINK
- //## PORT:L
- //PL1
- #define BITMASK_PL1 _BV(PL1)
- #define PORT_PL1 PORTL
- #define DDR_PL1 DDRL
- #define PIN_PL1 PINL
- //PL2
- #define BITMASK_PL2 _BV(PL2)
- #define PORT_PL2 PORTL
- #define DDR_PL2 DDRL
- #define PIN_PL2 PINL
- //PL3
- #define BITMASK_PL3 _BV(PL3)
- #define PORT_PL3 PORTL
- #define DDR_PL3 DDRL
- #define PIN_PL3 PINL
- //PL4
- #define BITMASK_PL4 _BV(PL4)
- #define PORT_PL4 PORTL
- #define DDR_PL4 DDRL
- #define PIN_PL4 PINL
- //PL5
- #define BITMASK_PL5 _BV(PL5)
- #define PORT_PL5 PORTL
- #define DDR_PL5 DDRL
- #define PIN_PL5 PINL
- //PL6
- #define BITMASK_PL6 _BV(PL6)
- #define PORT_PL6 PORTL
- #define DDR_PL6 DDRL
- #define PIN_PL6 PINL
- //PL7
- #define BITMASK_PL7 _BV(PL7)
- #define PORT_PL7 PORTL
- #define DDR_PL7 DDRL
- #define PIN_PL7 PINL
- //PL8
- #define BITMASK_PL8 _BV(PL8)
- #define PORT_PL8 PORTL
- #define DDR_PL8 DDRL
- #define PIN_PL8 PINL
- //PL9
- #define BITMASK_PL9 _BV(PL9)
- #define PORT_PL9 PORTL
- #define DDR_PL9 DDRL
- #define PIN_PL9 PINL
- //PL10
- #define BITMASK_PL10 _BV(PL10)
- #define PORT_PL10 PORTL
- #define DDR_PL10 DDRL
- #define PIN_PL10 PINL
- //PL12
- #define BITMASK_PL12 _BV(PL12)
- #define PORT_PL12 PORTL
- #define DDR_PL12 DDRL
- #define PIN_PL12 PINL
- //PL13
- #define BITMASK_PL13 _BV(PL13)
- #define PORT_PL13 PORTL
- #define DDR_PL13 DDRL
- #define PIN_PL13 PINL
- //PL14
- #define BITMASK_PL14 _BV(PL14)
- #define PORT_PL14 PORTL
- #define DDR_PL14 DDRL
- #define PIN_PL14 PINL
- //PL15
- #define BITMASK_PL15 _BV(PL15)
- #define PORT_PL15 PORTL
- #define DDR_PL15 DDRL
- #define PIN_PL15 PINL
- //PL16
- #define BITMASK_PL16 _BV(PL16)
- #define PORT_PL16 PORTL
- #define DDR_PL16 DDRL
- #define PIN_PL16 PINL
- //## PORT:M
- //PM1
- #define BITMASK_PM1 _BV(PM1)
- #define PORT_PM1 PORTM
- #define DDR_PM1 DDRM
- #define PIN_PM1 PINM
- //PM2
- #define BITMASK_PM2 _BV(PM2)
- #define PORT_PM2 PORTM
- #define DDR_PM2 DDRM
- #define PIN_PM2 PINM
- //PM3
- #define BITMASK_PM3 _BV(PM3)
- #define PORT_PM3 PORTM
- #define DDR_PM3 DDRM
- #define PIN_PM3 PINM
- //PM4
- #define BITMASK_PM4 _BV(PM4)
- #define PORT_PM4 PORTM
- #define DDR_PM4 DDRM
- #define PIN_PM4 PINM
- //PM5
- #define BITMASK_PM5 _BV(PM5)
- #define PORT_PM5 PORTM
- #define DDR_PM5 DDRM
- #define PIN_PM5 PINM
- //PM6
- #define BITMASK_PM6 _BV(PM6)
- #define PORT_PM6 PORTM
- #define DDR_PM6 DDRM
- #define PIN_PM6 PINM
- //PM7
- #define BITMASK_PM7 _BV(PM7)
- #define PORT_PM7 PORTM
- #define DDR_PM7 DDRM
- #define PIN_PM7 PINM
- //PM8
- #define BITMASK_PM8 _BV(PM8)
- #define PORT_PM8 PORTM
- #define DDR_PM8 DDRM
- #define PIN_PM8 PINM
- //PM9
- #define BITMASK_PM9 _BV(PM9)
- #define PORT_PM9 PORTM
- #define DDR_PM9 DDRM
- #define PIN_PM9 PINM
- //PM10
- #define BITMASK_PM10 _BV(PM10)
- #define PORT_PM10 PORTM
- #define DDR_PM10 DDRM
- #define PIN_PM10 PINM
- //PM12
- #define BITMASK_PM12 _BV(PM12)
- #define PORT_PM12 PORTM
- #define DDR_PM12 DDRM
- #define PIN_PM12 PINM
- //PM13
- #define BITMASK_PM13 _BV(PM13)
- #define PORT_PM13 PORTM
- #define DDR_PM13 DDRM
- #define PIN_PM13 PINM
- //PM14
- #define BITMASK_PM14 _BV(PM14)
- #define PORT_PM14 PORTM
- #define DDR_PM14 DDRM
- #define PIN_PM14 PINM
- //PM15
- #define BITMASK_PM15 _BV(PM15)
- #define PORT_PM15 PORTM
- #define DDR_PM15 DDRM
- #define PIN_PM15 PINM
- //PM16
- #define BITMASK_PM16 _BV(PM16)
- #define PORT_PM16 PORTM
- #define DDR_PM16 DDRM
- #define PIN_PM16 PINM
- //## PORT:N
- //PN1
- #define BITMASK_PN1 _BV(PN1)
- #define PORT_PN1 PORTN
- #define DDR_PN1 DDRN
- #define PIN_PN1 PINN
- //PN2
- #define BITMASK_PN2 _BV(PN2)
- #define PORT_PN2 PORTN
- #define DDR_PN2 DDRN
- #define PIN_PN2 PINN
- //PN3
- #define BITMASK_PN3 _BV(PN3)
- #define PORT_PN3 PORTN
- #define DDR_PN3 DDRN
- #define PIN_PN3 PINN
- //PN4
- #define BITMASK_PN4 _BV(PN4)
- #define PORT_PN4 PORTN
- #define DDR_PN4 DDRN
- #define PIN_PN4 PINN
- //PN5
- #define BITMASK_PN5 _BV(PN5)
- #define PORT_PN5 PORTN
- #define DDR_PN5 DDRN
- #define PIN_PN5 PINN
- //PN6
- #define BITMASK_PN6 _BV(PN6)
- #define PORT_PN6 PORTN
- #define DDR_PN6 DDRN
- #define PIN_PN6 PINN
- //PN7
- #define BITMASK_PN7 _BV(PN7)
- #define PORT_PN7 PORTN
- #define DDR_PN7 DDRN
- #define PIN_PN7 PINN
- //PN8
- #define BITMASK_PN8 _BV(PN8)
- #define PORT_PN8 PORTN
- #define DDR_PN8 DDRN
- #define PIN_PN8 PINN
- //PN9
- #define BITMASK_PN9 _BV(PN9)
- #define PORT_PN9 PORTN
- #define DDR_PN9 DDRN
- #define PIN_PN9 PINN
- //PN10
- #define BITMASK_PN10 _BV(PN10)
- #define PORT_PN10 PORTN
- #define DDR_PN10 DDRN
- #define PIN_PN10 PINN
- //PN12
- #define BITMASK_PN12 _BV(PN12)
- #define PORT_PN12 PORTN
- #define DDR_PN12 DDRN
- #define PIN_PN12 PINN
- //PN13
- #define BITMASK_PN13 _BV(PN13)
- #define PORT_PN13 PORTN
- #define DDR_PN13 DDRN
- #define PIN_PN13 PINN
- //PN14
- #define BITMASK_PN14 _BV(PN14)
- #define PORT_PN14 PORTN
- #define DDR_PN14 DDRN
- #define PIN_PN14 PINN
- //PN15
- #define BITMASK_PN15 _BV(PN15)
- #define PORT_PN15 PORTN
- #define DDR_PN15 DDRN
- #define PIN_PN15 PINN
- //PN16
- #define BITMASK_PN16 _BV(PN16)
- #define PORT_PN16 PORTN
- #define DDR_PN16 DDRN
- #define PIN_PN16 PINN
- //## PORT:O
- //PO1
- #define BITMASK_PO1 _BV(PO1)
- #define PORT_PO1 PORTO
- #define DDR_PO1 DDRO
- #define PIN_PO1 PINO
- //PO2
- #define BITMASK_PO2 _BV(PO2)
- #define PORT_PO2 PORTO
- #define DDR_PO2 DDRO
- #define PIN_PO2 PINO
- //PO3
- #define BITMASK_PO3 _BV(PO3)
- #define PORT_PO3 PORTO
- #define DDR_PO3 DDRO
- #define PIN_PO3 PINO
- //PO4
- #define BITMASK_PO4 _BV(PO4)
- #define PORT_PO4 PORTO
- #define DDR_PO4 DDRO
- #define PIN_PO4 PINO
- //PO5
- #define BITMASK_PO5 _BV(PO5)
- #define PORT_PO5 PORTO
- #define DDR_PO5 DDRO
- #define PIN_PO5 PINO
- //PO6
- #define BITMASK_PO6 _BV(PO6)
- #define PORT_PO6 PORTO
- #define DDR_PO6 DDRO
- #define PIN_PO6 PINO
- //PO7
- #define BITMASK_PO7 _BV(PO7)
- #define PORT_PO7 PORTO
- #define DDR_PO7 DDRO
- #define PIN_PO7 PINO
- //PO8
- #define BITMASK_PO8 _BV(PO8)
- #define PORT_PO8 PORTO
- #define DDR_PO8 DDRO
- #define PIN_PO8 PINO
- //PO9
- #define BITMASK_PO9 _BV(PO9)
- #define PORT_PO9 PORTO
- #define DDR_PO9 DDRO
- #define PIN_PO9 PINO
- //PO10
- #define BITMASK_PO10 _BV(PO10)
- #define PORT_PO10 PORTO
- #define DDR_PO10 DDRO
- #define PIN_PO10 PINO
- //PO12
- #define BITMASK_PO12 _BV(PO12)
- #define PORT_PO12 PORTO
- #define DDR_PO12 DDRO
- #define PIN_PO12 PINO
- //PO13
- #define BITMASK_PO13 _BV(PO13)
- #define PORT_PO13 PORTO
- #define DDR_PO13 DDRO
- #define PIN_PO13 PINO
- //PO14
- #define BITMASK_PO14 _BV(PO14)
- #define PORT_PO14 PORTO
- #define DDR_PO14 DDRO
- #define PIN_PO14 PINO
- //PO15
- #define BITMASK_PO15 _BV(PO15)
- #define PORT_PO15 PORTO
- #define DDR_PO15 DDRO
- #define PIN_PO15 PINO
- //PO16
- #define BITMASK_PO16 _BV(PO16)
- #define PORT_PO16 PORTO
- #define DDR_PO16 DDRO
- #define PIN_PO16 PINO
- //## PORT:P
- //PP1
- #define BITMASK_PP1 _BV(PP1)
- #define PORT_PP1 PORTP
- #define DDR_PP1 DDRP
- #define PIN_PP1 PINP
- //PP2
- #define BITMASK_PP2 _BV(PP2)
- #define PORT_PP2 PORTP
- #define DDR_PP2 DDRP
- #define PIN_PP2 PINP
- //PP3
- #define BITMASK_PP3 _BV(PP3)
- #define PORT_PP3 PORTP
- #define DDR_PP3 DDRP
- #define PIN_PP3 PINP
- //PP4
- #define BITMASK_PP4 _BV(PP4)
- #define PORT_PP4 PORTP
- #define DDR_PP4 DDRP
- #define PIN_PP4 PINP
- //PP5
- #define BITMASK_PP5 _BV(PP5)
- #define PORT_PP5 PORTP
- #define DDR_PP5 DDRP
- #define PIN_PP5 PINP
- //PP6
- #define BITMASK_PP6 _BV(PP6)
- #define PORT_PP6 PORTP
- #define DDR_PP6 DDRP
- #define PIN_PP6 PINP
- //PP7
- #define BITMASK_PP7 _BV(PP7)
- #define PORT_PP7 PORTP
- #define DDR_PP7 DDRP
- #define PIN_PP7 PINP
- //PP8
- #define BITMASK_PP8 _BV(PP8)
- #define PORT_PP8 PORTP
- #define DDR_PP8 DDRP
- #define PIN_PP8 PINP
- //PP9
- #define BITMASK_PP9 _BV(PP9)
- #define PORT_PP9 PORTP
- #define DDR_PP9 DDRP
- #define PIN_PP9 PINP
- //PP10
- #define BITMASK_PP10 _BV(PP10)
- #define PORT_PP10 PORTP
- #define DDR_PP10 DDRP
- #define PIN_PP10 PINP
- //PP12
- #define BITMASK_PP12 _BV(PP12)
- #define PORT_PP12 PORTP
- #define DDR_PP12 DDRP
- #define PIN_PP12 PINP
- //PP13
- #define BITMASK_PP13 _BV(PP13)
- #define PORT_PP13 PORTP
- #define DDR_PP13 DDRP
- #define PIN_PP13 PINP
- //PP14
- #define BITMASK_PP14 _BV(PP14)
- #define PORT_PP14 PORTP
- #define DDR_PP14 DDRP
- #define PIN_PP14 PINP
- //PP15
- #define BITMASK_PP15 _BV(PP15)
- #define PORT_PP15 PORTP
- #define DDR_PP15 DDRP
- #define PIN_PP15 PINP
- //PP16
- #define BITMASK_PP16 _BV(PP16)
- #define PORT_PP16 PORTP
- #define DDR_PP16 DDRP
- #define PIN_PP16 PINP
- // ~~~~~~~~~ EXAMPLE ~~~~~~~~~~~
- /*
- // Example blink code for Arduino UNO 16MHz
- #define F_CPU 16000000UL // For delay.h to function
- #include <avr/io.h> // PIN, DDR, PORT defs
- #include <util/delay.h> //_delay_ms()
- #include "./AVRAugment_io.h"
- #define LED13 B5 // Only need to change this to swap pins
- #define DDR_13 SET_DDR( LED13, 0xFF ) //IN=0x00, OUT=0xFF
- #define ON_13 SET_PORT( LED13, 0xFF ) //LOW=0x00, HIGH=0xFF
- #define OFF_13 SET_PORT( LED13, 0x00 ) //LOW=0x00, HIGH=0xFF
- int main(void)
- {
- DDR_13;
- ON_13;
- while(1)
- {
- _delay_ms(2000);
- OFF_13;
- _delay_ms(2000);
- ON_13;
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement