view src/cs/services/fcbm/fcbm_display_ctrl.c @ 263:b5e8dfd114a7

Switch_ON(): go into charging boot mode on either CHGSTS or CHGPRES If someone were to plug and then unplug a charger into a switched-off phone in an extremely brief "glitch" manner, we should do an automatic power-off on boot in this condition. When we were checking only CHGPRES in Switch_ON(), we would go into Misc boot state instead, which is undesirable. Now if we have a CHGSTS but not CHGPRES condition, we will go into charging boot mode, and FCBM will then do the automatic power-off upon detecting absence of the charger in its periodic polling.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 May 2021 05:50:36 +0000
parents 35474f3a1782
children
line wrap: on
line source

/*
 * In this module we are going to implement our functions
 * for controlling display on/off state during charging boot mode.
 */

#include "rv/rv_general.h"
#include "rvf/rvf_api.h"
#include "rvm/rvm_use_id_list.h"
#include "fcbm/fcbm_func_i.h"
#include "fcbm/fcbm_timer_i.h"
#include "fcbm/fcbm_life_cycle.h"
#include "kpd/kpd_api.h"
#include "r2d/r2d_blrr_api.h"

void fcbm_display_off_timer(void)
{
	if (fcbm_life_cycle_state != FCBM_STATE_ACTIVE) {
		rvf_send_trace("FCBM display off timer in wrong state", 37,
				fcbm_life_cycle_state, RV_TRACE_LEVEL_WARNING,
				FCBM_USE_ID);
		return;
	}
	blrr_display_ctrl(BLRR_DISPLAY_OFF);
}

void fcbm_process_kpd_msg(T_KPD_KEY_EVENT_MSG *msg)
{
	if (fcbm_life_cycle_state != FCBM_STATE_ACTIVE) {
		rvf_send_trace("FCBM keypad message in wrong state", 34,
				fcbm_life_cycle_state, RV_TRACE_LEVEL_WARNING,
				FCBM_USE_ID);
		return;
	}
	switch (msg->key_info.state) {
	case KPD_KEY_PRESSED:
		rvf_stop_timer(FCBM_TIMER_DSPL_OFF);
		blrr_display_ctrl(BLRR_DISPLAY_CHG_BOOT);
		return;
	case KPD_KEY_RELEASED:
		rvf_start_timer(FCBM_TIMER_DSPL_OFF,
				RVF_SECS_TO_TICKS(FCBM_DISPLAY_SECS), FALSE);
		return;
	}
}