📄 disp.c
字号:
}
/*F**************************************************************************
* NAME: print_voice_vol
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print the voice volume
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_voice_vol (char volume)
{
lcd_set_cur(POS_SOUND_LVL);
lcd_putchar(volume + '0');
}
/*F**************************************************************************
* NAME: print_time
*----------------------------------------------------------------------------
* PARAMS:
* - min: minute to display
* - sec: second to display
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print time on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_time (Byte min, Byte sec)
{
lcd_set_cur(POS_TIME);
print_decim(min, TRUE);
lcd_putchar(':');
print_decim(sec, FALSE);
}
/*F**************************************************************************
* NAME: print_sec
*----------------------------------------------------------------------------
* PARAMS:
* - sec: second to display
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print second of time on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_sec (Byte sec)
{
lcd_set_cur(POS_SECOND);
print_decim(sec, FALSE);
}
/*F**************************************************************************
* NAME: print_min
*----------------------------------------------------------------------------
* PARAMS:
* - min: minute to display
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print minute of time on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_min (Byte min)
{
lcd_set_cur(POS_MINUTE);
print_decim(min, TRUE);
}
/*F**************************************************************************
* NAME: print_kbd_lock
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print the lock status
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_kbd_lock (void)
{
if (gl_kbd_lock)
{
lcd_cgram(CGRAM_LOCK, cgram_lock); /* init lock icon to locked */
}
else
{
lcd_cgram(CGRAM_LOCK, cgram_blank); /* init lock icon to locked */
}
}
/*F**************************************************************************
* NAME: print_mem
*----------------------------------------------------------------------------
* PARAMS:
* - mem_type SYMB_DF
* SYMB_MMC1
* SYMB_MMC2
* SYMB_NO_MEM
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print the memory type on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mem (Byte mem_type)
{
switch (mem_type)
{
case SYMB_DF:
lcd_cgram(CGRAM_MEM, cgram_df);
break;
case SYMB_MMC1:
lcd_cgram(CGRAM_MEM, cgram_mmc1);
break;
case SYMB_MMC2:
lcd_cgram(CGRAM_MEM, cgram_mmc2);
break;
default:
lcd_cgram(CGRAM_MEM, cgram_blank);
break;
}
}
/*F**************************************************************************
* NAME: print_repeat
*----------------------------------------------------------------------------
* PARAMS:
* status: - TRUE: play is repeated after last song
* - FALSE: play is stopped after last song
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print repeat status on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_repeat (bit status)
{
lcd_set_cur(POS_REPEAT);
if (status == TRUE)
{
lcd_putchar(CGRAM_REPEAT / CGRAM_CHAR_SIZE);
}
else
{
lcd_putchar(' ');
}
}
/*F*****************************************************************************
* NAME: print_file_name
*-------------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print to lcd the current file name
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_file_name()
{
switch(File_type()) /* print file type icon */
{
case FILE_DIR:
lcd_cgram(CGRAM_TYPE, cgram_dir); /* select directory icon */
break;
case FILE_MP3:
lcd_cgram(CGRAM_TYPE, cgram_mp3); /* select song icon */
break;
case FILE_WAV:
lcd_cgram(CGRAM_TYPE, cgram_wav); /* select voice icon */
break;
default:
lcd_cgram(CGRAM_TYPE, cgram_blank); /* select voice icon */
break;
}
disp_name_start(); /* start name display */
}
/*F*****************************************************************************
* NAME: print_file_type
*-------------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print to lcd the current file type
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_file_type()
{
switch(File_type()) /* print file type icon */
{
case FILE_DIR:
lcd_cgram(CGRAM_TYPE, cgram_dir); /* select directory icon */
break;
case FILE_MP3:
lcd_cgram(CGRAM_TYPE, cgram_mp3); /* select song icon */
break;
case FILE_WAV:
lcd_cgram(CGRAM_TYPE, cgram_wav); /* select voice icon */
break;
default:
lcd_cgram(CGRAM_TYPE, cgram_blank); /* select voice icon */
break;
}
}
/*F*****************************************************************************
* NAME: print_name
*-------------------------------------------------------------------------------
* PARAMS:
* string: pointer on char string
* return:
* TRUE: at the end of the string
* FALSE: in the middle of the string
*----------------------------------------------------------------------------
* PURPOSE:
* Print 14 characters of the file name
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit print_name (char pdata *string)
{
lcd_set_cur(POS_FILE);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
lcd_putchar(*string++);
return (*string == '\0');
}
/*F**************************************************************************
* NAME: print_screen
*----------------------------------------------------------------------------
* PARAMS:
* screen: string in code space to print on LCD
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print a screen string on LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_screen (char code *screen)
{
lcd_set_cur(POS_HOME);
while (*screen != '\0')
{
lcd_putchar(*screen++);
}
}
/*F**************************************************************************
* NAME: print_string
*----------------------------------------------------------------------------
* PARAMS:
* string: string in code space to print on LCD
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Print a string on LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_string (char code *string)
{
while (*string != '\0')
{
lcd_putchar(*string++);
}
}
/*F****************************************************************************
* NAME: print_decim
*------------------------------------------------------------------------------
* PARAMS:
* b: number to print
* space: TRUE: print ' 0', FALSE: print '00'
* return:
*------------------------------------------------------------------------------
* PURPOSE:
* Print a 2 digits number on LCD '00-99' or ' 0-99'
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_decim (Byte b, bit space)
{
if (b < 10)
{
if (space)
lcd_putchar(' ');
else
lcd_putchar('0');
lcd_putchar(b +'0');
}
else
{
lcd_putchar(b / 10 +'0');
lcd_putchar(b % 10 +'0');
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -