00001 00034 #ifndef _SCD_IO_H_ 00035 #define _SCD_IO_H_ 00036 00037 #include<stdio.h> 00038 #include<avr/io.h> 00039 00041 #define LCD_COMMAND_DELAY 40 00042 00044 #define BUTTON_A 0x01 00045 00047 #define BUTTON_B 0x02 00048 00050 #define BUTTON_C 0x04 00051 00053 #define BUTTON_D 0x08 00054 00055 // this is needed for the delay on the new avr-libc-1.7.0 00056 #ifndef __DELAY_BACKWARD_COMPATIBLE__ 00057 #define __DELAY_BACKWARD_COMPATIBLE__ 00058 #endif 00059 00060 00061 /* Led functions */ 00062 00064 void Led1On(); 00065 00067 void Led2On(); 00068 00070 void Led3On(); 00071 00073 void Led4On(); 00074 00076 void Led1Off(); 00077 00079 void Led2Off(); 00080 00082 void Led3Off(); 00083 00085 void Led4Off(); 00086 00087 /* Other signals */ 00088 void T_C4On(); 00089 void T_C8On(); 00090 void T_C4Off(); 00091 void T_C8Off(); 00092 void JTAG_P1_High(); 00093 void JTAG_P3_High(); 00094 void JTAG_P1_Low(); 00095 void JTAG_P3_Low(); 00096 00097 /* Button functions */ 00098 00100 uint8_t GetButtonA(); 00101 00103 uint8_t GetButtonB(); 00104 00106 uint8_t GetButtonC(); 00107 00109 uint8_t GetButtonD(); 00110 00112 uint8_t GetButton(); 00113 00114 /* LCD functions */ 00115 00117 uint8_t GetLCDState(); 00118 00120 void SetLCDState(uint8_t state); 00121 00123 void InitLCD(); 00124 00126 void WriteStringLCD(char *string, uint8_t len); 00127 00129 int LcdPutchar(char c, FILE *unused); 00130 00132 uint8_t CheckLCD(); 00133 00135 void LCDOff(); 00136 00138 void LCDOn(); 00139 00140 00141 /* EEPROM stuff */ 00142 00144 void WriteSingleByteEEPROM(uint16_t addr, uint8_t data); 00145 00147 uint8_t ReadSingleByteEEPROM(uint16_t addr); 00148 00150 void WriteBytesEEPROM(uint16_t addr, uint8_t *data, uint16_t len); 00151 00153 uint8_t* ReadBytesEEPROM(uint16_t addr, uint16_t len); 00154 00156 uint16_t Read16bitRegister(volatile uint16_t *reg); 00157 00159 void InitUSART(uint16_t baudUBRR); 00160 00162 void DisableUSART(); 00163 00164 // Send a character through the USART 00165 void SendCharUSART(char data); 00166 00167 // Get a character from the USART 00168 char GetCharUSART(void); 00169 00170 // Flush the USART receive buffer 00171 void FlushUSART(void); 00172 00173 // Receives a line (ended CR LF) from the USART 00174 char* GetLineUSART(); 00175 00176 // Send a string data to the USART 00177 void SendLineUSART(const char *data); 00178 00179 #endif // _SCD_IO_H_