hal_pwr_mgmt.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file hal_pwr_mgmt.h
5 * @author BLE Driver Team
6 * @brief This file contains all the functions prototypes for the HAL
7 * module driver.
8 *
9 ****************************************************************************************
10 * @attention
11 #####Copyright (c) 2019 GOODIX
12 All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions are met:
16 * Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18 * Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21 * Neither the name of GOODIX nor the names of its contributors may be used
22 to endorse or promote products derived from this software without
23 specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
29 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 POSSIBILITY OF SUCH DAMAGE.
36 ****************************************************************************************
37 */
38
39 /** @addtogroup PERIPHERAL Peripheral Driver
40 * @{
41 */
42
43 /** @addtogroup HAL_DRIVER HAL Driver
44 * @{
45 */
46
47 /** @defgroup HAL_PWR_MGMT PWR_MGMT
48 * @brief PWR_MGMT HAL module driver.
49 * @{
50 */
51
52 /* Define to prevent recursive inclusion -------------------------------------*/
53 #ifndef HAL_PWR_MGMT_H
54 #define HAL_PWR_MGMT_H
55
56 /* Includes ------------------------------------------------------------------*/
57 #include "hal_def.h"
58 typedef enum
59 {
60 HAL_PM_ACTIVE = 0,
61 HAL_PM_SLEEP
62 } hal_pm_status_t;
63
64 void hal_pm_init(void);
65 void hal_pm_deinit(void);
66 void hal_pm_resume_system(void);
67 void hal_pm_resume_user(void);
68 hal_pm_status_t hal_pm_suspend_system(void);
69 hal_pm_status_t hal_pm_suspend_user(void);
70
71 #define HAL_PM_SUSPEND(_PM_FUNC_) if(HAL_PM_SLEEP != (_PM_FUNC_)){ return HAL_PM_ACTIVE; }
72
73 #define HAL_PM_ASSERT_ENABLE 0
74 #ifndef HAL_PM_ASSERT
75 #if HAL_PM_ASSERT_ENABLE
76 #define HAL_PM_ASSERT(x) if(!(x)) { while(1); }
77 #else
78 #define HAL_PM_ASSERT(ignore) ((void)0)
79 #endif
80 #endif
81
82 #endif /*HAL_PWR_MGMT_H*/
83
84 /** @} */
85
86 /** @} */
87
88 /** @} */
HAL_PM_ACTIVE
@ HAL_PM_ACTIVE
Definition: hal_pwr_mgmt.h:60
hal_pm_suspend_system
hal_pm_status_t hal_pm_suspend_system(void)
HAL_PM_SLEEP
@ HAL_PM_SLEEP
Definition: hal_pwr_mgmt.h:61
hal_pm_status_t
hal_pm_status_t
Definition: hal_pwr_mgmt.h:59
hal_pm_resume_user
void hal_pm_resume_user(void)
hal_pm_resume_system
void hal_pm_resume_system(void)
hal_pm_init
void hal_pm_init(void)
hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
hal_pm_suspend_user
hal_pm_status_t hal_pm_suspend_user(void)
hal_pm_deinit
void hal_pm_deinit(void)