Esempio n. 1
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int board_display_show(int display_source)
{
    board_display_layer_para_set();
	board_display_layer_open();

	return 0;
}
Esempio n. 2
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int board_display_show_until_lcd_open(int display_source)
{
    if(!display_source)
    {
    	board_display_wait_lcd_open();
    }
    board_display_layer_para_set();
	board_display_layer_open();

	return 0;
}
Esempio n. 3
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int board_display_show_until_lcd_open(int display_source)
{
		printf("%s\n", __func__);
    if(!display_source)
    {
    	board_display_wait_lcd_open();
    }
    board_display_layer_para_set();
	board_display_layer_open();

	return 0;
}
static int board_standby_status(int source_bat_cal)
{
	int   bat_cal, this_bat_cal;
	int   i, j, status;
	int   one_delay;
	int   ret;

	boot_standby_action = 0;
	this_bat_cal = source_bat_cal;
	tick_printf("base bat_cal = %d\n", this_bat_cal);
	if(this_bat_cal > 95)
	{
		this_bat_cal = 100;
	}
	//启动中断检测
	usb_detect_for_charge(BOOT_USB_DETECT_DELAY_TIME + 200);
	//启动axp检测
	power_limit_detect_enter();
	status = 1;
	goto __start_case_status__;
/******************************************************************
*
*	standby 返回值说明
*
*	   -1: 进入standby失败
*		1: 普通按键唤醒
*		2: 电源按键短按唤醒
*		3: 电源按键长按唤醒
*		4: 外部电源移除唤醒
*		5: 电池充电完成
*		6: 在唤醒状态下外部电源被移除
*		7: 在唤醒状态下充电完成
*
******************************************************************/
	do
	{
		tick_printf("enter standby\n");
		board_display_layer_close();
		power_limit_detect_exit();
		status = board_try_boot_standby();
		tick_printf("exit standby by %d\n", status);

		bat_cal = axp_probe_rest_battery_capacity();
		tick_printf("current bat_cal = %d\n", bat_cal);
		if(bat_cal > this_bat_cal)
		{
			this_bat_cal = bat_cal;
		}
__start_case_status__:
		tick_printf("status = %d\n", status);
		switch(status)
		{
			case 2:		//短按power按键导致唤醒
				//启动中断检测
				boot_standby_action = 0;
				power_limit_detect_enter();
				board_display_layer_open();
			case 1:
				//重新计算动画延时时间
				if(this_bat_cal == 100)
				{
					one_delay = 1000;
				}
				else
				{
					one_delay = 1000/(10 - (this_bat_cal/10));
				}
				//绘制动画
				for(j=0;j<3;j++)
				{
					for(i=this_bat_cal/(100/(SUNXI_BAT_BMP_MAX-1));i<SUNXI_BAT_BMP_MAX;i++)
					{
						battery_charge_cartoon_rate(i);
						if(boot_standby_action & 0x08)		//存在外部电源
						{
							boot_standby_action &= ~0x08;
							j = 0;
						}
						else if(boot_standby_action & 0x02)	//短按
						{
							boot_standby_action &= ~2;
							j = 0;
						}
						else if(boot_standby_action & 0x01) //长按
						{
							battery_charge_cartoon_exit();
							power_limit_detect_exit();

							return 0;
						}
						else if(boot_standby_action & 0x10) //拔掉外部电源,没有外部电源
						{
							status = 10;
							boot_standby_action &= ~0x10;

							goto __start_case_status__;
						}
						__msdelay(one_delay);
					}
				}
				//停止动画,固定显示当前电量
				battery_charge_cartoon_rate(this_bat_cal/(100/(SUNXI_BAT_BMP_MAX-1)));
				for(j=0;j<4;j++)
				{
					if(boot_standby_action & 0x08)		//存在外部电源
					{
						boot_standby_action &= ~0x08;
						j = 0;
					}
					else if(boot_standby_action & 0x10) //拔掉外部电源,没有外部电源
					{
						status = 10;
						boot_standby_action &= ~0x10;

						goto __start_case_status__;
					}
					else if(boot_standby_action & 0x01) //长按
					{
						battery_charge_cartoon_exit();
						power_limit_detect_exit();

						return 0;
					}
					__msdelay(250);
				}
				break;

			case 3:		//长按电源按键之后,关闭电池图标,进入系统
				battery_charge_cartoon_exit();

				return 0;

			case 4:		//当移除外部电源时候,重新显示当前电池图标后,3秒后关机
			case 5:		//当电池充电完成的时候,需要关机
				//启动中断检测
				boot_standby_action = 0;
				power_limit_detect_enter();

				board_display_layer_open();
				battery_charge_cartoon_rate(this_bat_cal/(100/(SUNXI_BAT_BMP_MAX-1)));
			case 6:
			case 7:
				if((status != 4) && (status != 5))
				{
					board_display_layer_open();
					battery_charge_cartoon_rate(this_bat_cal/(100/(SUNXI_BAT_BMP_MAX-1)));
				}
			case 10:
				battery_charge_cartoon_rate(this_bat_cal/(100/(SUNXI_BAT_BMP_MAX-1)));
				__msdelay(500);
				do
				{
					if(!(boot_standby_action & 0x04))
					{
						ret = battery_charge_cartoon_degrade(5);
					}
					else
					{
						status = 1;
						battery_charge_cartoon_reset();

						goto __start_case_status__;
					}
				}
				while(!ret);

				battery_charge_cartoon_exit();

				power_limit_detect_exit();

				return -1;

			case 8:		//standby过程中检测到vbus存在变化
			{
				usb_detect_for_charge(BOOT_USB_DETECT_DELAY_TIME + 200);
			}
			break;

			case 9:		//standby过程中检测到vbus移除,同时存在普通dc
			{
//					power_set_usbpc();
			}
			break;

			default:
				break;
		}
	}
	while(1);
}