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

📄 disp.c

📁 ATMEL公司AT89C51SND1为主控制器MP3源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
/*C**************************************************************************
* NAME:         disp.c
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      snd1c-refd-nf-4_0_3      
* REVISION:     1.12     
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the high level display routines
*****************************************************************************/

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

#include "config.h"                 /* system configuration */
#include "lib_mcu\kbd\kbd_drv.h"    /* Keyboard driver definition */
#include "modules\song\song_drv.h"  /* song driver definition */
#include "modules\file\file.h"      /* file definition */
#include "disp_task.h"              /* display task definition */
#include "disp.h"                   /* display definition */
#if CONF_DISPLAY == LED
#include "modules\mem\mem_task.h"           /* memory task definition */
#include "modules\display\led.h"            /* led definition */
#endif

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


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

#if CONF_DISPLAY == LCD
  extern  bdata   bit     gl_kbd_lock;   /* set to TRUE if keyboard locked */
  extern  bdata   bit     fs_memory;     /* selected file system */

/* 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 */
#if (MEM_CHIP_TYPE != CHIP_HDD)
  code    Byte cgram_chip[] =   { 0x0E, 0x1B, 0x0A, 0x1B, 0x0A, 0x1B, 0x0E, 0x00 };
#else
  code    Byte cgram_chip[] =   { 0x04, 0xA, 0x15, 0x11, 0x11, 0x15, 0x0A, 0x04 };
#endif

#if (MEM_CARD_TYPE != CARD_CDR)
  code    Byte cgram_card[] =   { 0x1C, 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1F };
#else
  code    Byte cgram_card[] =   { 0x04, 0x0A, 0x15, 0x15, 0x0A, 0x04, 0x00, 0x00 };
#endif

code    Byte cgram_card1[] =  { 0x1C, 0x12, 0x11, 0x15, 0x11, 0x11, 0x11, 0x1F };
code    Byte cgram_card2[] =  { 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 };

/* repeat pattern */
code    Byte cgram_repeat[] = { 0x00, 0x00, 0x0E, 0x01, 0x09, 0x1E, 0x08, 0x00 };
code    Byte cgram_rep_A[] =  { 0x02, 0x1F, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 };
code    Byte cgram_rep_B[] =  { 0x02, 0x1F, 0x02, 0x00, 0x00, 0x08, 0x1F, 0x08 };

/* misc pattern */
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 };


#else
  extern  xdata Byte    func_timeout;
  extern  xdata Byte    func_state;
  extern  xdata Byte    ref_state;
  extern        bit     playing;
  extern        bit     recording;
  extern        bit     pause;
  extern        bit     bargraph;
  extern        Byte    song_sound;
  extern  xdata Byte    LED_ON;
  extern  xdata Byte    LED_FAST;
  extern  Byte    mem_state;                  /* task state */
#endif



/*_____ 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)
{
#if CONF_DISPLAY == LCD
  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 */
#else
  led_task_init();
#endif
}


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


/*F**************************************************************************
* NAME: print_state_stop
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the stop icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_stop (void)
{
#if CONF_DISPLAY == LCD
  lcd_cgram(CGRAM_STATE, cgram_stop);       /* select stop icon */
#else
  LED_FAST = 3;
#endif
}


/*F**************************************************************************
* NAME: print_state_play
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the play icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_play (void)
{
#if CONF_DISPLAY == LCD
  lcd_cgram(CGRAM_STATE, cgram_play);       /* select play icon */
#else
  LED_ON = (8 >> ref_state);
  LED_FAST = 1;
  func_state = 0;
  playing = TRUE;  
#endif
}


/*F**************************************************************************
* NAME: print_state_pause
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the pause icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_pause (void)
{
#if CONF_DISPLAY == LCD
  lcd_cgram(CGRAM_STATE, cgram_pause);      /* select pause icon */
#else
  LED_ON = (8 >> ref_state);
  if (recording) LED_FAST = 2;
  else LED_FAST = 3;
  func_state = 0;
  playing = FALSE;
  pause = TRUE;
#endif
}


/*F**************************************************************************
* NAME: print_state_record
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the record icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_record (void)
{
#if CONF_DISPLAY == LCD
  lcd_cgram(CGRAM_STATE, cgram_rec);        /* select record icon */
#else
  LED_ON = 15 - (8 >> ref_state);
  LED_FAST = 1;
  playing = TRUE;
  pause = FALSE;
#endif
}



/*F**************************************************************************
* NAME: print_state_error
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the error icon
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_state_error (void)
{
#if CONF_DISPLAY == LCD
  lcd_cgram(CGRAM_STATE, cgram_error);      /* select error icon */
#else
  if (mem_state == MEM_CHIP_ERR_FMT)
  {
    LED_VOL = 1; LED_TREEB=0;
    Fformat();
    if (mem_select_format() == OK) return;
  }
  LED_ON=15;
  LED_FAST=3;
#endif
}



/*F**************************************************************************
* NAME: print_mode_song
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the song icon on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void print_mode_song (void)
{
#if CONF_DISPLAY == LCD
  lcd_cgram(CGRAM_MODE, cgram_song);        /* select song icon */
#else
  LED_ON = (8 >> ref_state);
  LED_FAST = 3;
#endif
}


/*F**************************************************************************
* NAME: print_mode_voice
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Print the voice icon on the LCD
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------

⌨️ 快捷键说明

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