system.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef __system_h__
  2. #define __system_h__
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <string.h>
  6. #include "sdk_common.h"
  7. #include "SEGGER_RTT.h"
  8. #include "usr_config.h"
  9. typedef void (*Sleep_cb)(uint32_t);
  10. typedef void (*PROCESS_cb)(void);
  11. typedef struct _PROCESS{ //进程结构体
  12. uint8_t holdon; //进程是否可进入低功耗模式
  13. uint16_t Peroid; //进程周期
  14. uint32_t tim; //进程时间搓
  15. PROCESS_cb cb; //进程函数
  16. uint8_t enable; //进程运行标志位
  17. const char *name_t; //进程
  18. #if ProcessTime_EN
  19. const char *name_t; //进程
  20. uint32_t cnt1_rtc; //RTC开始时间
  21. uint32_t cnt2_rtc; //RTC结束时间
  22. #endif
  23. }PROCESS_t;
  24. #define DEBUG_LOG(format,...) SEGGER_RTT_printf(0,format, ##__VA_ARGS__);
  25. int Sleep_Regist(Sleep_cb cb); //休眠之前的回调注册
  26. int Wakeup_Regist(Sleep_cb cb); //休眠醒来的回调注册
  27. void Sleep_Event(void);
  28. int Process_Start(uint32_t peroid,const char *name,PROCESS_cb cb); //app进程开始
  29. void Process_Stop(PROCESS_cb cb); //app进程停止
  30. void Process_SetHoldOn(PROCESS_cb cb,uint8_t holdon); //app进程是否可进入低功耗模式
  31. void Process_UpdatePeroid(PROCESS_cb cb,uint16_t Peroid);
  32. uint16_t Process_GetPeroid(PROCESS_cb cb);
  33. #endif