lv_gui_main.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* Copyright (C) 2018 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 _LV_GUI_MAIN_H_
  13. #define _LV_GUI_MAIN_H_
  14. #include "osi_api.h"
  15. #include "lv_gui_config.h"
  16. OSI_EXTERN_C_BEGIN
  17. /**
  18. * \brief forward declaration
  19. */
  20. struct _lv_indev_t;
  21. /**
  22. * \brief function prototype for gui creation
  23. */
  24. typedef void (*lvGuiCreate_t)(void);
  25. /**
  26. * \brief start gui based on littlevgl
  27. *
  28. * It will create gui thread, initialize littlevgl, and optional call gui
  29. * creation function \p create.
  30. *
  31. * LCD should be initialized before this, back light should be enabled. And
  32. * usually quick logo has been shown. Gui thread will blit to LCD directly.
  33. *
  34. * \param create gui creation function
  35. */
  36. void lvGuiInit(lvGuiCreate_t create);
  37. /**
  38. * \brief terminate littlevgl gui
  39. *
  40. * Most likely, it won't be called.
  41. */
  42. void lvGuiDeinit(void);
  43. /**
  44. * \brief get littlevgl gui thread
  45. *
  46. * \return
  47. * - littlevgl gui thread
  48. */
  49. osiThread_t *lvGuiGetThread(void);
  50. /**
  51. * \brief get keypad input device
  52. * \return
  53. * - keypad device
  54. */
  55. struct _lv_indev_t *lvGuiGetKeyPad(void);
  56. /**
  57. * \brief schedule a callback to be executed in gui thread
  58. *
  59. * \param cb callback function
  60. * \param param callback parameter
  61. */
  62. void lvGuiThreadCallback(osiCallback_t cb, void *param);
  63. /**
  64. * \brief send event to gui thread
  65. */
  66. void lvGuiSendEvent(const osiEvent_t *evt);
  67. /**
  68. * \brief request screen on
  69. *
  70. * It is for an application to request the screen on even there are no
  71. * user inputs.
  72. *
  73. * \p id is the identification of application. In the system, it should
  74. * be unique. Internally, 32bits bitmap is used to record this. So, it
  75. * should be inside [0,31].
  76. *
  77. * The request is not counting. That is, for a given application id,
  78. * event there are multiple calls, single call of \p lvGuiReleaseScreenOn
  79. * will clear the request.
  80. *
  81. * \param id application id
  82. * \return
  83. * - true on success
  84. * - false on invalid parameter
  85. */
  86. bool lvGuiRequestSceenOn(uint8_t id);
  87. /**
  88. * \brief release screen on request
  89. *
  90. * \param id application id
  91. * \return
  92. * - true on success
  93. * - false on invalid parameter
  94. */
  95. bool lvGuiReleaseScreenOn(uint8_t id);
  96. /**
  97. * \brief turn on screen
  98. *
  99. * When screen is already turned on, it will do nothing.
  100. */
  101. void lvGuiScreenOn(void);
  102. /**
  103. * \brief turn off screen
  104. *
  105. * When screen is already turned off, it will do nothing.
  106. */
  107. void lvGuiScreenOff(void);
  108. /**
  109. * \brief set screen off timeout at inactive
  110. *
  111. * It can change the default value. When \p timeout is 0, screen won't be
  112. * turned off by inactive timeout.
  113. *
  114. * \param timeout inactive screen off timeout, 0 for never timeout
  115. */
  116. void lvGuiSetInactiveTimeout(unsigned timeout);
  117. /**
  118. * \brief set whether animation is regarded as inactive
  119. *
  120. * When \p inactive is true, animation update won't be regarded as *active*.
  121. * The inactive screen off timer will still count down even there are
  122. * animations. Otherwise, inactive screen off timer will stop counting when
  123. * there are animation.
  124. *
  125. * \param inactive animation will be regarded as inactive
  126. */
  127. void lvGuiSetAnimationInactive(bool inactive);
  128. OSI_EXTERN_C_END
  129. #endif