Infineon Logo AIROC BTSDK v4.6 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups

Data Structures

struct  KeyscanRegistration
 Keyscan event notification registration structure. Internal. More...
 
struct  KeyscanState
 Keyscan driver state. More...
 

Modules

 KeyscanQueue
 

Typedefs

typedef struct KeyscanRegistration KeyscanRegistration
 Keyscan event notification registration structure. Internal.
 

Enumerations

enum  { EVENT_NONE = 0xfd }
 Defines the standard keyscan driver. More...
 
enum  {
  HW_CTRL_SCAN_CTRL_MASK = 0x00001, HW_CTRL_GHOST_DETECT_MASK = 0x00004, HW_CTRL_INTERRUPT_CTRL_MASK = 0x00008, HW_CTRL_RESET_MASK = 0x00010,
  HW_CTRL_RC_EXT_MASK = 0x000C0, HW_CTRL_ROW_MASK = 0x00700, HW_CTRL_COL_MASK = 0x0F800, HW_CTRL_COL_DRIVE_CTRL_MASK = 0x10000,
  HW_CTRL_ROW_DRIVE_CTRL_MASK = 0x20000, HW_CTRL_SCAN_ENABLE = 0x00001, HW_CTRL_GHOST_ENABLE = 0x00004, HW_CTRL_KS_INTERRUPT_ENABLE = 0x00008,
  HW_CTRL_RESET_ENABLE = 0x00010, HW_CTRL_CLK_ALWAYS_ON = 0x40000, HW_CTRL_RC_DEFAULT = 0x000C0, HW_CTRL_ROW_SHIFT = 8,
  HW_CTRL_COL_SHIFT = 11, HW_CTRL_COL_ACTIVE_DRIVE = 0x10000, HW_CTRL_ROW_ACTIVE_DRIVE = 0x20000, HW_CTRL_SCAN_DISABLE = 0x00000,
  HW_CTRL_GHOST_DISABLE = 0x00000, HW_CTRL_INTERRUPT_DISABLE = 0x00000, HW_CTRL_RESET_DISABLE = 0x00000, HW_CTRL_CLK_AUTO_CTRL = 0x00000,
  HW_CTRL_COLUMN_PASSIVE_DRIVE = 0x00000, HW_CTRL_ROW_PASSIVE_DRIVE = 0x00000
}
 Internal HW control and status bits.
 
enum  { HW_MIA_STATUS_KEYSCAN_INT_SET_MASK = 0x00040 }
 Keyscan interrupt mask. Internal.
 
enum  { HW_LHL_CTRL_CLR_KEYS = 0x0002, HW_LHL_STATUS_GHOST = 0x0008, HW_LHL_STATUS_KEY_FIFO_OVERFLOW = 0x0004, HW_LHL_STATUS_KEYCODE = 0x0002 }
 Keyscan HW status bits. Internal.
 
enum  {
  HW_KEYCODE_MASK = 0x000000ff, HW_SCAN_CYCLE_MASK = 0x40000000, HW_KEY_UP_DOWN_MASK = (int)0x80000000, HW_KEYCODE_SHIFT_COUNT = 0,
  HW_SCAN_CYCLE_SHIFT_COUNT = 30, HW_KEY_UP_DOWN_SHIFT_COUNT = 31, HW_KEYCODE_GHOST = 0xf5, HW_KEYCODE_INIT = 0xff,
  HW_KEY_UP = (int)0x80000000, HW_KEY_DOWN = 0x00000000
}
 Keyscan configuration and status bits.
 
enum  { CH_SEL_KEYSCAN_ROW_INPUT_50_57 = 0x0000, CH_SEL_KEYSCAN_ROW_INPUT_16_23 = 0x0001 }
 

Functions

void keyscan_init (void)
 Keyscan driver initialization function. More...
 
void keyscan_reset (void)
 Reset the keyscan HW. Any existing events will be thrown away.
 
BOOL32 keyscan_eventsPending (void)
 Check if there are any pending key events. More...
 
BOOL32 keyscan_getNextEvent (KeyEvent *event)
 Get next key event. More...
 
void keyscan_turnOff (void)
 Disables keyscanning and and any associated wakeup.
 
