2017.11.23 display fun --STM8

unsigned char disp_mode;

unsigned char disp_last_mode;

unsigned char disp_sub_mode;

unsigned char disp_set_hour,disp_set_min;

void disp_init(void)

{

unsigned char key_code;

sys_flag.f.dsp=1; //update display

if(key_input()==KEY_PLUS_MINU){

disp_mode=DISP_CONFIG_MODE;

}else{

disp_mode=DISP_DAY_CLK_MODE;

}

disp_last_mode = disp_mode;

disp_sub_mode=0;

}

void disp_func(void)

{

if(key_flag.f.locked==1){

KEY_ON();

}

switch(sys_type){

case SYS_DAY_TYPE:

disp_day_func();

break;

case SYS_WEEK_TYPE:

disp_week_func();

break;

case SYS_TEMP_TYPE:

disp_temp_func();

break;

case SYS_FACTORY_TYPE:

factory_disp_func();

break;

}

}

void disp_config_type(void)

{

digit_Con();

switch(sys_type){

case SYS_DAY_TYPE:

digit_d5(1);

break;

case SYS_WEEK_TYPE:

digit_d5(2);

break;

default:

case SYS_TEMP_TYPE:

digit_d5(3);

break;

}

}

void disp_rtc_func(void)

{

digit_d4_d5(sys_clk_min);

digit_d2_d3(sys_clk_hour);

COL_ON();

}

void disp_on_func(void)

{

disp_func();

}

/*=================================================================================

DISPLAY OFF ROUTINE

=================================================================================*/

void disp_off_func(void)

{

switch(sys_type){

case SYS_DAY_TYPE:

disp_off_day_func();

break;

case SYS_WEEK_TYPE:

disp_off_week_func();

break;

case SYS_TEMP_TYPE:

disp_off_temp_func();

break;

case SYS_FACTORY_TYPE:

factory_disp_off_func();

break;

}

}

void disp_mode_set(unsigned char mode)

{

disp_last_mode = disp_mode;

disp_mode=mode;

disp_sub_mode=0;

sys_flag.f.dsp=1;

key_off_advance_flag();

switch(sys_type){

case SYS_DAY_TYPE:

disp_day_mode_set();

break;

case SYS_WEEK_TYPE:

disp_week_mode_set();

break;

case SYS_TEMP_TYPE:

disp_temp_mode_set();

break;

case SYS_FACTORY_TYPE:

factory_disp_mode_set();

break;

}

}

void disp_sub_mode_set(unsigned char mode)

{

disp_sub_mode=mode;

sys_flag.f.dsp=1;

}

void disp_enter_sleep(void)

{

disp_mode_set(DISP_CLK_MODE);

你可能感兴趣的:(2017.11.23 display fun --STM8)