beautypg.com

Key_init (), Key_wait (), E 22) – Maxim Integrated 73S12xxF Software User Manual

Page 22

background image

73S12xxF Software User Guide

UG_12xxF_016

22

Rev. 1.50

KEY_Init ()

Purpose

Configure the keyboard. This API will call the Set_Event() routine to enable an
Interrupt Service Routine (ISR) to handle keyboard scanning.

Synopsis

Void KEY_Init ( IN unsigned char rows_cols, IN unsigned char debounce_scan );


Parameters

RowsCols: Input parameter
Number of rows on keypad (max value is 6) times eight plus number of columns on
keypad (max value is 5), i.e. rows*8 + cols.

Debounce_scan: Input parameter
Number of milliseconds to debounce key (granularity is 4ms) plus number of
milliseconds between key scans (1 to 4 ms) 1 = 1 ms; 2 = 2 ms; 3 = 3 ms and 0=4 ms.

Return Codes None.

KEY_Wait ()

Purpose

Wait for a keypad input during a maximum time specified by the TimeOut value.
Other events (e.g. Smart Card insertion and removal) can be specified as exit
conditions for this function.

Synopsis

KEY_RC KEY_Wait (

IN Unsigned Int ScanOrder,

IN Unsigned char TimeOut,

IN Unsigned Int ExitOnICCInsert,

IN Unsigned Int ExitOnICCRemoval,

IN Unsigned Word ExitOnEvent,

OUT Unsigned Word *ExitOn,

OUT Unsigned char *KeyCode );

Parameters

ScanOrder: Input parameter
Column scan order, in five sets of three bits each, with the least significant 3-bits (0-
2) indexing the first column scanned and bits (12-14) indexing the fifth column
scanned.

TimeOut: Input parameter
Timeout value in seconds. If no key is entered within this period, the function is aborted.

ExitOnICCInsert: Input parameter
Specifies which, if any, SmartCard insertion events are exit conditions. Bit[n]
corresponds to ICC[n], bit[1] being mapped to the least significant bit. This option
should NOT be used simultaneously with the ExitOnICCRemoval option.

ExitOnICCRemoval: Input parameter
Specifies which, if any, SmartCard removal events are exit conditions. Bit[n]
corresponds to ICC[n]. This option should NOT be used simultaneously with the
ExitOnICCInsert option.

ExitOnEvent : Input parameter
On input, specifies which, if any, other events are exit conditions. Possible values are any
combination of the following:

EVENT_EXT0

0x00000001

EVENT_EXT1

0x00000002

EVENT_EXT2

0x00000004

EVENT_EXT3

0x00000008

EVENT_TIMER0

0x00000010

EVENT_TIMER1

0x00000020

EVENT_ICC

0x00000040

EVENT_RTC

0x00000080

//not available with 73S1205F

EVENT_KEY_DETECT

0x00000100

EVENT_USB

0x00000200

//not available with 73S1205F