📄 disp_task.c
字号:
}
#endif
/*F**************************************************************************
* NAME: disp_name_stop
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Suspend name display
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_name_stop (void)
{
disp_state = DISP_IDLE;
}
/*F**************************************************************************
* NAME: disp_clock_reset
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Reset chrono to 0:00
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_clock_reset (void)
{
#if CONF_DISPLAY == LED
LED_VOL = 0;
LED_BASS = 0;
LED_MED = 0;
LED_TREEB = 0;
#endif
disp_clock_on = FALSE;
disp_sec_cpt = 0;
disp_min_cpt = 0;
print_time(0, 0); /* display 0:00 */
#if CONF_DISPLAY == LCD
disp_state = DISP_INIT; /* reset task */
#endif
}
/*F**************************************************************************
* NAME: disp_clock_start
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Start or re-start clock display
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_clock_start (void)
{
disp_clock_on = TRUE;
}
/*F**************************************************************************
* NAME: disp_clock_stop
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
* Suspend clock display
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_clock_stop (void)
{
disp_clock_on = FALSE;
}
/*F**************************************************************************
* NAME: disp_get_min
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
* minutes
*----------------------------------------------------------------------------
* PURPOSE:
* Return minutes of current time
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Byte disp_get_min (void)
{
return disp_min_cpt;
}
/*F**************************************************************************
* NAME: disp_get_sec
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
* seconds
*----------------------------------------------------------------------------
* PURPOSE:
* Return seconds of current time
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Byte disp_get_sec (void)
{
return disp_sec_cpt;
}
/*F**************************************************************************
* NAME: disp_save_time
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
* seconds
*----------------------------------------------------------------------------
* PURPOSE:
* Save time info in local variables
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_save_time (void)
{
#if CONF_DISPLAY == LCD
gl_cpt_tick_save = gl_cpt_tick;
disp_sec_cpt_save = disp_sec_cpt;
disp_min_cpt_save = disp_min_cpt;
#endif
}
/*F**************************************************************************
* NAME: disp_recall_time
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
* seconds
*----------------------------------------------------------------------------
* PURPOSE:
* Reset time with local variables value
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_recall_time(void)
{
#if CONF_DISPLAY == LCD
gl_cpt_tick = gl_cpt_tick_save;
disp_sec_cpt = disp_sec_cpt_save;
disp_min_cpt = disp_min_cpt_save;
/* Refresh second and minute display */
print_sec(disp_sec_cpt);
print_min(disp_min_cpt);
#endif
}
/*F**************************************************************************
* NAME: disp_inc_time
*----------------------------------------------------------------------------
* PARAMS:
* Byte second
* return:
*
*----------------------------------------------------------------------------
* PURPOSE:
* increase time with second value
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_inc_time(Byte second)
{
#if CONF_DISPLAY == LCD
disp_sec_cpt += second;
if (disp_sec_cpt >= DISP_SEC_MIN) /* 1 min expiration */
{
disp_sec_cpt = disp_sec_cpt - DISP_SEC_MIN;
disp_min_cpt++;
print_min(disp_min_cpt);
}
print_sec(disp_sec_cpt);
#else
disp_sec_cpt += second;
if (disp_sec_cpt >= DISP_SEC_MIN) /* 1 min expiration */
{
disp_sec_cpt = disp_sec_cpt - DISP_SEC_MIN;
disp_min_cpt++;
}
#endif
}
/*F**************************************************************************
* NAME: disp_dec_time
*----------------------------------------------------------------------------
* PARAMS:
* Byte second
* return:
*
*----------------------------------------------------------------------------
* PURPOSE:
* decrease time with second value
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void disp_dec_time(Byte second)
{
#if CONF_DISPLAY == LCD
if (disp_sec_cpt <= second)
{
if (disp_min_cpt == 0)
{
disp_sec_cpt = 0;
print_sec(disp_sec_cpt);
}
else
{
disp_sec_cpt = DISP_SEC_MIN + disp_sec_cpt - second;
disp_min_cpt--;
print_min(disp_min_cpt);
print_sec(disp_sec_cpt);
}
}
else
{
disp_sec_cpt-=second;
print_sec(disp_sec_cpt);
}
#else
if (disp_sec_cpt <= second)
{
if (disp_min_cpt == 0)
{
disp_sec_cpt = 0;
}
else
{
disp_sec_cpt = DISP_SEC_MIN + disp_sec_cpt - second;
disp_min_cpt--;
}
}
else
{
disp_sec_cpt-=second;
}
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -