Infineon Logo AIROC BTSDK v4.9 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Keyscan Interface Queue

Defines the keyscan interface. More...

Defines the keyscan interface.

The keyscan interface is practically defined as a queue from the consumer's perspective. Key up/down events are seen as a stream coming from the driver. In addition the interface provides the user with the ability to reset the HW as well as turn keyscaning on/off.

Up/down flag

enum
{
    KEY_DOWN = 0x0,
    KEY_UP   = 0x1
};

Special event codes used internally by the driver

enum
{
    /// Rollover event generated by the keyscan driver in case of an error (ghost or overflow)
    ROLLOVER = 0xff,

    /// Event returned to indicate the end of a scan cycle.
    END_OF_SCAN_CYCLE = 0xfe
};

Definition of a key event.

#pragma pack(1)
typedef PACKED struct
{
    /// Key code. This is the location in the keyscan matrix that is pressed/released.
    /// May be implemented as ((row * numCols) + col) or ((col * numRows) + row.
    BYTE keyCode;

    /// Reserved bits
    BYTE reserved : 6;

    /// Up/down flag
    BYTE upDownFlag : 1;

    /// Should be toggled for every scan cycle in which a new event is queued.
    /// Use of this flag is optional. If used, it allows the consumer to determine whether
    /// an event is detected in the same scan cycle as the previous event or a different one.
    /// Note that this flag does not indicate any separation in time.
    BYTE scanCycleFlag : 1;
}KeyEvent;
#pragma pack()