FreeCalypso > hg > fc-tourmaline
comparison src/ui/mfw/mfw_kbd.c @ 79:e5e2af0ca91c
mfw_kbd.c: white space fixes
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Oct 2020 01:57:56 +0000 |
parents | 67bfe9f274f6 |
children | 7160f0d005d2 |
comparison
equal
deleted
inserted
replaced
78:c632896652ba | 79:e5e2af0ca91c |
---|---|
14 | 14 |
15 TO DO : adjust PEI/driver interface | 15 TO DO : adjust PEI/driver interface |
16 | 16 |
17 HISTORY : | 17 HISTORY : |
18 | 18 |
19 Sep 14, 2007 REF: OMAPS00145862 Adrian Salido | 19 Sep 14, 2007 REF: OMAPS00145862 Adrian Salido |
20 Description: FT - MMI: Wrong trace class | 20 Description: FT - MMI: Wrong trace class |
21 Solution: changed some event traces to function traces because the information content of | 21 Solution: changed some event traces to function traces because the information content of |
22 this is low for non-MMI people and against TI coding convention. | 22 this is low for non-MMI people and against TI coding convention. |
23 | 23 |
24 Oct 13, 2006 REF: OMAPS00097121 - x0039928 | 24 Oct 13, 2006 REF: OMAPS00097121 - x0039928 |
25 Description: Keyboard pressed in a loop. KBP_R after suspend-resume | 25 Description: Keyboard pressed in a loop. KBP_R after suspend-resume |
26 Solution : If the Auto press timer expires mmi checks the bsp kpd status and accordingly | 26 Solution : If the Auto press timer expires mmi checks the bsp kpd status and accordingly |
27 sets auto key in the key map. | 27 sets auto key in the key map. |
28 | 28 |
29 Sep 18, 2006 REF: OMAPS00094426 - x0039928 | 29 Sep 18, 2006 REF: OMAPS00094426 - x0039928 |
30 Description: Locosto - KPD Release event would NOT be generated if a key is pressed | 30 Description: Locosto - KPD Release event would NOT be generated if a key is pressed |
31 several times in a short period of time | 31 several times in a short period of time |
32 Solution : If the long press timer expires mmi checks the bsp kpd status and accordingly | 32 Solution : If the long press timer expires mmi checks the bsp kpd status and accordingly |
33 sets long press bit in the key map. | 33 sets long press bit in the key map. |
34 | 34 |
35 xrashmic 22 Aug, 2004 MMI-SPR-32798 | 35 xrashmic 22 Aug, 2004 MMI-SPR-32798 |
99 | 99 |
100 /* | 100 /* |
101 ** KeyPress Buffer Macros and Limits | 101 ** KeyPress Buffer Macros and Limits |
102 */ | 102 */ |
103 // Apr 03, 2005 REF: CRR 29988 - xpradipg | 103 // Apr 03, 2005 REF: CRR 29988 - xpradipg |
104 // Keyboard buffer reduced from 50 to 20 | 104 // Keyboard buffer reduced from 50 to 20 |
105 #ifdef FF_MMI_REDUCED_KBD_BUFFER | 105 #ifdef FF_MMI_REDUCED_KBD_BUFFER |
106 #define MAX_KPRESS_BFR 20 | 106 #define MAX_KPRESS_BFR 20 |
107 #else | 107 #else |
108 #define MAX_KPRESS_BFR 50 | 108 #define MAX_KPRESS_BFR 50 |
109 #endif | 109 #endif |
110 typedef struct keyPressDetailsTag { | 110 typedef struct keyPressDetailsTag { |
111 char make; | 111 char make; |
112 char key; | 112 char key; |
113 } keyPressDetails; | 113 } keyPressDetails; |
114 | 114 |
115 // Sep 18, 2006 REF: OMAPS00094426 - x0039928 | 115 // Sep 18, 2006 REF: OMAPS00094426 - x0039928 |
116 #if(BOARD == 71) | 116 #if(BOARD == 71) |
117 UBYTE kpd_key; | 117 UBYTE kpd_key; |
119 | 119 |
120 static keyPressDetails keyPressBfr[MAX_KPRESS_BFR]; | 120 static keyPressDetails keyPressBfr[MAX_KPRESS_BFR]; |
121 static SHORT mfw_kbd_kpress_buf_id; | 121 static SHORT mfw_kbd_kpress_buf_id; |
122 | 122 |
123 extern void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id, | 123 extern void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id, |
124 T_KPD_KEY_STATE key_state, | 124 T_KPD_KEY_STATE key_state, |
125 T_KPD_PRESS_STATE press_state); | 125 T_KPD_PRESS_STATE press_state); |
126 extern char drvGetKeyIndex( char key); | 126 extern char drvGetKeyIndex( char key); |
127 | 127 |
128 /* | 128 /* |
129 +--------------------------------------------------------------------+ | 129 +--------------------------------------------------------------------+ |
130 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | | 130 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | |
156 | 156 |
157 mfwCommand[MfwTypKbd] = (MfwCb) kbdCommand; | 157 mfwCommand[MfwTypKbd] = (MfwCb) kbdCommand; |
158 doAlways = 0; | 158 doAlways = 0; |
159 | 159 |
160 mfw_kbd_kpress_buf_id = mfw_cbuf_create(MAX_KPRESS_BFR, | 160 mfw_kbd_kpress_buf_id = mfw_cbuf_create(MAX_KPRESS_BFR, |
161 sizeof(keyPressDetails), | 161 sizeof(keyPressDetails), |
162 FALSE, | 162 FALSE, |
163 0xFF, | 163 0xFF, |
164 TRUE, | 164 TRUE, |
165 keyPressBfr); | 165 keyPressBfr); |
166 | 166 |
167 if (mfw_kbd_kpress_buf_id < 0) | 167 if (mfw_kbd_kpress_buf_id < 0) |
168 TRACE_EVENT_P1("ERROR : mfw_cbuf_create failed with error value %d", mfw_kbd_kpress_buf_id); | 168 TRACE_EVENT_P1("ERROR : mfw_cbuf_create failed with error value %d", mfw_kbd_kpress_buf_id); |
169 | 169 |
170 return MfwResOk; | 170 return MfwResOk; |
171 } | 171 } |
172 | 172 |
173 | 173 |
203 MfwCb kbdAlways (MfwCb f) | 203 MfwCb kbdAlways (MfwCb f) |
204 { | 204 { |
205 MfwCb always = doAlways; | 205 MfwCb always = doAlways; |
206 | 206 |
207 doAlways = f; | 207 doAlways = f; |
208 if (!f) | 208 if (!f) |
209 { | 209 { |
210 timStop(&timLongH); | 210 timStop(&timLongH); |
211 timStop(&timAutoH); | 211 timStop(&timAutoH); |
212 } | 212 } |
213 | 213 |
214 return always; | 214 return always; |
215 } | 215 } |
216 | 216 |
217 | 217 |
246 | 246 |
247 MfwHnd kbdCreate (MfwHnd w, MfwEvt e, MfwCb f) | 247 MfwHnd kbdCreate (MfwHnd w, MfwEvt e, MfwCb f) |
248 { | 248 { |
249 MfwHdr *hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr)); | 249 MfwHdr *hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr)); |
250 MfwKbd *kbd = (MfwKbd *) mfwAlloc(sizeof(MfwKbd)); | 250 MfwKbd *kbd = (MfwKbd *) mfwAlloc(sizeof(MfwKbd)); |
251 MfwHdr *insert_status =0; | 251 MfwHdr *insert_status =0; |
252 | 252 |
253 if (!hdr || !kbd) | 253 if (!hdr || !kbd) |
254 { | 254 { |
255 TRACE_ERROR("ERROR: kbdCreate() Mem Alloc Failed."); | 255 TRACE_ERROR("ERROR: kbdCreate() Mem Alloc Failed."); |
256 | 256 |
257 if(hdr) | 257 if(hdr) |
258 mfwFree((U8*)hdr,sizeof(MfwHdr)); | 258 mfwFree((U8*)hdr,sizeof(MfwHdr)); |
259 if(kbd) | 259 if(kbd) |
260 mfwFree((U8*)kbd,sizeof(MfwKbd)); | 260 mfwFree((U8*)kbd,sizeof(MfwKbd)); |
261 return 0; | 261 return 0; |
262 } | 262 } |
263 | 263 |
264 kbd->map = e; | 264 kbd->map = e; |
265 kbd->key = 0; | 265 kbd->key = 0; |
266 kbd->handler = f; | 266 kbd->handler = f; |
267 | 267 |
268 hdr->data = kbd; | 268 hdr->data = kbd; |
269 hdr->type = MfwTypKbd; | 269 hdr->type = MfwTypKbd; |
270 | 270 |
271 insert_status = mfwInsert(w,hdr); | 271 insert_status = mfwInsert(w,hdr); |
272 | 272 |
273 if(!insert_status) | 273 if(!insert_status) |
274 { | 274 { |
275 TRACE_ERROR("ERROR: kbdCreate() Failed to Install Handler. "); | 275 TRACE_ERROR("ERROR: kbdCreate() Failed to Install Handler. "); |
276 mfwFree((U8*)hdr,sizeof(MfwHdr)); | 276 mfwFree((U8*)hdr,sizeof(MfwHdr)); |
277 mfwFree((U8*)kbd ,sizeof(MfwKbd)); | 277 mfwFree((U8*)kbd ,sizeof(MfwKbd)); |
278 return 0; | 278 return 0; |
279 } | 279 } |
280 return insert_status; | 280 return insert_status; |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 /* | 284 /* |
422 if (!h) | 422 if (!h) |
423 h = mfwRoot; | 423 h = mfwRoot; |
424 while (h) | 424 while (h) |
425 { | 425 { |
426 res = sigExec(h,map,key); /* Warning correction - x0020906 - 14-08-2006*/ | 426 res = sigExec(h,map,key); /* Warning correction - x0020906 - 14-08-2006*/ |
427 if (res) | 427 if (res) |
428 break; | 428 break; |
429 if (h == mfwRoot) | 429 if (h == mfwRoot) |
430 break; | 430 break; |
431 h = mfwParent(mfwParent(h)); | 431 h = mfwParent(mfwParent(h)); |
432 if (h) | 432 if (h) |
452 PURPOSE : keyboard event (called by driver/PEI) | 452 PURPOSE : keyboard event (called by driver/PEI) |
453 | 453 |
454 */ | 454 */ |
455 | 455 |
456 #define MAX_CONSEC_KEYS 6 // Maximum number of keys which can be processed before | 456 #define MAX_CONSEC_KEYS 6 // Maximum number of keys which can be processed before |
457 // allowing the protocol stack processing time | 457 // allowing the protocol stack processing time |
458 //xrashmic 22 Aug, 2004 MMI-SPR-32798 | 458 //xrashmic 22 Aug, 2004 MMI-SPR-32798 |
459 #ifdef MMI_EM_ENABLED | 459 #ifdef MMI_EM_ENABLED |
460 #ifndef NEPTUNE_BOARD | 460 #ifndef NEPTUNE_BOARD |
461 /* This is not valid for Neptune Engineering Mode, hence*/ | 461 /* This is not valid for Neptune Engineering Mode, hence*/ |
462 extern U8 screenCaptureKey; | 462 extern U8 screenCaptureKey; |
463 void screen_capture(void); | 463 void screen_capture(void); |
464 #endif /* ifndef NEPTUNE_BOARD */ | 464 #endif /* ifndef NEPTUNE_BOARD */ |
465 #endif | 465 #endif |
466 | 466 |
467 void kbdSignal (char make, char key) | 467 void kbdSignal (char make, char key) |
468 { | 468 { |
469 U32 map; | 469 U32 map; |
470 UBYTE temp=0 ; | 470 UBYTE temp=0 ; |
471 USHORT numElem; | 471 USHORT numElem; |
472 | 472 |
473 int loopNo; | 473 int loopNo; |
474 int keyNo; | 474 int keyNo; |
475 | 475 |
476 | 476 |
477 if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) || | 477 if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) || |
478 (kbd_processKeyInput()== QUEUE_N_KEYS)) | 478 (kbd_processKeyInput()== QUEUE_N_KEYS)) |
479 temp = dspl_Enable(0); | 479 temp = dspl_Enable(0); |
480 | 480 |
481 mme_backlightEvent(BL_KEY_PRESS); | 481 mme_backlightEvent(BL_KEY_PRESS); |
482 | 482 |
483 loopNo = 0; | 483 loopNo = 0; |
484 keyNo = 0; | 484 keyNo = 0; |
485 | 485 |
486 while (kbd_getMakeAndKey(&make,&key) != -1) | 486 while (kbd_getMakeAndKey(&make,&key) != -1) |
487 { | 487 { |
488 #ifdef MMI_EM_ENABLED | 488 #ifdef MMI_EM_ENABLED |
489 #ifndef NEPTUNE_BOARD | 489 #ifndef NEPTUNE_BOARD |
490 /* This is not valid for Neptune Engineering Mode, hence*/ | 490 /* This is not valid for Neptune Engineering Mode, hence*/ |
491 | 491 |
492 //xrashmic 22 Aug, 2004 MMI-SPR-32798 | 492 //xrashmic 22 Aug, 2004 MMI-SPR-32798 |
493 //If screen capture is enabled the key pressed is the screen capture key, | 493 //If screen capture is enabled the key pressed is the screen capture key, |
494 //we write the LCD buffer into the FFS and and consume the key | 494 //we write the LCD buffer into the FFS and and consume the key |
495 //event here itself without sending it to BMI | 495 //event here itself without sending it to BMI |
496 // Also the screen capture key will be disabled here | 496 // Also the screen capture key will be disabled here |
497 if(key== screenCaptureKey && make==1) | 497 if(key== screenCaptureKey && make==1) |
498 { | 498 { |
499 TRACE_EVENT("*****Capturing the screen"); | 499 TRACE_EVENT("*****Capturing the screen"); |
503 return; | 503 return; |
504 } | 504 } |
505 #endif /* ifndef NEPTUNE_BOARD*/ | 505 #endif /* ifndef NEPTUNE_BOARD*/ |
506 #endif | 506 #endif |
507 | 507 |
508 still_processing_flag = 1; | 508 still_processing_flag = 1; |
509 TRACE_EVENT_P2("NDH : KbdSignal - key %d, state %02x", key, make); | 509 TRACE_EVENT_P2("NDH : KbdSignal - key %d, state %02x", key, make); |
510 | 510 |
511 if (key <= KCD_MAX) /*a0393213 compiler warnings removal - comparison of key with 0 removed*/ | 511 if (key <= KCD_MAX) /*a0393213 compiler warnings removal - comparison of key with 0 removed*/ |
512 { | 512 { |
513 loopNo++; | 513 loopNo++; |
514 keyNo++; | 514 keyNo++; |
515 | 515 |
516 map = 1L << key; | 516 map = 1L << key; |
517 | 517 |
518 if (make) | 518 if (make) |
519 { | 519 { |
520 map |= KEY_MAKE; | 520 map |= KEY_MAKE; |
521 curMap = map; | 521 curMap = map; |
522 curKey = key; | 522 curKey = key; |
523 timStart(&timLongH); | 523 timStart(&timLongH); |
524 timAuto.time = valAuto; | 524 timAuto.time = valAuto; |
525 | 525 |
526 /*NM, p007a*/ | 526 /*NM, p007a*/ |
527 if (valAuto) | 527 if (valAuto) |
528 timStart(&timAutoH); | 528 timStart(&timAutoH); |
529 /*NM, p007a end*/ | 529 /*NM, p007a end*/ |
530 | 530 |
531 } | 531 } |
532 else | 532 else |
533 { | 533 { |
534 map &= ~KEY_MAKE; | 534 map &= ~KEY_MAKE; |
535 curMap = map; //ES!! | 535 curMap = map; //ES!! |
536 curKey = key; //ES!! | 536 curKey = key; //ES!! |
537 timStop(&timLongH); | 537 timStop(&timLongH); |
538 | 538 |
539 if (valAuto) | 539 if (valAuto) |
540 timStop(&timAutoH); | 540 timStop(&timAutoH); |
541 } | 541 } |
542 | 542 |
543 //Select when we update the display | 543 //Select when we update the display |
544 switch (kbd_processKeyInput()) | 544 switch (kbd_processKeyInput()) |
545 { | 545 { |
546 case QUEUE_EVERY_KEY: | 546 case QUEUE_EVERY_KEY: |
547 sigDistribute(map,key); | 547 sigDistribute(map,key); |
548 break; | 548 break; |
549 | 549 |
550 case PROCESS_EVERY_KEY: | 550 case PROCESS_EVERY_KEY: |
551 temp = dspl_Enable(0); | 551 temp = dspl_Enable(0); |
552 sigDistribute(map,key); | 552 sigDistribute(map,key); |
553 dspl_Enable(temp); | 553 dspl_Enable(temp); |
554 break; | 554 break; |
555 | 555 |
556 case QUEUE_N_KEYS: | 556 case QUEUE_N_KEYS: |
557 if ((loopNo %(NUM_QUEUE_KEYS*2))==0) | 557 if ((loopNo %(NUM_QUEUE_KEYS*2))==0) |
558 { | 558 { |
559 kbd_setDisplayUpdateNeeded(1); | 559 kbd_setDisplayUpdateNeeded(1); |
560 sigDistribute(map,key); | 560 sigDistribute(map,key); |
561 dspl_Enable(temp); | 561 dspl_Enable(temp); |
562 temp = dspl_Enable(0); | 562 temp = dspl_Enable(0); |
563 kbd_setDisplayUpdateNeeded(0); | 563 kbd_setDisplayUpdateNeeded(0); |
564 } | 564 } |
565 else | 565 else |
566 sigDistribute(map,key); | 566 sigDistribute(map,key); |
567 break; | 567 break; |
568 } | 568 } |
569 } | 569 } |
570 | 570 |
571 if (keyNo == MAX_CONSEC_KEYS) | 571 if (keyNo == MAX_CONSEC_KEYS) |
572 { | 572 { |
573 still_processing_flag = FALSE; | 573 still_processing_flag = FALSE; |
574 break; | 574 break; |
575 } | 575 } |
576 | 576 |
577 still_processing_flag = FALSE; | 577 still_processing_flag = FALSE; |
578 } | 578 } |
579 | 579 |
580 numElem = mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id); | 580 numElem = mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id); |
581 | 581 |
582 /* x0083025 on Sep 14, 2007 for OMAPS00145862 (adrian) */ | 582 /* x0083025 on Sep 14, 2007 for OMAPS00145862 (adrian) */ |
583 MMI_TRACE_EVENT_P2("NDH >>> Kbd :- There are %d elements in the buffer (id : %d)" , | 583 MMI_TRACE_EVENT_P2("NDH >>> Kbd :- There are %d elements in the buffer (id : %d)" , |
584 numElem, mfw_kbd_kpress_buf_id); | 584 numElem, mfw_kbd_kpress_buf_id); |
585 | 585 |
586 if ((keyNo == MAX_CONSEC_KEYS) && (numElem > 0)) | 586 if ((keyNo == MAX_CONSEC_KEYS) && (numElem > 0)) |
587 { | 587 { |
588 sendKeyInd(0, 0, 0); // dummy values to trigger another keypress_ind | 588 sendKeyInd(0, 0, 0); // dummy values to trigger another keypress_ind |
589 /* | 589 /* |
590 ** This delay is required to slow down the BMI when no trace is being output in order | 590 ** This delay is required to slow down the BMI when no trace is being output in order |
591 ** to permit the Protocol Stack & other tasks to function correctly | 591 ** to permit the Protocol Stack & other tasks to function correctly |
592 */ | 592 */ |
593 vsi_t_sleep (VSI_CALLER 30); | 593 vsi_t_sleep (VSI_CALLER 30); |
594 } | 594 } |
595 | 595 |
596 if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) || | 596 if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) || |
597 (kbd_processKeyInput()== QUEUE_N_KEYS)) | 597 (kbd_processKeyInput()== QUEUE_N_KEYS)) |
598 dspl_Enable(temp); | 598 dspl_Enable(temp); |
599 | 599 |
600 return; | 600 return; |
601 } | 601 } |
602 | 602 |
603 | 603 |
604 /* | 604 /* |
605 +--------------------------------------------------------------------+ | 605 +--------------------------------------------------------------------+ |
611 | 611 |
612 */ | 612 */ |
613 static int toLong (U32 t, void *h) | 613 static int toLong (U32 t, void *h) |
614 { | 614 { |
615 // Sep 18, 2006 REF: OMAPS00094426 - x0039928 | 615 // Sep 18, 2006 REF: OMAPS00094426 - x0039928 |
616 // Fix: On long key press timer expiry bsp kpd status is checked to see if the state is | 616 // Fix: On long key press timer expiry bsp kpd status is checked to see if the state is |
617 // in in Kpd pressed state and sets the long key bit. | 617 // in in Kpd pressed state and sets the long key bit. |
618 #if(BOARD == 71) | 618 #if(BOARD == 71) |
619 UBYTE state; | 619 UBYTE state; |
620 kpd_retrieve_key_status(kpd_key, KPD_DEFAULT_MODE, &state); | 620 kpd_retrieve_key_status(kpd_key, KPD_DEFAULT_MODE, &state); |
621 if(!state) | 621 if(!state) |
622 #endif | 622 #endif |
623 curMap |= KEY_LONG; | 623 curMap |= KEY_LONG; |
624 sigDistribute(curMap,curKey); | 624 sigDistribute(curMap,curKey); |
625 | 625 |
626 return 0; | 626 return 0; |
627 } | 627 } |
628 | 628 |
641 { | 641 { |
642 #if(BOARD == 71) | 642 #if(BOARD == 71) |
643 UBYTE state; | 643 UBYTE state; |
644 kpd_retrieve_key_status(kpd_key, KPD_DEFAULT_MODE, &state); | 644 kpd_retrieve_key_status(kpd_key, KPD_DEFAULT_MODE, &state); |
645 if(!state) | 645 if(!state) |
646 { | 646 { |
647 #endif | 647 #endif |
648 curMap |= KEY_AUTO; | 648 curMap |= KEY_AUTO; |
649 sigDistribute(curMap,curKey); | 649 sigDistribute(curMap,curKey); |
650 | 650 |
651 timAuto.time = valRepeat; | 651 timAuto.time = valRepeat; |
652 /* NM p007c*/ | 652 /* NM p007c*/ |
653 if (valRepeat) | 653 if (valRepeat) |
654 timStart(&timAutoH); | 654 timStart(&timAutoH); |
655 /* NM p007c end*/ | 655 /* NM p007c end*/ |
656 #if(BOARD == 71) | 656 #if(BOARD == 71) |
657 } | 657 } |
658 #endif | 658 #endif |
659 return 0; | 659 return 0; |
660 } | 660 } |
661 | 661 |
662 | 662 |
663 /* | 663 /* |
697 | 697 |
698 */ | 698 */ |
699 | 699 |
700 int kbd_putMakeAndKey( char make, char key) | 700 int kbd_putMakeAndKey( char make, char key) |
701 { | 701 { |
702 keyPressDetails localKP; | 702 keyPressDetails localKP; |
703 SHORT retVal; | 703 SHORT retVal; |
704 | 704 |
705 localKP.make = make; | 705 localKP.make = make; |
706 localKP.key = key; | 706 localKP.key = key; |
707 | 707 |
708 retVal = mfw_cbuf_put(mfw_kbd_kpress_buf_id, &localKP); | 708 retVal = mfw_cbuf_put(mfw_kbd_kpress_buf_id, &localKP); |
709 | 709 |
710 if (retVal < 0) | 710 if (retVal < 0) |
711 TRACE_EVENT_P1("ERROR : mfw_cbuf_put failed with error value %d", retVal); | 711 TRACE_EVENT_P1("ERROR : mfw_cbuf_put failed with error value %d", retVal); |
712 | 712 |
713 return (retVal); | 713 return (retVal); |
714 } | 714 } |
715 | 715 |
716 /* | 716 /* |
717 +--------------------------------------------------------------------+ | 717 +--------------------------------------------------------------------+ |
718 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | | 718 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | |
719 | STATE : code ROUTINE : kbd_getMakeAndKey | | 719 | STATE : code ROUTINE : kbd_getMakeAndKey | |
720 +--------------------------------------------------------------------+ | 720 +--------------------------------------------------------------------+ |
721 | 721 |
722 PURPOSE : reads 'make' (key up/down) and key index into a queue | 722 PURPOSE : reads 'make' (key up/down) and key index into a queue |
723 Return +ve number - keys left in buffer | 723 Return +ve number - keys left in buffer |
724 0 - no keys left - last key press returned | 724 0 - no keys left - last key press returned |
725 -1 - no keys and none in buffer | 725 -1 - no keys and none in buffer |
726 */ | 726 */ |
727 | 727 |
728 int kbd_getMakeAndKey( char* make, char* key) | 728 int kbd_getMakeAndKey( char* make, char* key) |
729 { | 729 { |
730 keyPressDetails localKP; | 730 keyPressDetails localKP; |
731 SHORT retVal; | 731 SHORT retVal; |
732 | 732 |
733 retVal = mfw_cbuf_get(mfw_kbd_kpress_buf_id, &localKP); | 733 retVal = mfw_cbuf_get(mfw_kbd_kpress_buf_id, &localKP); |
734 | 734 |
735 if (retVal < 0) | 735 if (retVal < 0) |
736 { | 736 { |
737 *key = 0x7F; | 737 *key = 0x7F; |
738 *make = 0; | 738 *make = 0; |
739 return (-1); | 739 return (-1); |
740 } | 740 } |
741 | 741 |
742 *make = !(localKP.make); | 742 *make = !(localKP.make); |
743 *key = drvGetKeyIndex(localKP.key); | 743 *key = drvGetKeyIndex(localKP.key); |
744 return (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id)); | 744 return (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id)); |
745 } | 745 } |
746 | 746 |
747 /* | 747 /* |
748 +--------------------------------------------------------------------+ | 748 +--------------------------------------------------------------------+ |
749 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | | 749 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | |
753 PURPOSE : returns number of elements in queue | 753 PURPOSE : returns number of elements in queue |
754 | 754 |
755 */ | 755 */ |
756 int kbd_getNumElements(void) | 756 int kbd_getNumElements(void) |
757 { | 757 { |
758 return ((int)mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id)); | 758 return ((int)mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id)); |
759 } | 759 } |
760 | 760 |
761 int kbd_stillProcessingKeys(void) | 761 int kbd_stillProcessingKeys(void) |
762 { | 762 { |
763 return (still_processing_flag); | 763 return (still_processing_flag); |
764 } | 764 } |
765 | 765 |
766 int mfwKey_skipDisplay( void ) | 766 int mfwKey_skipDisplay( void ) |
767 { | 767 { |
768 if ((mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 2) && (still_processing_flag == 1)) | 768 if ((mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 2) && (still_processing_flag == 1)) |
769 return (TRUE); | 769 return (TRUE); |
770 else | 770 else |
771 return (FALSE); | 771 return (FALSE); |
772 } | 772 } |
773 | 773 |
774 /* | 774 /* |
775 +--------------------------------------------------------------------+ | 775 +--------------------------------------------------------------------+ |
776 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | | 776 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | |
780 PURPOSE : returns TRUE if we need to update the display | 780 PURPOSE : returns TRUE if we need to update the display |
781 | 781 |
782 */ | 782 */ |
783 int displayUpdateNeeded; //used for output every 'n' key presses | 783 int displayUpdateNeeded; //used for output every 'n' key presses |
784 int kbd_displayUpdateNeeded(void) | 784 int kbd_displayUpdateNeeded(void) |
785 { | 785 { |
786 if (kbd_processKeyInput()==PROCESS_EVERY_KEY) | 786 if (kbd_processKeyInput()==PROCESS_EVERY_KEY) |
787 return (TRUE);//Processing each key press - always update screen | 787 return (TRUE);//Processing each key press - always update screen |
788 else if (displayUpdateNeeded==0) | 788 else if (displayUpdateNeeded==0) |
789 return (TRUE);//need to update the display (1 in 6 output) | 789 return (TRUE);//need to update the display (1 in 6 output) |
790 else if (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 1) | 790 else if (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 1) |
791 return (FALSE);//keys in queue - do not update | 791 return (FALSE);//keys in queue - do not update |
792 else | 792 else |
793 return (TRUE);//only 1 key up/down in queue - update display | 793 return (TRUE);//only 1 key up/down in queue - update display |
794 } | 794 } |
795 /* | 795 /* |
796 +--------------------------------------------------------------------+ | 796 +--------------------------------------------------------------------+ |
797 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | | 797 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | |
798 | STATE : code ROUTINE : kbd_setDisplayUpdateNeeded | | 798 | STATE : code ROUTINE : kbd_setDisplayUpdateNeeded | |
801 PURPOSE : sets/clears the flag indicating we need to update the display | 801 PURPOSE : sets/clears the flag indicating we need to update the display |
802 | 802 |
803 */ | 803 */ |
804 void kbd_setDisplayUpdateNeeded(int set) | 804 void kbd_setDisplayUpdateNeeded(int set) |
805 { | 805 { |
806 displayUpdateNeeded = set; | 806 displayUpdateNeeded = set; |
807 } | 807 } |
808 | 808 |
809 /* | 809 /* |
810 +--------------------------------------------------------------------+ | 810 +--------------------------------------------------------------------+ |
811 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | | 811 | PROJECT : MMI-Framework (8417) MODULE : MFW_KBD | |
812 | STATE : code ROUTINE : kbd_processEveryKeyInput | | 812 | STATE : code ROUTINE : kbd_processEveryKeyInput | |
813 +--------------------------------------------------------------------+ | 813 +--------------------------------------------------------------------+ |
814 | 814 |
815 PURPOSE : indicates if the software should process each keypad input individually | 815 PURPOSE : indicates if the software should process each keypad input individually |
816 (TRUE) or if it should process keypad inputs one at a time (FALSE) | 816 (TRUE) or if it should process keypad inputs one at a time (FALSE) |
817 | 817 |
818 */ | 818 */ |
819 int kbd_processKeyInput(void) | 819 int kbd_processKeyInput(void) |
820 { | 820 { |
821 return (QUEUE_EVERY_KEY);//We buffer multiple key inputs | 821 return (QUEUE_EVERY_KEY);//We buffer multiple key inputs |
822 | 822 |
823 } | 823 } |
824 | |
825 | |
826 | |
827 | |
828 | |
829 | |
830 |