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