ButterflyMP3

lcdgraphics_alpha.c

Go to the documentation of this file.
00001 
00032 #ifdef ALPHA
00033 
00034 #include <avr/io.h>
00035 #include <avr/pgmspace.h>
00036 #include <avr/interrupt.h>
00037 #include "main.h"
00038 #include "types.h"
00039 #include "lcdgraphics.h"
00040 #include "BCD.h"
00041 #include "avrfat16.h"                   // Included for long filename / ID3 stuff.
00042         
00043 
00044         #include "LCD_driver.h"
00045         #include "LCD_functions.h"
00046 //      volatile char gLCD_Update_Required;
00047 //      char LCD_Data[LCD_REGISTER_COUNT];
00048 //      char gTextBuffer[TEXTBUFFER_SIZE];
00049 //      volatile char gScrollMode;
00050 //      char gFlashTimer;
00051 //      char gColon;
00052 //      volatile signed char gScroll;
00053         uint8   ALPHA_textBufferPos;
00054 extern uint8    gDisplayTimeOut; // from main.c to set # of seconds to show info
00055 
00056 #include "uart.h"
00057 
00058 
00059 
00060 
00061 
00065 void LCD_Initialize(void)
00066 {
00067                 LCD_Init();
00068 }
00069 
00070 
00074 void LCD_Blank(void)
00075 {
00076 
00077                 LCD_Clear();
00078 
00079 }
00080 
00081 
00085 void LCD_Sleep(void)
00086 {
00087 
00088                 LCD_Clear();
00089                 //CBI(LCDCRA, 7);             // disable LCD
00090                 //Enable LCD start of frame interrupt
00091                 LCDCRA &= ~( (1<<LCDEN));
00092 }
00093 
00094 
00098 void LCD_Wake(void)
00099 {
00100         extern uint8 gLCD_Refresh;
00101 
00102 
00103         LCD_Init();
00104         //SBI(LCDCRA, 7);             // enable LCD
00105         LCDCRA |=  (1<<LCDEN) ;
00106         gLCD_Refresh=TRUE;
00107 }
00108 
00109 
00115 void LCD_PrintfU4(uint8 Data)
00116 {
00117         /* Send 4-bit hex value */
00118     uint8 Character[2];
00119         Character[0] = Data&0x0f;
00120     if (Character[0]>9)
00121     {
00122         Character[0]+='A'-10;
00123     }
00124     else
00125     {
00126         Character[0]+='0';
00127     }
00128 
00129         gTextBuffer[ALPHA_textBufferPos++] = Character[0];
00130         gTextBuffer[ALPHA_textBufferPos] =0;
00131 
00132         
00133 }
00134 
00139 void LCD_PrintfU8(uint8 Data)
00140 {
00141     /* Send 8-bit hex value */
00142     LCD_PrintfU4(Data>>4);
00143     LCD_PrintfU4(Data);
00144 }
00145 
00146 
00147 
00148 
00149 
00150 
00158 uint8 LCD_Time(uint16 data)
00159 {
00160 
00161         return 0;
00162 }
00163 
00169 uint8 LCD_FileName(uint8 resetScroll)
00170 {
00171         uint8 i;
00172         //extern char gScroll;
00173         //extern char gScrollMode;
00174 
00175         extern char gLCD_Start_Scroll_Timer;
00176  
00177         gDisplayTimeOut = 0;
00178         gShowFilename = TRUE;
00179         for (i=0;FAT16_longfilename[i]&&i<=LFN_BUFFER_LENGTH;i++); // find name length
00180         if ((i>6)){ // scroll if larger than display
00181                 gLCD_Start_Scroll_Timer=3;
00182                 gScroll=0;
00183                 LCD_UpdateRequired(TRUE,TRUE);
00184         } else{
00185                 gScroll = 0;
00186                 LCD_UpdateRequired(TRUE,FALSE);
00187         }
00188         
00189         return 0;
00190 }
00191 
00195 void LCD_Play(void)
00196 {
00197         //gShowFilename =FALSE; 
00198         LCD_puts_f(PSTR("PLAY\0"), 1);
00199         gDisplayTimeOut = STAT_DISPLAY_TIME+1;
00200         //LCD_UpdateRequired(TRUE,TRUE);
00201 
00202 }
00203 
00204 
00208 void LCD_Stop(void)
00209 {
00210         LCD_puts_f(PSTR("STOP\0"), 1);
00211         gDisplayTimeOut = STAT_DISPLAY_TIME+1;
00212 
00213 }
00214 
00215 
00219 void LCD_Pause(void)
00220 {
00221 
00222         LCD_puts_f(PSTR("PAUSE\0"), 1);
00223         gDisplayTimeOut = STAT_DISPLAY_TIME+1;
00224 
00225 }
00226 
00231 void LCD_Vol(uint8 volume, uint8 boostOn)
00232 {
00233                 gTextBuffer[0]='V';
00234                 gTextBuffer[1]='O';
00235                 gTextBuffer[2]='L';
00236                 gTextBuffer[3]=' ';
00237                 ALPHA_textBufferPos =4; 
00238                 LCD_PrintfU4(volume);
00239 
00240                 gDisplayTimeOut = STAT_DISPLAY_TIME+1;
00241                 LCD_puts(gTextBuffer,1);
00242 }
00243 
00248 uint8 LCD_Tester(void)
00249 {
00250                 
00251 
00252         uint8 i;
00253         gShowFilename = TRUE;
00254 
00255         for (i = 0; pgm_read_byte(&VERSIONINFO1[i]) && i < 25; i++){
00256                 FAT16_longfilename[i] = pgm_read_byte(&VERSIONINFO1[i]);
00257     }
00258         FAT16_longfilename[i] = 0;
00259         LCD_UpdateRequired(TRUE,TRUE);
00260         
00261 
00262         return 0;
00263 }       
00264 
00265 
00266 
00270 void LCD_Scanning(void)
00271 {
00272 
00273         LCD_puts_f( PSTR("SCANNING...\0"),1);
00274         gDisplayTimeOut = 0;
00275 
00276         
00277 }
00278 
00282 void LCD_Battery(uint8 percentage)
00283 {
00284 
00285         // TODO: make use of the flat battery LCD segment
00286         if (percentage <100){
00287                 ALPHA_textBufferPos =0; 
00288                 LCD_PrintfU8(CHAR2BCD2(percentage));
00289         }else{
00290                 gTextBuffer[0]='1';
00291                 gTextBuffer[1]='0';
00292                 gTextBuffer[2]='0';
00293                 ALPHA_textBufferPos =3; 
00294         }
00295         gTextBuffer[ALPHA_textBufferPos]=' ';
00296         gTextBuffer[ALPHA_textBufferPos+1]='*';//'%'
00297         gTextBuffer[ALPHA_textBufferPos+2]='/';
00298         gTextBuffer[ALPHA_textBufferPos+3]=':';
00299         gTextBuffer[ALPHA_textBufferPos+4]=' ';
00300         gTextBuffer[ALPHA_textBufferPos+5]='B';
00301         gTextBuffer[ALPHA_textBufferPos+6]='T';
00302         gTextBuffer[ALPHA_textBufferPos+7]='R';
00303         gTextBuffer[ALPHA_textBufferPos+8]='Y';
00304         gTextBuffer[ALPHA_textBufferPos+9]=0x00;
00305         LCD_puts(gTextBuffer,1);
00306         gDisplayTimeOut = STAT_DISPLAY_TIME+1;
00307         
00308 }
00309 
00310 #endif
 All Files Functions Variables Typedefs Enumerations Enumerator Defines