nu_kpi.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**************************************************************************//**
  2. * @file nu_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 __NU_KPI_H__
  10. #define __NU_KPI_H__
  11. #ifdef __cplusplus
  12. extern "C"
  13. {
  14. #endif
  15. /** @addtogroup Standard_Driver Standard Driver
  16. @{
  17. */
  18. /** @addtogroup KPI_Driver KPI Driver
  19. @{
  20. */
  21. /** @addtogroup KPI_EXPORTED_CONSTANTS KPI Exported Constants
  22. @{
  23. */
  24. #define KPI_MAX_ROW 6
  25. #define KPI_MAX_COL 8
  26. #define KPI_MAX_KEYS (KPI_MAX_ROW * KPI_MAX_COL)
  27. #define KPI_PRESS 0
  28. #define KPI_RELEASE 1
  29. typedef struct
  30. {
  31. uint8_t x;
  32. uint8_t y;
  33. uint16_t st;
  34. } KPI_KEY_T;
  35. /**@}*/ /* end of group KPI_EXPORTED_CONSTANTS */
  36. /** @addtogroup KPI_EXPORTED_FUNCTIONS KPI Exported Functions
  37. @{
  38. */
  39. int32_t KPI_Open(uint32_t u32Rows, uint32_t u32Columns, KPI_KEY_T *pkeyQueue, uint32_t u32MaxKeyCnt);
  40. void KPI_Close(void);
  41. int32_t KPI_kbhit(void);
  42. KPI_KEY_T KPI_GetKey(void);
  43. void KPI_SetSampleTime(uint32_t ms);
  44. /**@}*/ /* end of group KPI_EXPORTED_FUNCTIONS */
  45. /**@}*/ /* end of group KPI_Driver */
  46. /**@}*/ /* end of group Standard_Driver */
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /* __NU_KPI_H__ */