?? disp_task.c
字號:
/*C**************************************************************************
* NAME: disp_task.c
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE: snd1c-refd-nf-4_0_3
* REVISION: 1.13
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the display task and attached routines
*
* NOTES:
* Global Variables:
* - gl_cpt_tick: global tick counter in data space
* - gl_sbc_wr_busy: SCSI write busy flag set to OFF in this task
* - gl_sbc_rd_busy: SCSI read busy flag set to OFF in thsi task
*****************************************************************************/
/*_____ I N C L U D E S ____________________________________________________*/
#include "config.h" /* system configuration */
#include "board.h" /* board definition */
#include "modules\file\file.h" /* file definition */
#include "modules\display\disp.h" /* display definition */
#include "disp_task.h" /* display task definition */
#ifndef CONF_DISPLAY
#define LCD 0
#define LED 1
#define CONF_DISPLAY LCD
#endif
#if CONF_DISPLAY == LED
#include "modules\display\led.h" /* led definition */
#endif
/*_____ M A C R O S ________________________________________________________*/
#if CONF_DISPLAY == LED
#define REF_STATE_SONG 0
#define REF_STATE_VOICE 1
#define REF_STATE_USB 2
#define REF_STATE_FORMAT 3
#endif
/*_____ D E F I N I T I O N ________________________________________________*/
extern data Byte gl_cpt_tick; /* general tick counter */
extern bdata bit fs_memory; /* selected file system */
extern bit gl_sbc_wr_busy; /* SBC write busy flag */
extern bit gl_sbc_rd_busy; /* SBC read busy flag */
static bdata bit disp_scroll_on; /* set to TRUE to scroll name */
static bdata bit disp_clock_on; /* set to TRUE to start clock */
static data Byte disp_sec_cpt; /* second counter */
static data Byte disp_min_cpt; /* minute counter */
static data char pdata * disp_buffer;
static xdata Byte gl_cpt_tick_save; /* tick counter saved value */
static xdata Byte disp_sec_cpt_save; /* second counter saved value */
static xdata Byte disp_min_cpt_save; /* minute counter saved value */
static data Byte disp_state; /* task state */
#if CONF_DISPLAY == LED
extern xdata Byte func_state;
extern xdata Byte func_timeout; // Time out special function
extern xdata Byte ref_state;
extern bit playing;
extern bit pause;
extern bit recording;
extern bit connected;
extern xdata Byte LED_ON;
extern xdata Byte LED_FAST;
#endif
/*_____ D E C L A R A T I O N ______________________________________________*/
/*F**************************************************************************
* NAME: disp_task_init
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Display task initialization
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_task_init (void)
{
disp_scroll_on = FALSE;
disp_clock_on = FALSE;
disp_state = DISP_IDLE;
print_init();
}
/*F**************************************************************************
* NAME: disp_task
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Display task handling display of clock and scrolling of file name
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_task (void)
{
#if CONF_DISPLAY == LED
led_task();
#endif
switch (disp_state)
{
case DISP_IDLE:
{
#if CONF_DISPLAY != LED
if (gl_sbc_wr_busy || gl_sbc_rd_busy) /* still busy */
{
Lcd_cur_on(); /* blinking cursor for .5 sec */
gl_sbc_wr_busy = FALSE;
gl_sbc_rd_busy = FALSE;
gl_cpt_tick = 0;
disp_state = DISP_MS_BUSY;
}
#endif
break;
}
case DISP_INIT:
{
disp_state = DISP_TICK0;
gl_cpt_tick = 0;
disp_buffer = File_get_name();
if (print_name(disp_buffer) != TRUE) /* test if not short name */
{
disp_scroll_on = TRUE; /* activate name scrolling */
}
else
{
disp_scroll_on = FALSE; /* no scrolling */
}
break;
}
case DISP_TICK0:
{
if (gl_cpt_tick > DISP_TICK_500) /* 1/2 sec expiration */
{
if (disp_scroll_on)
{
if (print_name(disp_buffer))
{
disp_buffer = File_get_name();
}
else
{
disp_buffer++;
}
}
disp_state = DISP_TICK1;
}
break;
}
case DISP_TICK1:
{
if (gl_cpt_tick > DISP_TICK_SEC) /* 1/2 sec expiration */
{
gl_cpt_tick -= DISP_TICK_SEC;
if (disp_scroll_on)
{
if (print_name(disp_buffer))
{
disp_buffer = File_get_name();
}
else
{
disp_buffer++;
}
}
if (disp_clock_on)
{
disp_state = DISP_SEC;
}
else
{
disp_state = DISP_TICK0;
}
}
break;
}
case DISP_SEC:
{
if (disp_sec_cpt == DISP_SEC_MIN) /* 1 min expiration */
{
disp_sec_cpt = 0;
print_sec(disp_sec_cpt);
disp_state = DISP_MIN;
}
else
{
disp_sec_cpt++;
print_sec(disp_sec_cpt);
disp_state = DISP_TICK0;
}
break;
}
case DISP_MIN:
{
disp_min_cpt++;
print_min(disp_min_cpt);
disp_state = DISP_TICK0;
break;
}
case DISP_MS_BUSY:
{
#if CONF_DISPLAY != LED
if (gl_sbc_wr_busy || gl_sbc_rd_busy) /* still busy */
{
gl_sbc_wr_busy = FALSE;
gl_sbc_rd_busy = FALSE;
gl_cpt_tick = 0;
}
else
{
if (gl_cpt_tick > DISP_TICK_500) /* 1/2 sec expiration */
{
Lcd_cur_off();
disp_state = DISP_IDLE;
}
}
#endif
}
}
}
/*F**************************************************************************
* NAME: disp_name_start
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Start name display
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_name_start (void)
{
disp_state = DISP_INIT;
}
#if CONF_DISPLAY == LED
/*F**************************************************************************
* NAME: disp_end_of_play
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Suspend name display
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_end_of_play (void)
{
LED_ON = (8>>ref_state);
LED_FAST = 3;
if (recording)
{
SHUT_MIC = 1;
pause=FALSE;
recording=FALSE;
}
else if (playing && ref_state==REF_STATE_VOICE)
{
func_state=0;
recording=TRUE;
LED_FAST=2;
}
else func_state=0;
playing=FALSE;
disp_state = DISP_IDLE;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -