app_drv_error.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file app_drv_error.h
5 * @author BLE Driver Team
6 * @brief Header file of app driver error code.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup APP_DRIVER APP DRIVER
43 * @{
44 */
45
46 /** @defgroup APP_DRIVER_ERROR ERROR DEFINE
47 * @brief APP ERROR DEFINE
48 * @{
49 */
50
51
52 #ifndef _APP_DRV_ERROR_H_
53 #define _APP_DRV_ERROR_H_
54
55 #include "stdint.h"
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61 /**@addtogroup APP_DRV_ERR Defines
62 * @{
63 */
64 /**@addtogroup APP_DRV_ERR_CODE App Driver error codes
65 * @{
66 */
67 #define APP_DRV_SUCCESS 0x0000 /**< Successful. */
68 #define APP_DRV_ERR_HAL 0x0001 /**< Hal internal error. */
69 #define APP_DRV_ERR_BUSY 0x0002 /**< Driver is busy. */
70 #define APP_DRV_ERR_TIMEOUT 0x0003 /**< Timeout occurred. */
71 #define APP_DRV_ERR_INVALID_PARAM 0x0004 /**< Invalid parameter supplied. */
72 #define APP_DRV_ERR_POINTER_NULL 0x0005 /**< Invalid pointer supplied. */
73 #define APP_DRV_ERR_INVALID_TYPE 0x0006 /**< Invalid type suplied. */
74 #define APP_DRV_ERR_INVALID_MODE 0x0007 /**< Invalid mode suplied. */
75 #define APP_DRV_ERR_INVALID_ID 0x0008 /**< Invalid ID suplied. */
76 #define APP_DRV_ERR_NOT_INIT 0x0009 /**< Driver not init. */
77 /** @} */
78
79 /**@addtogroup APP_DRV_ERR_CODE_CHECK App Driver error code check
80 * @{
81 */
82 /**@brief App Driver error code check. */
83 #define APP_DRV_ERR_CODE_CHECK(err_code) \
84 do \
85 { \
86 if (APP_DRV_SUCCESS != err_code) \
87 { \
88 return err_code; \
89 } \
90 } while(0)
91 /** @} */
92
93 /**@addtogroup HAL_DRV_ERR_CODE_CHECK Hal Driver error code check
94 * @{
95 */
96 /**@brief Hal Driver error code check. */
97 #define HAL_ERR_CODE_CHECK(err_code) \
98 do \
99 { \
100 if (HAL_OK != err_code) \
101 { \
102 return (uint16_t)err_code; \
103 } \
104 } while(0)
105 /** @} */
106 /** @} */
107
108 /**
109 * @defgroup APP_DRV_ERROR_TYPEDEF Typedefs
110 * @{
111 */
112 /**@brief APP driver error type. */
113 typedef uint16_t app_drv_err_t;
114 /**@} */
115
116 #ifdef __cplusplus
117 }
118 #endif
119
120 #endif
121
122 /** @} */
123 /** @} */
124 /** @} */
125
app_drv_err_t
uint16_t app_drv_err_t
APP driver error type.
Definition: app_drv_error.h:113