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
      
        
          | 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". 
 
 
 
 
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.  
 | 
 
 
This function ungates the KPP clock and initializes KPP. This function must be called before calling any other KPP driver functions.
- Parameters
 - 
  
    | base | KPP peripheral base address.  | 
    | configure | The 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
 - 
  
    | base | KPP peripheral base address.  | 
  
   
 
 
  
  
      
        
          | static void KPP_EnableInterrupts  | 
          ( | 
          KPP_Type *  | 
          base,  | 
         
        
           | 
           | 
          uint16_t  | 
          mask  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
- Parameters
 - 
  
    | base | KPP peripheral base address.  | 
    | mask | KPP 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
 - 
  
    | base | KPP peripheral base address.  | 
    | mask | KPP 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
 - 
  
    | base | KPP 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
 - 
  
    | base | KPP peripheral base address.  | 
    | mask | KPP 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
 - 
  
    | base | KPP peripheral base address.  | 
    | mask | KPP 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
 - 
  
    | base | KPP peripheral base address.  | 
    | data | KPP 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.  |