view src/cs/services/fcbm/fcbm_kpd_if.c @ 266:160a5b3a076c

new ABB_SLEEP_RESTRICTION definition in fc-target.h When we first introduced the mechanism to suppress ABB superdeep sleep on targets with LCDs powered from Iota VRIO, we made it conditional on CONFIG_TARGET_LUNA. This conditional is now being generalized: the feature in question is now conditionalized on the new ABB_SLEEP_RESTRICTION preprocessor symbol, to be defined in targets/*.h for those targets that need it. The new ABB_SLEEP_RESTRICTION definition is being added to targets/luna[12].h to keep the actual logic unchanged.
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 02 Jun 2021 02:12:14 +0000
parents baa738eeb842
children
line wrap: on
line source

/*
 * This module implements the interface to KPD for FCBM.
 */

#include "fcbm/fcbm_env.h"
#include "fcbm/fcbm_func_i.h"
#include "kpd/kpd_api.h"
#include "rv/rv_general.h"
#include "rvf/rvf_api.h"
#include "rvm/rvm_use_id_list.h"

static T_KPD_SUBSCRIBER fcbm_kpd_sub;

T_RV_RET fcbm_subscribe_kpd(void)
{
	T_RV_RET rc;
	T_RV_RETURN return_path;
	T_KPD_VIRTUAL_KEY_TABLE notified_keys;

	return_path.callback_func = 0;
	return_path.addr_id = fcbm_addr_id;

	notified_keys.nb_notified_keys = KPD_NB_PHYSICAL_KEYS;
	notified_keys.notified_keys[0] = KPD_KEY_0;
	notified_keys.notified_keys[1] = KPD_KEY_1;
	notified_keys.notified_keys[2] = KPD_KEY_2;
	notified_keys.notified_keys[3] = KPD_KEY_3;
	notified_keys.notified_keys[4] = KPD_KEY_4;
	notified_keys.notified_keys[5] = KPD_KEY_5;
	notified_keys.notified_keys[6] = KPD_KEY_6;
	notified_keys.notified_keys[7] = KPD_KEY_7;
	notified_keys.notified_keys[8] = KPD_KEY_8;
	notified_keys.notified_keys[9] = KPD_KEY_9;
	notified_keys.notified_keys[10] = KPD_KEY_UP;
	notified_keys.notified_keys[11] = KPD_KEY_DOWN;
	notified_keys.notified_keys[12] = KPD_KEY_SOFT_LEFT;
	notified_keys.notified_keys[13] = KPD_KEY_SOFT_RIGHT;
	notified_keys.notified_keys[14] = KPD_KEY_CONNECT;
	notified_keys.notified_keys[15] = KPD_KEY_DISCONNECT;
	notified_keys.notified_keys[16] = KPD_KEY_STAR;
	notified_keys.notified_keys[17] = KPD_KEY_DIESE;
	notified_keys.notified_keys[18] = KPD_KEY_LEFT;
	notified_keys.notified_keys[19] = KPD_KEY_RIGHT;
	notified_keys.notified_keys[20] = KPD_KEY_ENTER;
	notified_keys.notified_keys[21] = KPD_KEY_VOL_UP;
	notified_keys.notified_keys[22] = KPD_KEY_VOL_DOWN;
	notified_keys.notified_keys[23] = KPD_KEY_RECORD;

	rc = kpd_subscribe(&fcbm_kpd_sub, KPD_DEFAULT_MODE, &notified_keys,
			   return_path);
	if (rc != RV_OK) {
		rvf_send_trace("kpd_subscribe() failed", 22, rc,
				RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
		return rc;
	}

	/* long press and repeat times are dummies copied from MFW */
	rc = kpd_define_key_notification(fcbm_kpd_sub, &notified_keys,
					 KPD_FIRST_PRESS_NOTIF |
					 KPD_RELEASE_NOTIF, 30, 50);
	if (rc != RV_OK)
		rvf_send_trace("kpd_define_key_notification() failed", 36, rc,
				RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
	return rc;
}

T_RV_RET fcbm_unsubscribe_kpd(void)
{
	T_RV_RET rc;

	rc = kpd_unsubscribe(&fcbm_kpd_sub);
	if (rc != RV_OK)
		rvf_send_trace("kpd_unsubscribe() failed", 24, rc,
				RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
	return rc;
}