00001 00025 #include<stdio.h> 00026 00028 #define LCD_COMMAND_DELAY 40 00029 00031 #define BUTTON_A 0x01 00032 00034 #define BUTTON_B 0x02 00035 00037 #define BUTTON_C 0x04 00038 00040 #define BUTTON_D 0x08 00041 00043 #define EEPROM_END 0xFFF 00044 00045 // this is needed for the delay on the new avr-libc-1.7.0 00046 #ifndef __DELAY_BACKWARD_COMPATIBLE__ 00047 #define __DELAY_BACKWARD_COMPATIBLE__ 00048 #endif 00049 00050 00051 /* Led functions */ 00052 00054 void Led1On(); 00055 00057 void Led2On(); 00058 00060 void Led3On(); 00061 00063 void Led4On(); 00064 00066 void Led1Off(); 00067 00069 void Led2Off(); 00070 00072 void Led3Off(); 00073 00075 void Led4Off(); 00076 00077 /* Button functions */ 00078 00080 uint8_t GetButtonA(); 00081 00083 uint8_t GetButtonB(); 00084 00086 uint8_t GetButtonC(); 00087 00089 uint8_t GetButtonD(); 00090 00092 uint8_t GetButton(); 00093 00094 /* LCD functions */ 00095 00097 uint8_t GetLCDState(); 00098 00100 void SetLCDState(uint8_t state); 00101 00103 void InitLCD(); 00104 00106 void WriteStringLCD(char *string, uint8_t len); 00107 00109 uint8_t LcdPutchar(uint8_t c, FILE *unused); 00110 00112 uint8_t CheckLCD(); 00113 00115 void LCDOff(); 00116 00118 void LCDOn(); 00119 00120 00121 /* EEPROM stuff */ 00122 00124 void WriteSingleByteEEPROM(uint16_t addr, uint8_t data); 00125 00127 uint8_t ReadSingleByteEEPROM(uint16_t addr); 00128 00130 void WriteBytesEEPROM(uint16_t addr, uint8_t *data, uint16_t len); 00131 00133 uint8_t* ReadBytesEEPROM(uint16_t addr, uint16_t len); 00134 00136 uint16_t Read16bitRegister(volatile uint16_t *reg); 00137 00139 void EraseEEPROM(); 00140