Keypad functions


Defines

#define KEYCOL   6
#define KEYROW   4
#define GETROW(key)   (key>>4)
#define GETCOL(key)   (key&0x0f)

Typedefs

typedef void(* key_callback )(void *)

Functions

ssize_t Keyrx (int count, u8 *buffer)
char Key_getch (void)
int KeyCall (key_callback callback, void *privatedata)

Detailed Description

This module provides functions for receiving data from the Keypad of the IPAC. The Keypad module uses the realtime scheduler to scan the keypad for data. When data is received it's placed in a fifo and if a callback is registered it's called. Data can be read from the fifo at any time using the Keyrx function.

Typedef Documentation

typedef void(* key_callback)(void *)
 

a keypad callback type of function can be registered to be called whenever a key is pressed.

Definition at line 31 of file Key.h.


Function Documentation

char Key_getch void   ) 
 

block until a key is pressed This function polls the keypad fifo until data appears. That character is then returned.

Returns:
the character received

int KeyCall key_callback  callback,
void *  privatedata
 

install a keypad callback KeyCall can be used to install a callback function on the keypad module. Whenever a key is pressed this function is called with the arguement privatedata. The callback doesn't return the key, this must be read with Keyrx A Keypad Callback can be removed by calling KeyCall again with NULL as the callback arg Note: this function briefly suspends the real-time interrupt when run.

Parameters:
callback a key_callback function that will be called whenever a key is pressed
privatedata a pointer to anything, this pointer will be passed to the callback when it is run

ssize_t Keyrx int  count,
u8 *  buffer
 

Receive data from the Keypad fifo Pull data from the keypad fifo. To keep this module generic and not rely on a specific keypad, no keypad matix is used. instead the character returned indicates the row and column that the character belongs to. The row is the top nibble column is the bottom nibble; The macros GETROW and GETCOL can be used for this purpose

Parameters:
count the number of characters to pull from the fifo
pointer to an array to store the characters in.
Returns:
the number of characters placed into buffer
See also:
GETROW

GETCOL


Generated on Fri Mar 3 17:25:46 2006 for EMAC-HCS12-SDK by  doxygen 1.4.6