mapp_pwr.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //==================================================================
  2. //
  3. // Filename: mapp_pwr.h
  4. // Description:
  5. //
  6. //------------------------------------------------------------------
  7. //
  8. // version:
  9. // date: 00:08am, 09.Apr.2012, by Sirius
  10. // Description:
  11. //
  12. //------------------------------------------------------------------
  13. //==================================================================
  14. #ifndef _MAPP_PWR_H_
  15. #define _MAPP_PWR_H_
  16. /*------------------------------------------------------------------------------
  17. * I N C L U D E
  18. *------------------------------------------------------------------------------*/
  19. #include "stm32f0xx.h"
  20. #include "general.h"
  21. /*------------------------------------------------------------------------------
  22. * D E F I N E
  23. *------------------------------------------------------------------------------*/
  24. /*------------------------------------------------------------------------------
  25. * S T R U C T
  26. *------------------------------------------------------------------------------*/
  27. /* System power state */
  28. typedef enum {
  29. POWER_ON_RESET,
  30. POWER_ON_WAIT,
  31. POWER_ON_RESET9212,
  32. POWER_ON_CONFIG,
  33. POWER_ON_INIT,
  34. POWER_LED_IO_INIT,
  35. POWER_SYSTEM_RUN,
  36. POWER_OFF_INIT,
  37. POWER_OFF_SLEEP,
  38. NumOfPwrState
  39. } T_PWR_STATE;
  40. /* System sleep mode */
  41. typedef enum {
  42. SLEEP_INTO_NORMAL,
  43. SLEEP_INTO_STOP,
  44. SLEEP_INTO_STANDBY,
  45. NumOfSleepMode
  46. } T_SLEEP_MODE;
  47. /* System power off source */
  48. typedef enum {
  49. PWR_OFF_BY_ACC,
  50. PWR_OFF_BY_KEY,
  51. NumOfPwrOffSrc
  52. } T_PWR_OFF_SRC;
  53. typedef struct {
  54. T_PWR_STATE state; /* Power state */
  55. VU16 taskTmr; /* Power process timer */
  56. T_SLEEP_MODE sleepMode; /* Sleep mode */
  57. VU16 CanLostTmr; /* Sleep mode */
  58. BOOL sleepState; /* Sleep State */
  59. T_PWR_OFF_SRC offsrc;
  60. } T_PWR_CFG;
  61. extern T_PWR_CFG gtPwrCfg;
  62. /*------------------------------------------------------------------------------
  63. * E X T E R N
  64. *------------------------------------------------------------------------------*/
  65. /*------------------------------------------------------------------------------
  66. * P R O T O T Y P E
  67. *------------------------------------------------------------------------------*/
  68. void PwrVarInit(void);
  69. void PwrTask(void);
  70. void PwrTaskTmr(void);
  71. void PwrWakeupISRHandler(void);
  72. #endif /* _MAPP_PWR_H_ */
  73. /*------------------------------- E O F ----------------------------------------*/