
[Button (key) Operation]
 onHand/RuputerAPI "Keyin()" is the key input waiting function that bi_getbtn() is enclosed and additional feature is added.

* Button input waiting (Halt/Stop)
* The specified button keep pressing monitoring
* When the button is kept pressing, the specified blink area stops
* EL back light ON
* Button operation sound
* Double click monitoring

In addition, this function handles the event waiting of other than the button input.

* Event Input Waiting (Halt/Stop)


 When this function is called, it becomes the event/button input waiting.  In this case, CPU becomes Halt or Stop status.

 When any event/button input is done, this function is terminated from the waiting status.

 When the Filer event is generated, the return value becomes 0x8001.
 When the button input is generated, the return value becomes 0x00** (a bit value that is allocated to each button is inserted to *).
 For more information, refer to <wbiosLibManu(c)/(ASM).txt> and <rupsysLibManu(c).txt>.

 This Keyin function does not handle events.  It only detects an event.  For more information on how to handle events, refer to the following [Event Handling]section.

 Keyin()
  +--------------------------------------------+ 
  |                                            |
  |  Key input detection                       |
  |   |-Key operation sournd                   |
  |   |-EL back light ON                       |
  |   |-Keep pressing key monitoring           |
  |   |-blink stops while keep pressing key    |
  |   +-->->->->->->->->->->->->->->->->->->->->->->-> Exit
  |                                            |
  |  Event detection ->->->->->->->->->->->->->->->->-> Exit 
  |                                            |
  +--------------------------------------------+ 



***** Event Handling *****
Events can be handled by using onHand/RuputerAPI "Keyin()", "EvnetCall()" and "EventExec()".

EventCall() handles the following item.
 * Alarm sound

EventExec() handles the following items.
 * Mini Filer call
 * Power OFF
 * Time check display by keep pressing FILER key
 * Warning message display while the serial connection is done by docking station while an application is running.


Actually, you can realize these by making the following routines.

 Keyin()                                 EventCall(),EventExec()
 +---------------------+                 +----------------------+ 
 | Filer               |  Event          | Filer                |
 |                     |->->->->->->->-> |                      |
 | Event wait loop     |                 |Various event handling|
 |  including key event|Event termination|                      |
 +---------------------+ <-<-<-+ +-<-<-<-+----------------------+ 
                               ^ v 
                               ^ v 
                        If this event is done
                         by button (key) operation
                               ^ v 
                               ^ v 
                            +---------------------+ 
                            | Application         |
                            |                     |
                            |Button (key) handling|
                            |                     |
                            +---------------------+ 


In other words, you can execute the event that Filer controls by calling EventCall() and EventExec() while an application is running.


Program example

    int bt; /* Button */
    int rst;/* Application termination? */

    while(1) {
        bt=Keyin(0,-1);
        rst = EventCall(bt);

        if (rst==-1) {
            return;         /* Application termination request */
        }
        else if (rst==1) {
            rst = EventExec();
            if (rst==-1)
                return;     /* Application termination request */
        }
        else {
            /* Key handling of individual user  */
            if (bt==Bkey_up) { /* Process while Up key button is pressed */
            }
            :
        }
    }




***** Limitation of EventExec *****
In order to display the mini Filer and time check, the following process should be done for EventExec().

(1)EventExec() pre-process
 Blink, reverse display or timer interruption display that a user set should be stopped temporarily.  For more information on how to stop the time routine temporarily, refer to bi_tmset item.

(2)EventExec() post-process
 You should re-draw the application screen.
For example, capture the screen before EventExec() and paste the captured screen after EventExec().

 Restart the display of blink, reverse display or timer interruption that a user set.


Program example

    int bt; /* Button */
    int rst;/* Application termination? */

    while(1) {
        bt=Keyin(0,-1);
        rst = EventCall(bt);

        if (rst==-1) {
            return;         /* Application termination request */
        }
        else if (rst==1) {

            /* Here, stop displaying the
                application specific timer interruption */
            /* acquire if LCD screen is necessary */

            rst = EventExec();

            /* Display LCD screen again */
            /* Here, restart displaying the
                application specific timer interruption */

            if (rst==-1)
                return;     /* Application termination request */
        }
        else {
            /* Key process of individual user  */
            if (bt==Bkey_up) { /* When up key button is pressed */
            }
            :
        }
    }

===============================================================================
 Copyright (c) 1998-1999.  Seiko Instruments Inc.  All rights reserved. 
===============================================================================
