hw_tc520.h

Go to the documentation of this file.
00001 
00040 #ifndef HW_TC520_H
00041 #define HW_TC520_H
00042 
00043 #include <cfg/compiler.h>
00044 #include <avr/io.h>
00045 
00046 #define CE_PIN   PE6
00047 #define DV_PIN   PE5
00048 #define LOAD_PIN PE3
00049 #define READ_PIN PE4
00050 
00051 #define TC520_DDR  DDRE
00052 #define TC520_PORT PORTE
00053 #define TC520_PIN  PINE
00054 
00055 #define DV_HIGH() (TC520_PIN & BV(DV_PIN))
00056 #define DV_LOW()  (!DV_HIGH())
00057 
00058 #define CE_HIGH() (TC520_PORT |= BV(CE_PIN))
00059 #define CE_LOW()  (TC520_PORT &= ~BV(CE_PIN))
00060 
00061 #define LOAD_HIGH() (TC520_PORT |= BV(LOAD_PIN))
00062 #define LOAD_LOW()  (TC520_PORT &= ~BV(LOAD_PIN))
00063 
00064 #define READ_HIGH() (TC520_PORT |= BV(READ_PIN))
00065 #define READ_LOW()  (TC520_PORT &= ~BV(READ_PIN))
00066 
00067 #define TC520_HW_INIT \
00068 do\
00069 {\
00070     TC520_PORT |= (BV(CE_PIN) | BV(LOAD_PIN) | BV(READ_PIN));\
00071     TC520_DDR  |= (BV(CE_PIN) | BV(LOAD_PIN) | BV(READ_PIN));\
00072     TC520_DDR  &= ~BV(DV_PIN);\
00073 }\
00074 while(0)
00075 
00076 #endif /* HW_TC520_H */