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

📄 disp.c

📁 MP3播放器详细设计方案
💻 C
📖 第 1 页 / 共 2 页
字号:
/*C**************************************************************************
* $RCSfile: disp.c,v $
*----------------------------------------------------------------------------
* Copyright (c) 2002 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      $Name: DEMO_FAT_1_9_9 $      
* REVISION:     $Revision: 1.6 $     
* FILE_CVSID:   $Id: disp.c,v 1.6 2002/06/06 15:20:50 ffosse Exp $       
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the high level display routines
*****************************************************************************/

/*_____ I N C L U D E S ____________________________________________________*/

#include "config.h"                         /* system configuration */
#include "..\song\song_drv.h"               /* song driver definition */
#include "..\file\file.h"                   /* file definition */
#include "disp_task.h"                      /* display task definition */
#include "disp.h"                           /* display definition */


/*_____ M A C R O S ________________________________________________________*/


/*_____ D E F I N I T I O N ________________________________________________*/

extern  bdata   bit     gl_kbd_lock;    /* set to TRUE if keyboard locked */


/* mode patterns */
code    Byte cgram_mass[] =   { 0x04, 0x06, 0x0D, 0x15, 0x14, 0x04, 0x0E, 0x04 };
code    Byte cgram_song[] =   { 0x03, 0x0F, 0x0D, 0x09, 0x09, 0x0B, 0x1B, 0x18 };
code    Byte cgram_voice[] =  { 0x00, 0x0D, 0x13, 0x13, 0x13, 0x0D, 0x00, 0x00 };
code    Byte cgram_tools[] =  { 0x0E, 0x04, 0x15, 0x1F, 0x11, 0x1F, 0x04, 0x04 };

/* state patterns */
code    Byte cgram_stop[] =   { 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00 };
code    Byte cgram_play[] =   { 0x00, 0x08, 0x0C, 0x0E, 0x0F, 0x0E, 0x0C, 0x08 };
code    Byte cgram_pause[] =  { 0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00 };
code    Byte cgram_rec[] =    { 0x00, 0x00, 0x1F, 0x0E, 0x04, 0x1F, 0x00, 0x00 };

/* sound patterns */
code    Byte cgram_volume[] = { 0x02, 0x06, 0x1A, 0x12, 0x1A, 0x06, 0x02, 0x00 };
code    Byte cgram_bass[] =   { 0x07, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10, 0x00 };
code    Byte cgram_medium[] = { 0x04, 0x0A, 0x0A, 0x0A, 0x11, 0x11, 0x11, 0x00 };
code    Byte cgram_treble[] = { 0x1C, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x00 };

/* memory patterns */
code    Byte cgram_df[] =     { 0x0E, 0x1B, 0x0A, 0x1B, 0x0A, 0x1B, 0x0E, 0x00 };
code    Byte cgram_mmc1[] =   { 0x1C, 0x12, 0x11, 0x15, 0x11, 0x11, 0x11, 0x1F };
code    Byte cgram_mmc2[] =   { 0x1C, 0x12, 0x11, 0x15, 0x11, 0x15, 0x11, 0x1F };

/* file pattern */
code    Byte cgram_mp3[] =    { 0x04, 0x06, 0x07, 0x04, 0x04, 0x0C, 0x1C, 0x08 };
code    Byte cgram_wav[] =    { 0x00, 0x00, 0x02, 0x15, 0x15, 0x08, 0x00, 0x00 };
code    Byte cgram_dir[] =    { 0x00, 0x00, 0x00, 0x0C, 0x13, 0x11, 0x1F, 0x00 };

/* misc pattern */
code    Byte cgram_repeat[] = { 0x00, 0x00, 0x0E, 0x01, 0x09, 0x1E, 0x08, 0x00 };
code    Byte cgram_lock[] =   { 0x04, 0x1C, 0x0C, 0x04, 0x04, 0x0C, 0x12, 0x0C };
code    Byte cgram_blank[] =  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
code    Byte cgram_error[] =  { 0x00, 0x00, 0x00, 0x0A, 0x04, 0x0A, 0x00, 0x00 };