void keyscan_turnOn (void)
 Enabled keyscanning and and any associated wakeup functionality. More...
 
void keyscan_registerForEventNotification (void(*userfn)(void *), void *userdata)
 Register for notification of changes. More...
 
void keyscan_enableEventDetection (void)
 Configures the interrupt source from Keyscan HW and enables event detection. More...
 
void keyscan_flushHwEvents (void)
 Clears the keys in the HW queue.
 
void keyscan_miaFreezeCallBack (void)
 MIA clock freeze notification. More...
 
void keyscan_miaUnfreezeCallBack (void)
 MIA clock unfreeze notification. Internal.
 
void keyscan_enableInterrupt (void)
 Enables the interrupts from Keyscan HW. More...
 
void keyscan_disableInterrupt (void)
 Disables interrupts from the keyscan HW block.
 
void keyscan_ksInterrupt (void)
 Thread context interrupt handler. Internal.
 
void keyscan_restoreActivity (void)
 Reenables keyscan after a soft power up. Internal.
 
void keyscan_clearKeysPressedCount (void)
 Clear the count of unmatched key down events. Internal.
 
UINT8 keyscan_getKeysPressedCount (void)
 Get count of unmatched key down events.
 
void keyscan_enableGhostDetection (BOOL32 enable)
 Enable/disable keyscan ghost detection.
 
void keyscan_hwResetOnce (void)
 Soft Reset the keyscan HW once.
 
void keyscan_initHW (void)
 Initialize the keyscan HE. Internal.
 
void keyscan_configGpios (void)
 Configure the GPIOs used by the keyscan HW based on keyscan config.
 
void keyscan_getEventsFromHWFifo (void)
 Retrieve events from the HW fifo and places them in the FW fifo. More...
 

Detailed Description

Enumeration Type Documentation

anonymous enum

Defines the standard keyscan driver.

The standard keyscan driver provides the status and control for the keyscan driver. It provides the keyEvents to the interface, maintains the queue behind it. It also supports keyscanning turning on or off.No event.

Enumerator
EVENT_NONE 

Keycode value if no key is pressed.

Function Documentation

void keyscan_enableEventDetection ( void  )

Configures the interrupt source from Keyscan HW and enables event detection.

A callback function using keyscan_registerForEventNotification() must have been registered prior to enabling event detection.

void keyscan_enableInterrupt ( void  )

Enables the interrupts from Keyscan HW.

Note that Keyscan interrupt must be configured before being used enabled, else, interrupts will not fire.

BOOL32 keyscan_eventsPending ( void  )

Check if there are any pending key events.

Returns
TRUE if there are pending key events, FALSE otherwise
void keyscan_getEventsFromHWFifo ( void  )

Retrieve events from the HW fifo and places them in the FW fifo.

End of scan cycle events are inserted to separate keys detected in separate scans. This function assumes that MIA clock is frozen.

BOOL32 keyscan_getNextEvent ( KeyEvent event)

Get next key event.

Parameters
eventpointer to where the event should be stored
Returns
TRUE if an event is returned, FALSE otherwise
void keyscan_init ( void  )

Keyscan driver initialization function.

This allocates space for the FW FIFO for key events and initializes the keyscan HW. This function should be invoked only once before using any keyscan services. Subsequent invocations will invoke undefined behavior. Keyscan driver must be initialized AFTER mia driver is initialized.

void keyscan_miaFreezeCallBack ( void  )

MIA clock freeze notification.

Retrieves any pending events from the HW fifo. Internal.

void keyscan_registerForEventNotification ( void(*)(void *)  userfn,
void *  userdata 
)

Register for notification of changes.

Once registered, you CAN NOT UNREGISTER; registration is meant to be a startup activity

Parameters
userfnpoints to the function to call when the interrupt comes and matches one of the masks (if you pass a method, it must be static). The function does not need to clear the interrupt status; this will be done by KeyscanDriver::lhlInterrupt(). The function will be called ONCE per interrupt.
userdatawill be passed back to userfn as-is; it can be used to carry the "this", for example
void keyscan_turnOn ( void  )

Enabled keyscanning and and any associated wakeup functionality.

Should only be used if keyscanning was disabled via turnOff()