Ejemplo n.º 1
0
void function_chargingcomplete_event_handler(uint8_t pin_no)
{
#ifdef DEBUG_LOG
    LOG(LEVEL_INFO,"pin_no: [%d]\r\n",pin_no);
#endif
    if(pin_no != CHARGER_CHARGING_PIN) {
        return;
    }

    global_device_charging_state = charger_status();
#ifdef DEBUG_LOG
    LOG(LEVEL_INFO,"global_device_charging_state: [%d]\r\n",global_device_charging_state);
#endif
#ifdef CHARGER_CONNECTED_PIN

    if( global_device_charging_state != NoCharge ) {
    //    charging_flash_battery_start();
    }
#else
    if( global_device_charging_state == NoCharge ) {
        charging_flash_battery_stop();
    } else {
        charging_flash_battery_start();
    }
#endif
}
Ejemplo n.º 2
0
void function_charger_event_handler(uint8_t pin_no)
{
#ifdef DEBUG_LOG
    LOG(LEVEL_INFO,"pin_no: [%d]\r\n",pin_no);
#endif
    if(pin_no != CHARGER_CONNECTED_PIN) {
        return;
    }
    battery_level = 0;
    global_device_charging_state = charger_status();
#ifdef DEBUG_LOG
    LOG(LEVEL_INFO,"global_device_charging_state: [%d]\r\n",global_device_charging_state);
#endif
    if( global_device_charging_state == NoCharge ) {
        if( notification_status() == NOTIFICATION_CHARGING ){
            led_action_stop();
        }
//        charging_flash_battery_stop();
    } else {
        //show voltage
        global_device_charging_state = InCharging;
//        charging_flash_battery_start();
        show_charging_percentage(&global_device_charging_state);
    }
}
Ejemplo n.º 3
0
void charger_framework_init(void)
{
    //Get Init Charging Status
    global_device_charging_state = charger_status();

    //Start Charger Timer ,when Pluged in.
    if( global_device_charging_state != NoCharge ) {
//        charging_flash_battery_start();
        show_charging_percentage(&global_device_charging_state);
    }
#ifdef CHARGER_CONNECTED_PIN
    //Wakeup
    GPIO_WAKEUP_BUTTON_CONFIG(CHARGER_CONNECTED_PIN); //charger wakeup
#endif
}
Ejemplo n.º 4
0
/*
 * call back function to update tboot UI
 */
static void ui_callback(void *arg)
{
	char buf_usb[32];
	char buf_charger[32];
	char buf_bat[32];
	int status;
	static saved_usb_status = STATUS_UNKOWN;
	static saved_charger_status = STATUS_UNKOWN;

	status = usb_status();
	if (status == STATUS_UNKOWN)
		snprintf(buf_usb, sizeof(buf_usb), "USB: Unknow");
	else
		snprintf(buf_usb, sizeof(buf_usb), "USB: %s",
				status == STATUS_CONNECTED ?
				"connected" : "disconnected");
	if (saved_usb_status != status) {
		RESET_ALARM;
		lcd_state = (lcd_state_t)lcd_state(LCD_USB_EVENT);
		saved_usb_status = status;
	}

	status = charger_status();
	if (status == STATUS_UNKOWN)
		snprintf(buf_charger, sizeof(buf_charger), "Charger: Unknow");
	else
		snprintf(buf_charger, sizeof(buf_charger), "Charger: %s",
				status == STATUS_CONNECTED ?
				"connected" : "disconnected");
	if (saved_charger_status != status) {
		RESET_ALARM;
		lcd_state = (lcd_state_t)lcd_state(LCD_USB_EVENT);
		saved_charger_status = status;
	}

	status = battery_capacity();
	if (status < 0)
		snprintf(buf_bat, sizeof(buf_bat), "Battery: Unknow");
	else
		snprintf(buf_bat, sizeof(buf_bat), "Battery: %d%%", status);

	tboot_ui_uevent("%s, %s, %s", buf_usb, buf_charger, buf_bat);
}
Ejemplo n.º 5
0
uint8_t charger_connected(void)
{
    if( charger_status() != NoCharge )
        return 1;
    return 0;
}