?? lcd_drv.c
字號:
/*C**************************************************************************
* NAME: lcd_drv.c
*----------------------------------------------------------------------------
* Copyright (c) 2004 Toplow.
*----------------------------------------------------------------------------
* RELEASE: snd1c-refd-nf-4_0_3
* REVISION: 1.0
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the LCD driver routines
*
* NOTES:
*****************************************************************************/
/*_____ I N C L U D E S ____________________________________________________*/
#include "config.h" /* system configuration */
#include "lib_mcu\c51_drv.h" /* c51 driver definition */
#include "lcd_drv.h" /* usb driver definition */
#include "modules\song\song_drv.h"
#include "modules\unicode\unicode.h"
//#include "lib_mcu\serial\serial.h"
/*_____ M A C R O S ________________________________________________________*/
extern char pdata *lfn_name;
extern Uint16 song_name[11];
extern uchar song_name_count;
extern bit bdata song_name_style;
extern Byte song_sound;
extern Byte mp3_volume;
/*_____ D E F I N I T I O N ________________________________________________*/
void putchar(a)
{
LCDRS = 1;
LCDRW = 0;
LCDEN = 1;
LCDPORT = a;
LCDEN = 0;
}
void putcomm(a)
{
LCDRS = 0;
LCDRW = 0;
LCDEN = 1;
LCDPORT = a;
LCDEN = 0;
}
void ReadBusy(void)
{
uchar busy;
do{
LCDPORT = 0xff;
LCDRS = 0;
LCDRW = 1;
LCDEN = 1;
busy = LCDPORT;
LCDEN= 0;
} while(busy & 0x80);
}
void printch(uchar pos, uchar *ptr)
{
uchar j;
while (*ptr != ' ')
{
ReadBusy();
putcomm(pos);
for (j=0; j<2; j++)
{
ReadBusy();
putchar(*ptr ++);
}
pos ++;
}
}
void lcdcls (uchar pos)
{
uchar i;
for (i = 0; i < 8; i++)
{
ReadBusy();
putcomm(pos + i);
ReadBusy();
putchar(' ');
ReadBusy();
putchar(' ');
}
}
void lcd_ini(void)
{
putcomm(0x30);
putcomm(0x04);
ReadBusy();
putcomm(0x0c);
ReadBusy();
putcomm(0x01);
ReadBusy();
putcomm(0x02);
}
void print_file_name()
{
uchar n,y,x;
uchar find_code = 0;
song_name_style = 0;
for (n = 0; n < 8; n++)
{
for (y = 0; y < 72; y++)
{
for (x = 0; x < 96; x++)
{
if (song_name[n] == Unicode[y][x])
{
song_name[n] =(Uint16)((0xb0+y)<<8)+(0xa0+x);
find_code = 1;
song_name_style = 1; //1-CHINESE NAME ,0-ENGLISH NAME
break;
}
}
if (find_code)
{
find_code = 0;
break;
}
}
}
for (n = 0; n < 8; n++)
{
ReadBusy();
putcomm(0x80+n);
if (song_name_style)
{
ReadBusy();
putchar((Byte)(song_name[n]>>8));
ReadBusy();
putchar((Byte)(song_name[n]));
}
else
{
ReadBusy();
putchar(*lfn_name++);
ReadBusy();
putchar(*lfn_name++);
}
}
}
void print_sound_level()
{
switch (song_sound)
{
case SND_VOLUME:
{
printch(0x93,"音量 ");
ReadBusy();
putcomm(0x95);
ReadBusy();
putchar(0x30+(Byte)(song_get_level()/10));
ReadBusy();
putchar(0x30+song_get_level()%10);
break;
}
case SND_BASS:
{
printch(0x93,"低音 ");
ReadBusy();
putcomm(0x95);
ReadBusy();
putchar(0x30+(Byte)(song_get_level()/10));
ReadBusy();
putchar(0x30+song_get_level()%10);
printch(0x96,"關 ");
break;
}
case SND_MEDIUM:
{
printch(0x93,"中音 ");
ReadBusy();
putcomm(0x95);
ReadBusy();
putchar(0x30+(Byte)(song_get_level()/10));
ReadBusy();
putchar(0x30+song_get_level()%10);
break;
}
case SND_TREBLE:
{
printch(0x93,"高音 ");
ReadBusy();
putcomm(0x95);
ReadBusy();
putchar(0x30+(Byte)(song_get_level()/10));
ReadBusy();
putchar(0x30+song_get_level()%10);
break;
}
case SND_NONDIS:
{
printch(0x93,"選曲 ");
break;
}
/*case SND_BBOOST:
{
if (song_get_level())
printch(0x96,"BST ");
else printch(0x96," ");
break;
}*/
default : break;
}
}
void disp_clock_reset()
{;}
void disp_clock_start()
{;}
void print_state_play()
{
printch(0x90,"播放 ");
}
void disp_clock_stop()
{;}
void print_state_pause()
{
printch(0x90,"暫停 ");
}
void disp_name_stop()
{;}
void disp_end_of_play()
{;}
void print_state_error()
{
printch(0x90,"錯誤 ");
}
void print_repeat(bit song_repeat)
{
if(song_repeat)
printch(0x87,"R ");
else
printch(0x87," ");
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -