annotate src/ui/mfw/ti1_key.c @ 223:740a8e8fc9d7

startup sync logic rework for the new PWON button boot scheme Previously we added logic to the MMI task to hold off PEI init until R2D is running, and then extended that condition to wait for FCHG init too. However, the dependencies of MMI upon R2D and FCHG don't start until mmiInit(), and that call is driven by Switch_ON() code, hence the wait for R2D and FCHG init can be made in that code path instead of the MMI task. Furthermore, with our new way of signaling PWON button boot to MMI, we need a new wait to ensure that the MMI task is up - previously this assurance was provided by the wait for Kp pointers to be set. Solution: revert our previous PEI init hold-off additions to MMI, add a new flag indicating MMI task init done, and put the combined wait for all needed conditions into our new PWON button boot code in power.c.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 27 Apr 2021 06:24:52 +0000
parents 0947a816580c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | PROJECT: MMI-Framework (8417) $Workfile:: ti1_key.c $|
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | $Author:: Es $ CONDAT GmbH $Revision:: 13 $|
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 | CREATED: 28.01.99 $Modtime:: 21.01.00 15:05 $|
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | STATE : code |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 MODULE : TI1_KEY
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 PURPOSE : keyboard driver interface (TI1 VERSION)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 EXPORT :
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 TO DO :
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 History:
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 Sep 18, 2006 REF: OMAPS00094426 - x0039928
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
20 Description: Locosto - KPD Release event would NOT be generated if a key is pressed
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 several times in a short period of time
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 Solution : If the long press timer expires mmi checks the bsp kpd status and accordingly
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 sets long press bit in the key map.
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
25
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #define ENTITY_MFW
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "typedefs.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "vsi.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "custom.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "gsm.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "prim.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include <string.h>
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "mfw_mfw.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "mfw_sys.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #include "mfw_kbd.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #include "gdi.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 #include "kbd.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 #include "drv_key.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #include "ti1_key.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 #include "kpd/kpd_api.h"
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 #define POWER_KEY 25
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 extern void mmiInit(void);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 * Marcus: Issue 811: 05:09/2002:
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 * Moved kbd_map, simkbd_map and config_map to \g23m\Condat\COM\SRC\DRIVER\keypad.c
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /* driver callback */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 static void kbdCb (drv_SignalID_Type *signal_params);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 UBYTE keypad_initialize (void);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id,
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
63 T_KPD_KEY_STATE key_state,
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
64 T_KPD_PRESS_STATE press_state);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 static void (*sig) (char,char) = 0; /* kbd signaling function */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 static char *keyMap = (char *) kbd_map; /* current keyboard mapping */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 T_KPD_SUBSCRIBER subscriber_p; /* keep the subscription indentification value */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 typedef struct
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 U32 msg_id;
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
74 void (*callback_func)(void *);
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
75 U16 src_addr_id;
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
76 U16 dest_addr_id;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 } T_RV_CHECK;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
79 /*
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
80 * New FreeCalypso way of launching "full on" operation: Switch_ON()
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
81 * will call fchs_pwon_button_boot() when the switch-on cause is the
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
82 * PWON button (as opposed to charging or test reset), the latter
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
83 * function will post a different version of the MMI_KEYPAD_IND
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
84 * primitive to MMI task, drvKeyUpDown() will get called as a result
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
85 * of this special MMI_KEYPAD_IND, and the latter function calls
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
86 * mmiInit(). Here we define the special "key code" used in the
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
87 * MMI_KEYPAD_IND primitive to pass this event to the MMI task.
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
88 */
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
89
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
90 #define SPECIAL_KEYCODE_PWON 0x81
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 /* JVJ #1874 - new function to initialize the power key*/
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 | PROJECT : MMI-Framework (8417) MODULE : key_power_init |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 | STATE : code ROUTINE : key_power_init |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 PURPOSE : initialize the power key handler in the TI driver
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 void key_power_init()
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 kbd_Init(kbdCb);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 | STATE : code ROUTINE : keyInit |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 PURPOSE : initialize keyboard driver
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 void keyInit (void (*s)(char,char))
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 sig = s;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 * read keyboard mapping from EEPROM.
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 * if this fails set keyboard mapping with default values.
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 *
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 * EEPROM reading not now !!!
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 keyMap = (char *) kbd_map;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
132 keypad_initialize ();
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 | STATE : code ROUTINE : keyExit |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 PURPOSE : finalize keyboard driver
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 void keyExit (void)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 sig = 0;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
150 //unsubscribe the client from the keypad driver
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 kpd_unsubscribe (&subscriber_p);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 | STATE : code ROUTINE : getKeyIndex |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 PURPOSE : returns the index to the key provided (or -1 if no match)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 char drvGetKeyIndex( char key)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 {
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
165 int i;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 for (i = 0; i < 32; i++)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 if (keyMap[i] == key)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 {
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
171 return (i);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 return (char)(0xFE); //No match./*a0393213 warnings removal - -1 changed to 0xFE*/
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 | STATE : code ROUTINE : drvKeyUpDown |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 PURPOSE : handle key event (called from keyboard)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 void drvKeyUpDown (char upDown, char key)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 TRACE_EVENT_P2("drvKeyUpDown : key = %d : state = %x", key, upDown);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
193 if (key != (char)0)
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
194 {
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
195 if ((key >= 48) && (key <= 57))
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
196 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
197 key -= 47;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
198 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
199 else
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
200 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
201 switch(key)
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
202 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
203 case 35:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
204 key = (char)18;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
205 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
207 case 42:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
208 key = (char)17;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
209 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
211 case 45:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
212 key = (char)11;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
213 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
215 case 67:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
216 key = (char)13;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
217 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
219 case 69:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
220 key = (char)25;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
221 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
223 case 86:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
224 key = (char)16;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
225 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
227 case 94:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
228 key = (char)14;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
229 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
231 case 97:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
232 key = (char)15;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
233 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
235 case 98:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
236 key = (char)12;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
237 break;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
239 /* FreeCalypso new way */
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
240 case SPECIAL_KEYCODE_PWON:
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
241 mmiInit();
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
242 return;
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
243
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
244 default:
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
245 key = (char)0;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
246 break;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
247 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
248 }
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
250 kbd_putMakeAndKey( upDown, key);
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
251 }
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 if (!sig) return; /* no event handler */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 sig((char)(!upDown),0);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 return;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 | STATE : code ROUTINE : mfw_keystroke |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 PURPOSE : handle keystroke primitive (called from aci-pei)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 keystroke sent via 'PEI-CONFIG'-primitive
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 used in Test cases and by RT;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 void mfw_keystroke (char * key)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 char i; //, number; // RAVI
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 if (!sig) return; /* no event handler */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 if (!key) return; /* no valid key */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 // number = 0; // RAVI
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 while (*key)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 if (!strcmp(key,"#*43*1#"))
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 // EF we need to place the key code into the buffer
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 // together with the inverse of the key status, and then call sig
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 kbd_putMakeAndKey(0,19); /* simulate HUP */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 sig(0,0);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 kbd_putMakeAndKey(1,19);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 sig(0,0);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 key += 7;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 continue;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 if (!strcmp(key,"#*43*0#"))
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 kbd_putMakeAndKey(0,18); /* simulate CALL */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 sig(0,0);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 kbd_putMakeAndKey(1,18);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 sig(0,0);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 key += 7;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 continue;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 for (i = 0; i < NUM_KPD_KEYS; i++)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 if (!strncmp(key, config_map[i], strlen(config_map[i])))
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 kbd_putMakeAndKey(0,i); /* add key down event */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 sig(0,0);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 kbd_putMakeAndKey(1,i); /* assume key down event */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 sig(0,0);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 key += strlen(config_map[i]);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 break;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 if (i < NUM_KPD_KEYS)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 continue; /* found config code */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 key++;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 void mfw_keystroke_long (char * key, UBYTE mode) /* long pressed key */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 char i; // , number; // RAVI
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 if (!sig) return; /* no event handler */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 if (!key) return; /* no valid key */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 // number = 0; // RAVI
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 while (strlen(key))
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334 for (i = 0; i < NUM_KPD_KEYS; i++)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 if (!strcmp(key,config_map[i]))
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 if (mode)
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
339 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
340 kbd_putMakeAndKey(0,i); /* assume key down event */
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
341 sig(0,0);
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
342 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
343 else
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
344 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
345 kbd_putMakeAndKey(1,i); /* assume key up event */
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
346 sig(0,0);
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
347 }
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 return;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 return;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 | STATE : code ROUTINE : kbd_callback |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 PURPOSE : Called by keyboard driver
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 #define hCommACI _ENTITY_PREFIXED(hCommACI)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 static void kbdCb (drv_SignalID_Type *signal_params)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369 {
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
370 ULONG signal_raw;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 U16 signal_high;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 U16 signal_low;
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
373 U8 key_code;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
374 U8 key_state;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
376 int nPresses; //Number of key presses still in the queue
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 signal_raw = (ULONG)signal_params->UserData;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 signal_high = (U16) (signal_raw >> 16);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 signal_low = (U16) (signal_raw & 0xFFFF);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
382 key_code = (U8) (signal_low & 0xFF);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383 if (signal_high == 1)
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
384 key_state = KEY_STAT_PRS;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 else
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
386 key_state = KEY_STAT_REL;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
388 //Add keypress to queue of key presses
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
389 nPresses = kbd_getNumElements();
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
391 kbd_putMakeAndKey( (char)key_state, (char)key_code);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
393 if ((!kbd_stillProcessingKeys()) && (nPresses == 0))
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
394 { //Only this element present - create and send message.
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
395 sendKeyInd(key_code, key_state, 0);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
397 }
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
403 | STATE : code ROUTINE : keypad_cb |
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 PURPOSE : This CB function is called by the driver when a key is pressed/released
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407 or a status of an asynch. process is requested.
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411 void keypad_cb (void* parameter)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412 {
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
413 T_KPD_KEY_EVENT_MSG* event;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
414 T_KPD_STATUS_MSG* status;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
415 T_RV_CHECK* check;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
416
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
417 check = (T_RV_CHECK*)parameter;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
419 if (check->msg_id EQ KPD_STATUS_MSG)
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
420 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
421 //status message is used
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
422 status = (T_KPD_STATUS_MSG*) parameter;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
424 if (status->status_value EQ KPD_PROCESS_OK)
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
425 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
426 //ok
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
427 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
428 else
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
429 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
430 //failed !
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
431 return;
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
432 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
433 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
434 else
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
435 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
436 int nPresses; //Number of key presses still in the queue
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
437 //event message is used
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
438 event = (T_KPD_KEY_EVENT_MSG*) parameter;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
439
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
440 //Add keypress to queue of key presses
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
441 nPresses = kbd_getNumElements();
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
442
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
443 if (event->key_info.press_state EQ KPD_INSIGNIFICANT_VALUE)
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
444 {
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
445 kbd_putMakeAndKey( (char)event->key_info.state, (char)event->key_info.virtual_key_id );
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
446 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
447 else
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
448 {
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
449
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
450 //key_ind->key_stat (U8):
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
451 // 00xx 0000 = KEY_PRESSED
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
452 // 00xx 0001 = KEY_RELEASED
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
453 // 0000 00xx = KPD_FIRST_PRESS
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
454 // 0001 00xx = KPD_LONG_PRESS
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
455 // 0010 00xx = KPD_REPEAT_PRESS
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
456 //
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
457 // x = anystate
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
458 kbd_putMakeAndKey( (char)(event->key_info.state | (event->key_info.press_state << 4)),
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
459 (char)event->key_info.virtual_key_id );
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
460 }
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
461
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
462 if ((!kbd_stillProcessingKeys()) && (nPresses == 0))
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
463
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
464 { //Only this element present - create and send message.
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
465
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
466 sendKeyInd(event->key_info.virtual_key_id, event->key_info.state, event->key_info.press_state);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
467
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
468 }
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
469
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
470 }
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
471 return;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
472 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
473
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
474
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
475 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
476 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
478 | STATE : code ROUTINE : keypad_initialize |
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
479 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
480
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
481 PURPOSE : initialize keyboard driver
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
482
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
483 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
484
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
485 UBYTE keypad_initialize (void)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
486 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
487 T_KPD_MODE mode;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
488 T_KPD_VIRTUAL_KEY_TABLE notified_keys;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
489 T_RV_RETURN return_path;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
490 T_RV_RET return_value;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
491
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
492 U16 long_press_time = 30; // 3.0s
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
493 U16 repeat_time = 50; // 5.0s <not used>
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
494
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
495 T_KPD_NOTIF_LEVEL notif_level;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
496 mode = KPD_DEFAULT_MODE;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
497
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
498 return_path.callback_func = keypad_cb;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
499 return_path.addr_id = 0;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
500
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
501 notified_keys.nb_notified_keys = KPD_NB_PHYSICAL_KEYS;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
502
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
503 notified_keys.notified_keys [0] = KPD_KEY_0;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
504 notified_keys.notified_keys [1] = KPD_KEY_1;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
505 notified_keys.notified_keys [2] = KPD_KEY_2;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
506 notified_keys.notified_keys [3] = KPD_KEY_3;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 notified_keys.notified_keys [4] = KPD_KEY_4;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508 notified_keys.notified_keys [5] = KPD_KEY_5;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509 notified_keys.notified_keys [6] = KPD_KEY_6;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510 notified_keys.notified_keys [7] = KPD_KEY_7;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511 notified_keys.notified_keys [8] = KPD_KEY_8;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
512 notified_keys.notified_keys [9] = KPD_KEY_9;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 notified_keys.notified_keys [10] = KPD_KEY_UP;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
514 notified_keys.notified_keys [11] = KPD_KEY_DOWN;
78
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
515 notified_keys.notified_keys [12] = KPD_KEY_SOFT_LEFT;
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
516 notified_keys.notified_keys [13] = KPD_KEY_SOFT_RIGHT;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517 notified_keys.notified_keys [14] = KPD_KEY_CONNECT;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518 notified_keys.notified_keys [15] = KPD_KEY_DISCONNECT;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519 notified_keys.notified_keys [16] = KPD_KEY_STAR;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520 notified_keys.notified_keys [17] = KPD_KEY_DIESE;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521
78
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
522 #if (KPD_NB_PHYSICAL_KEYS > 18)
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
523 notified_keys.notified_keys [18] = KPD_KEY_LEFT;
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
524 notified_keys.notified_keys [19] = KPD_KEY_RIGHT;
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
525 notified_keys.notified_keys [20] = KPD_KEY_ENTER;
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
526 notified_keys.notified_keys [21] = KPD_KEY_VOL_UP;
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
527 notified_keys.notified_keys [22] = KPD_KEY_VOL_DOWN;
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
528 notified_keys.notified_keys [23] = KPD_KEY_RECORD;
c632896652ba mfw/ti1_key.c: properly initialize notified_keys array
Mychaela Falconia <falcon@freecalypso.org>
parents: 77
diff changeset
529 #endif
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531 return_value = kpd_subscribe (&subscriber_p, mode, &notified_keys, return_path);
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533 if (return_value EQ RV_INTERNAL_ERR ||
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534 return_value EQ RV_INVALID_PARAMETER ||
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 return_value EQ RV_MEMORY_ERR)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536 {
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 //failed
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539 //- RV_INTERNAL_ERR if
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
540 // - the max of subscriber is reached,
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541 // - the software entity is not started, not yet initialized or initialization has
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 // failed
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543 //- RV_INVALID_PARAMETER if number of virtual keys is not correct.
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 //- RV_MEMORY_ERR if memory reach its size limit.
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546 return 1;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
547 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
549 //Subscribe to key press and key release (at the moment)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550 //subscribe to KPD_LONG_KEY_PRESS_NOTIF once implemented.
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551 notif_level = KPD_FIRST_PRESS_NOTIF | KPD_RELEASE_NOTIF;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
552
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553 return_value = kpd_define_key_notification( subscriber_p, &notified_keys, notif_level,
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554 long_press_time, repeat_time );
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556 if (return_value EQ RV_INVALID_PARAMETER ||
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 return_value EQ RV_MEMORY_ERR)
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
558 { //failed
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559 return 1;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
560 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 return 0;
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562 }
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565 /*
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
566 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 | PROJECT : MMI-Framework (8417) MODULE : ti1_key |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
568 | STATE : code ROUTINE : sendKeyInd |
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569 +--------------------------------------------------------------------+
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571 PURPOSE : Sends an MMI_KEYPAD_IND to the protocol stack
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572 */
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573 void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id,
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
574 T_KPD_KEY_STATE key_state,
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
575 T_KPD_PRESS_STATE press_state)
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
576 {
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
577 EXTERN T_HANDLE hCommACI;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
578
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
579 PALLOC(key_ind,MMI_KEYPAD_IND);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
580
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
581 key_ind->key_code = (U8)0;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
582
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
583 key_ind->key_stat = 0;
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
584
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
585 PSENDX(ACI,key_ind);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
586
77
a7e383456c01 mfw/ti1_key.c: white space fixes
Mychaela Falconia <falcon@freecalypso.org>
parents: 3
diff changeset
587 return;
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
588 }
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
589
213
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
590 /* new FreeCalypso functions for switch-on causes */
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
591
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
592 void fchs_pwon_button_boot(void)
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
593 {
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
594 EXTERN T_HANDLE hCommACI;
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
595
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
596 PALLOC(key_ind,MMI_KEYPAD_IND);
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
597
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
598 key_ind->key_code = SPECIAL_KEYCODE_PWON;
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
599
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
600 key_ind->key_stat = 0;
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
601
0947a816580c first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents: 78
diff changeset
602 PSENDX(ACI,key_ind);
3
67bfe9f274f6 src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
603 }