MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
KPP: KeyPad Port Driver

Overview

The MCUXpresso SDK provides a peripheral driver for the KeyPad Port block of MCUXpresso SDK devices.

The KPP Initialize is to initialize for common configure: gate the KPP clock, configure columns, and rows features. The KPP Deinitialize is to ungate the clock.

The KPP provide the function to enable/disable interrupts. The KPP provide key press scanning function KPP_keyPressScanning. This API should be called by the Interrupt handler in application. KPP still provides functions to get and clear status flags.

Typical use case

Data Structures

struct  kpp_config_t
 Lists of KPP status. More...
 

Enumerations

enum  kpp_interrupt_enable_t {
  kKPP_keyDepressInterrupt = KPP_KPSR_KDIE_MASK,
  kKPP_keyReleaseInterrupt = KPP_KPSR_KRIE_MASK
}
 List of interrupts supported by the peripheral. More...
 
enum  kpp_sync_operation_t {
  kKPP_ClearKeyDepressSyncChain = KPP_KPSR_KDSC_MASK,
  kKPP_SetKeyReleasesSyncChain = KPP_KPSR_KRSS_MASK
}
 Lists of KPP synchronize chain operation. More...
 

Driver version

#define FSL_KPP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 KPP driver version 2.0.0. More...
 

Initialization and De-initialization

void KPP_Init (KPP_Type *base, kpp_config_t *configure)
 KPP initialize. More...
 
void KPP_Deinit (KPP_Type *base)
 Deinitializes the KPP module and gates the clock. More...
 

KPP Basic Operation

static void KPP_EnableInterrupts (KPP_Type *base, uint16_t mask)
 Enable the interrupt. More...
 
static void KPP_DisableInterrupts (KPP_Type *base, uint16_t mask)
 Disable the interrupt. More...
 
static uint16_t KPP_GetStatusFlag (KPP_Type *base)
 Gets the KPP interrupt event status. More...
 
static void KPP_ClearStatusFlag (KPP_Type *base, uint16_t mask)
 Clears KPP status flag. More...
 
static void KPP_SetSynchronizeChain (KPP_Type *base, uint16_t mask)
 Set KPP synchronization chain. More...
 
void KPP_keyPressScanning (KPP_Type *base, uint8_t *data, uint32_t clockSrc_Hz)
 Keypad press scanning. More...
 

Data Structure Documentation

struct kpp_config_t

Data Fields

uint8_t activeRow
 The row number: bit 7 ~ 0 represents the row 7 ~ 0. More...
 
uint8_t activeColumn
 The column number: bit 7 ~ 0 represents the column 7 ~ 0. More...
 
uint16_t interrupt
 KPP interrupt source. More...
 

Field Documentation

uint8_t kpp_config_t::activeRow
uint8_t kpp_config_t::activeColumn
uint16_t kpp_config_t::interrupt

A logical OR of "kpp_interrupt_enable_t".

Macro Definition Documentation

#define FSL_KPP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Enumeration Type Documentation

This enumeration uses one-bot encoding to allow a logical OR of multiple members. Members usually map to interrupt enable bits in one or more peripheral registers.

Enumerator
kKPP_keyDepressInterrupt 

Keypad depress interrupt source.

kKPP_keyReleaseInterrupt 

Keypad release interrupt source.

Enumerator
kKPP_ClearKeyDepressSyncChain 

Keypad depress interrupt status.

kKPP_SetKeyReleasesSyncChain 

Keypad release interrupt status.

Function Documentation

void KPP_Init ( KPP_Type *  base,
kpp_config_t configure 
)

This function ungates the KPP clock and initializes KPP. This function must be called before calling any other KPP driver functions.

Parameters
baseKPP peripheral base address.
configureThe KPP configuration structure pointer.
void KPP_Deinit ( KPP_Type *  base)

This function gates the KPP clock. As a result, the KPP module doesn't work after calling this function.

Parameters
baseKPP peripheral base address.
static void KPP_EnableInterrupts ( KPP_Type *  base,
uint16_t  mask 
)
inlinestatic
Parameters
baseKPP peripheral base address.
maskKPP interrupts to enable. This is a logical OR of the enumeration :: kpp_interrupt_enable_t.
static void KPP_DisableInterrupts ( KPP_Type *  base,
uint16_t  mask 
)
inlinestatic
Parameters
baseKPP peripheral base address.
maskKPP interrupts to disable. This is a logical OR of the enumeration :: kpp_interrupt_enable_t.
static uint16_t KPP_GetStatusFlag ( KPP_Type *  base)
inlinestatic
Parameters
baseKPP peripheral base address.
Returns
The status of the KPP. Application can use the enum type in the "kpp_interrupt_enable_t" to get the right status of the related event.
static void KPP_ClearStatusFlag ( KPP_Type *  base,
uint16_t  mask 
)
inlinestatic
Parameters
baseKPP peripheral base address.
maskKPP mask to be cleared. This is a logical OR of the enumeration :: kpp_interrupt_enable_t.
static void KPP_SetSynchronizeChain ( KPP_Type *  base,
uint16_t  mask 
)
inlinestatic
Parameters
baseKPP peripheral base address.
maskKPP mask to be cleared. This is a logical OR of the enumeration :: kpp_sync_operation_t.
void KPP_keyPressScanning ( KPP_Type *  base,
uint8_t *  data,
uint32_t  clockSrc_Hz 
)

This function will scanning all columns and rows. so all scanning data will be stored in the data pointer.

Parameters
baseKPP peripheral base address.
dataKPP key press scanning data. The data buffer should be prepared with length at least equal to KPP_KEYPAD_COLUMNNUM_MAX * KPP_KEYPAD_ROWNUM_MAX. the data pointer is recommended to be a array like uint8_t data[KPP_KEYPAD_COLUMNNUM_MAX]. for example the data[2] = 4, that means in column 1 row 2 has a key press event.