drv_pwrkey_internal.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright (C) 2020 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _DRV_PWRKEY_INTERNAL_H_
  13. #define _DRV_PWRKEY_INTERNAL_H_
  14. //#include "drv_keypad.h"
  15. #include "osi_compiler.h"
  16. #define POWERKEY_KEYCODE (0)
  17. typedef enum
  18. {
  19. PWR_STATE_PRESS = (1 << 0),
  20. PWR_STATE_RELEASE = (1 << 1),
  21. } pwrState_t;
  22. OSI_EXTERN_C_BEGIN
  23. /**
  24. * @brief get powerkey current state
  25. */
  26. int drvpowerkeyState();
  27. /**
  28. * @brief function type, power key event handler
  29. */
  30. typedef void (*pwrkeyCB_t)(pwrState_t evt, void *param);
  31. /**
  32. * \brief enable power key
  33. *
  34. * \param cb callback when key state change, called in ISR
  35. * \param mask powerkey state
  36. * \param param caller context
  37. */
  38. void drvPwrkeyEnable(pwrkeyCB_t cb, uint32_t mask, void *param);
  39. /**
  40. * \brief get power key state
  41. *
  42. * \return the key is pressed or not
  43. */
  44. bool drvPwrkeyPressed();
  45. OSI_EXTERN_C_END
  46. #endif