hw_input.h
Go to the documentation of this file.00001
00041 #ifndef HW_INPUT_H
00042 #define HW_INPUT_H
00043
00044
00045 #define INPUT_INIT_D do \
00046 { \
00047 (DDRD &= ~(BV(PD4) | BV(PD5) | BV(PD6) | BV(PD7))); \
00048 (PORTD |= (BV(PD4) | BV(PD5) | BV(PD6) | BV(PD7))); \
00049 } while(0)
00050
00051 #define INPUT_INIT_E do \
00052 { \
00053 (DDRE &= ~(BV(PE4) | BV(PE5) | BV(PE6) | BV(PE7))); \
00054 ATOMIC((PORTE |= (BV(PE4) | BV(PE5) | BV(PE6) | BV(PE7)))); \
00055 } while(0)
00056
00057 #define INPUT_INIT do { INPUT_INIT_D; INPUT_INIT_E;} while(0)
00058
00059 INLINE uint8_t INPUT_GET(void)
00060 {
00061 uint8_t out_d, out_e;
00062 out_d = PIND;
00063 out_e = PINE;
00064
00065 out_d >>= 4;
00066 out_e = out_e & 0xF0;
00067
00068 return out_e | out_d;
00069 }
00070
00071 #endif // HW_INPUT_H