📄 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 bit bdata song_name_style;
extern Byte song_sound;
extern Byte mp3_volume;
/*_____ D E F I N I T I O N ________________________________________________*/
void ReadBusy(void)
{uchar busy;
do{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);
printch(0x80,"硬盘MP3 播放器 ");
printch(0x90,"设计: 邵春伟 ");
}
void print_file_name()
{
uchar n,y,x;
uchar find_code = 0;
song_name_style = 0;
// printch(0x90,"歌曲 ");
for (n = 0; n < 7; 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 < 7; 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);
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 + -