1 /**************************************************************************//** 2 * @file kpi.h 3 * @version V3.00 4 * @brief Keypad interface driver header file 5 * 6 * @copyright SPDX-License-Identifier: Apache-2.0 7 * @copyright Copyright (C) 2021 Nuvoton Technology Corp. All rights reserved. 8 *****************************************************************************/ 9 #ifndef __KPI_H__ 10 #define __KPI_H__ 11 12 13 #ifdef __cplusplus 14 extern "C" 15 { 16 #endif 17 18 19 /** @addtogroup Standard_Driver Standard Driver 20 @{ 21 */ 22 23 /** @addtogroup KPI_Driver KPI Driver 24 @{ 25 */ 26 27 /** @addtogroup KPI_EXPORTED_CONSTANTS KPI Exported Constants 28 @{ 29 */ 30 31 #define KPI_MAX_ROW 6 32 #define KPI_MAX_COL 8 33 #define KPI_MAX_KEYS (KPI_MAX_ROW * KPI_MAX_COL) 34 35 #define KPI_PRESS 0 36 #define KPI_RELEASE 1 37 38 typedef struct { 39 uint8_t x; 40 uint8_t y; 41 uint16_t st; 42 } KPI_KEY_T; 43 44 /**@}*/ /* end of group KPI_EXPORTED_CONSTANTS */ 45 46 47 /** @addtogroup KPI_EXPORTED_FUNCTIONS KPI Exported Functions 48 @{ 49 */ 50 51 int32_t KPI_Open(uint32_t u32Rows, uint32_t u32Columns, KPI_KEY_T *pkeyQueue, uint32_t u32MaxKeyCnt); 52 void KPI_Close(void); 53 int32_t KPI_kbhit(void); 54 KPI_KEY_T KPI_GetKey(void); 55 void KPI_SetSampleTime(uint32_t ms); 56 void KPI_EnableSlowScan(void); 57 /**@}*/ /* end of group KPI_EXPORTED_FUNCTIONS */ 58 59 /**@}*/ /* end of group KPI_Driver */ 60 61 /**@}*/ /* end of group Standard_Driver */ 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 #endif /* __KPI_H__ */ 68 69