⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 disp.c

📁 ATMEL公司AT89C51SND1为主控制器MP3源代码
💻 C
📖 第 1 页 / 共 3 页
字号:

/*F**************************************************************************
* NAME: print_mem
*----------------------------------------------------------------------------
* PARAMS:
*   - mem_type  SYMB_CHIP
*               SYMB_CARD
*               SYMB_CARD2
*               SYMB_NO_MEM
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the memory type on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mem (Byte mem_type)
{
#if CONF_DISPLAY == LCD
  switch (mem_type)
  {
    case SYMB_CHIP:
      lcd_cgram(CGRAM_MEM, cgram_chip);
      break;

    case SYMB_CARD:
      lcd_cgram(CGRAM_MEM, cgram_card);
      break;

    case SYMB_CARD1:
      lcd_cgram(CGRAM_MEM, cgram_card1);
      break;

    case SYMB_CARD2:
      lcd_cgram(CGRAM_MEM, cgram_card2);
      break;

    default:
      lcd_cgram(CGRAM_MEM, cgram_blank);
      break;
  }
#else
  if (mem_type);
#endif
}


/*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 (Byte rep_type)
{
#if CONF_DISPLAY == LCD
  switch (rep_type)
  {
    case SYMB_REP_DIR:
      lcd_cgram(CGRAM_REPEAT, cgram_repeat);
      break;

    case SYMB_REP_FILE:
      lcd_cgram(CGRAM_REPEAT, cgram_repeat);
      break;

    case SYMB_REP_A:
      lcd_cgram(CGRAM_REPEAT, cgram_rep_A);
      break;

    case SYMB_REP_B:
      lcd_cgram(CGRAM_REPEAT, cgram_rep_B);
      break;

    default:
      lcd_cgram(CGRAM_REPEAT, cgram_blank);
      break;
  }
#else
  if (rep_type);
#endif
}


/*F*****************************************************************************
* NAME: print_file_name
*-------------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print to lcd the current file name
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_file_name()
{
#if CONF_DISPLAY == LCD
  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;
  }
#endif
  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()
{
#if CONF_DISPLAY == LCD
  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;
  }
#endif
}


/*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)
{
#if CONF_DISPLAY == LCD
  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');
#else
  if (string);
  return 1;
#endif

}


/*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)
{
#if CONF_DISPLAY == LCD
  lcd_set_cur(POS_HOME);
  while (*screen != '\0')
  {
    lcd_putchar(*screen++);
  }
#else
  if (screen);
#endif
}


/*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)
{
#if CONF_DISPLAY == LCD
  while (*string != '\0')
  {
    lcd_putchar(*string++);
  }
#else
  if (string);
#endif
}


#if CONF_DISPLAY == LED
/*F**************************************************************************
* NAME: print_fatal_screen
*----------------------------------------------------------------------------
* PARAMS:
*   screen: string in code space to print on LCD
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print a screen string on LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_fatal_screen (void)
{
  LED_TREEB = LED_BASS=LED_MED = 0;
  LED_VOL = 1;
}
#endif

/*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 CONF_DISPLAY == LCD
  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');
  }
#else
  if (b && space);
#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -