luat_pm_air105.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "luat_base.h"
  2. #include "luat_pm.h"
  3. #include "app_interface.h"
  4. #define LUAT_LOG_TAG "pm"
  5. #include "luat_log.h"
  6. int luat_pm_request(int mode) {
  7. // if (mode != LUAT_PM_SLEEP_MODE_LIGHT || mode == LUAT_PM_SLEEP_MODE_DEEP) {
  8. // LLOGW("only pm.LIGHT/pm.DEEP supported");
  9. // return -1;
  10. // }
  11. // uint8_t i;
  12. // for(i = UART_ID1; i< UART_MAX; i++)
  13. // {
  14. // Uart_Sleep(i, 0);
  15. // }
  16. if (mode != LUAT_PM_SLEEP_MODE_IDLE)
  17. {
  18. PM_SetDriverRunFlag(PM_DRV_DBG, 0);
  19. }
  20. else
  21. {
  22. PM_SetDriverRunFlag(PM_DRV_DBG, 1);
  23. }
  24. return 0;
  25. }
  26. int luat_pm_release(int mode) {
  27. return 0;
  28. }
  29. int luat_pm_dtimer_start(int id, size_t timeout) {
  30. if (id != 0)
  31. return -1;
  32. RTC_SetAlarm(timeout / 1000, NULL, NULL); // 无需回调, 或者改成回调里重启, 也不太对的样
  33. return 0;
  34. }
  35. int luat_pm_dtimer_stop(int id) {
  36. if (id != 0)
  37. return -1;
  38. RTC_SetAlarm(0, NULL, NULL); // 设置为0就是关闭
  39. return 0;
  40. }
  41. int luat_pm_dtimer_check(int id) {
  42. return -1;
  43. }
  44. // void luat_pm_cb(int event, int arg, void* args);
  45. int luat_pm_last_state(int *lastState, int *rtcOrPad) {
  46. return 0;
  47. }
  48. int luat_pm_force(int mode) {
  49. return luat_pm_request(mode);
  50. }
  51. int luat_pm_check(void) {
  52. return 0;
  53. }
  54. int luat_pm_dtimer_list(size_t* count, size_t* list) {
  55. *count = 0;
  56. return 0;
  57. }
  58. int luat_pm_dtimer_wakeup_id(int* id) {
  59. return -1;
  60. }