/*_____ D E C L A R A T I O N ______________________________________________*/


/*F**************************************************************************
* NAME: print_init
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print initialization
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_init (void)
{
  lcd_init ();                              /* lcd initialization */
  lcd_cgram(CGRAM_SOUND, cgram_volume);     /* init volume icon */
  lcd_cgram(CGRAM_REPEAT, cgram_repeat);    /* init repeat icon */
  lcd_cgram(CGRAM_MODE, cgram_song);        /* init mode icon to song */
  lcd_cgram(CGRAM_STATE, cgram_stop);       /* init state icon to stop */
  print_kbd_lock();                         /* set lock icon or not */
}


/*F**************************************************************************
* NAME: print_state_blank
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the blank icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_blank (void)
{
  lcd_cgram(CGRAM_STATE, cgram_blank);      /* select blank icon */
}


/*F**************************************************************************
* NAME: print_state_stop
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the stop icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_stop (void)
{
  lcd_cgram(CGRAM_STATE, cgram_stop);       /* select stop icon */
}


/*F**************************************************************************
* NAME: print_state_play
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the play icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_play (void)
{
  lcd_cgram(CGRAM_STATE, cgram_play);       /* select play icon */
}


/*F**************************************************************************
* NAME: print_state_pause
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the pause icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_pause (void)
{
  lcd_cgram(CGRAM_STATE, cgram_pause);      /* select pause icon */
}


/*F**************************************************************************
* NAME: print_state_record
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the record icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_record (void)
{
  lcd_cgram(CGRAM_STATE, cgram_rec);        /* select record icon */
}



/*F**************************************************************************
* NAME: print_state_error
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the error icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_error (void)
{
  lcd_cgram(CGRAM_STATE, cgram_error);      /* select error icon */
}



/*F**************************************************************************
* NAME: print_mode_song
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the song icon on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mode_song (void)
{
  lcd_cgram(CGRAM_MODE, cgram_song);        /* select song icon */
}


/*F**************************************************************************
* NAME: print_mode_voice
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the voice icon on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mode_voice (void)
{
  lcd_cgram(CGRAM_MODE, cgram_voice);       /* select voice icon */
}


/*F**************************************************************************
* NAME: print_mode_mass
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the mass storage icon on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mode_mass (void)
{
  lcd_cgram(CGRAM_MODE, cgram_mass);        /* select mass storage icon */
}


/*F**************************************************************************
* NAME: print_mode_tool
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the tool icon on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mode_tool (void)
{
  lcd_cgram(CGRAM_MODE, cgram_tools);       /* select tool icon */
}


/*F**************************************************************************
* NAME: print_mode_blank
*----------------------------------------------------------------------------
* AUTHOR:  
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the blank mode icon on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mode_blank (void)
{
  lcd_cgram(CGRAM_MODE, cgram_blank);       /* select blank icon */
}


/*F**************************************************************************
* NAME: print_sound
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the sound icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_sound (void)
{
  switch (song_get_sound())
  {
    case SND_VOLUME:
    {
      lcd_cgram(CGRAM_SOUND, cgram_volume);
      break;
    }
    case SND_BASS:
    {
      lcd_cgram(CGRAM_SOUND, cgram_bass);
      break;
    }
    case SND_MEDIUM:
    {
      lcd_cgram(CGRAM_SOUND, cgram_medium);
      break;
    }
    case SND_TREBLE:
    {
      lcd_cgram(CGRAM_SOUND, cgram_treble);
      break;
    }
  }
}


/*F**************************************************************************
* NAME: print_sound_level
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the sound level
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_sound_level (void)
{
  lcd_set_cur(POS_SOUND_LVL);
  print_decim(song_get_level(), FALSE);

⌨️ 快捷键说明

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