rendered paste body#ifndef _PORTS_H#define _PORTS_H#include<avr/interrupt.h>#define bit0 _BV(0)#define bit1 _BV(1)#define bit2 _BV(2)#define bit3 _BV(3)#define bit4 _BV(4)#define bit5 _BV(5)#define bit6 _BV(6)#define bit7 _BV(7)#define all bit0|bit1|bit2|bit3|bit4|bit5|bit6|bit6|bit7namespace Ports{ #ifdef PORTA struct PortA { static void setInputBits(unsigned char bit_mask) { DDRA &= ~bit_mask; } static void setOutputBits(unsigned char bit_mask) { DDRA |= bit_mask; } static void setValue(unsigned char value) { PORTA = value; } static unsigned char getValue() { return PINA; } }; #endif /* PORTA */ #ifdef PORTB struct PortB { static void setInputBits(unsigned char bit_mask) { DDRB &= ~bit_mask; } static void setOutputBits(unsigned char bit_mask) { DDRB |= bit_mask; } static void setValue(unsigned char value) { PORTB = value; } static unsigned char getValue() { return PINB; } }; #endif /* PORTB */ #ifdef PORTC struct PortC { static void setInputBits(unsigned char bit_mask) { DDRC &= ~bit_mask; } static void setOutputBits(unsigned char bit_mask){ DDRC |= bit_mask; } static void setValue(unsigned char value) { PORTC = value; } static unsigned char getValue() { return PINC; } }; #endif /* PORTC */ #ifdef PORTD struct PortD { static void setInputBits(unsigned char bit_mask) { DDRD &= ~bit_mask; } static void setOutputBits(unsigned char bit_mask){ DDRD |= bit_mask; } static void setValue(unsigned char value) { PORTD = value; } static unsigned char getValue() { return PIND; } }; #endif /* PORTD */}#endif /* _PORTS_H */