app_gpiote.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file app_gpiote.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of GPIO Interrupt app library.
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_GPIO_INTERRUPT GPIO INTERRUPT
47 * @brief GPIO INTERRUPT APP module driver.
48 * @{
49 */
50
51
52 #ifndef _APP_GPIOTE_H_
53 #define _APP_GPIOTE_H_
54
55 #include "app_io.h"
56 #include "app_drv_error.h"
57
58 /** @addtogroup APP_GPIO_INTERRUPT_STRUCTURES Structures
59 * @{
60 */
61
62 /**
63 * @brief GPIO Interrupt event Structure definition
64 */
65 typedef struct
66 {
67 app_io_type_t type; /**< Type of event. */
68 uint32_t pin; /**< Specifies the IO pins to be configured. */
69 app_ctx_type_t ctx_type; /**< Type of handler context. */
70 } app_gpiote_evt_t;
71
72 /**
73 * @brief GPIOTE input event handler type.
74 */
75 typedef void (*app_gpiote_event_handler_t)(app_gpiote_evt_t *p_evt);
76
77 /**
78 * @brief GPIOTE callback type.
79 */
80 typedef void (*app_io_callback_t)(app_gpiote_evt_t *p_evt);
81
82 /**
83 * @brief GPIOTE Interrupt parameters structure definition
84 */
85 typedef struct
86 {
87 app_io_type_t type; /**< Specifies IO type */
88 uint32_t pin; /**< Specifies the IO pins to be configured. */
89 app_io_mode_t mode; /**< Specifies the IO mode for the selected pins. */
90 app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */
91 app_handle_mode_t handle_mode; /**< Specifies the IO wakeup mode. */
92 app_io_callback_t io_evt_cb; /**< IO callback function. */
93 } app_gpiote_param_t;
94
95 /** @} */
96
97 /* Exported functions --------------------------------------------------------*/
98 /** @addtogroup APP_GPIOTE_DRIVER_FUNCTIONS Functions
99 * @{
100 */
101
102 /**
103 ****************************************************************************************
104 * @brief Initialize the APP GPIO Interrupt DRIVER according to the specified parameters
105 * in the app_gpiote_param_t and app_gpiote_event_handler_t.
106 *
107 * @param[in] p_params: Pointer to app_gpiote_param_t parameter which contains the
108 * configuration information for the specified GPIO.
109 * @param[in] table_cnt: Used GPIO number.
110 *
111 * @return Result of initialization.
112 ****************************************************************************************
113 */
114 uint16_t app_gpiote_init(const app_gpiote_param_t *p_params, uint8_t table_cnt);
115
116 /**
117 ****************************************************************************************
118 * @brief De-initialize the APP GPIO Interrupt DRIVER peripheral.
119 *
120 ****************************************************************************************
121 */
122 void app_gpiote_deinit(void);
123
124 /**
125 ****************************************************************************************
126 * @brief Config the APP GPIO Interrupt DRIVER according to the specified parameters
127 * in the app_gpiote_param_t.
128 *
129 * @param[in] p_config: Pointer to app_gpiote_param_t parameter which contains the
130 * configuration information for the specified GPIO.
131 *
132 * @return Result of initialization.
133 ****************************************************************************************
134 */
135 uint16_t app_gpiote_config(const app_gpiote_param_t *p_config);
136
137
138 /** @} */
139
140 #endif
141
142 /** @} */
143 /** @} */
144 /** @} */
app_gpiote_param_t::pull
app_io_pull_t pull
Specifies the Pull-up or Pull-Down activation for the selected pins.
Definition: app_gpiote.h:90
app_gpiote_evt_t::ctx_type
app_ctx_type_t ctx_type
Type of handler context.
Definition: app_gpiote.h:69
app_gpiote_config
uint16_t app_gpiote_config(const app_gpiote_param_t *p_config)
Config the APP GPIO Interrupt DRIVER according to the specified parameters in the app_gpiote_param_t.
app_gpiote_param_t::mode
app_io_mode_t mode
Specifies the IO mode for the selected pins.
Definition: app_gpiote.h:89
app_gpiote_param_t::handle_mode
app_handle_mode_t handle_mode
Specifies the IO wakeup mode.
Definition: app_gpiote.h:91
app_io_pull_t
app_io_pull_t
GPIO pull Enumerations definition.
Definition: app_io.h:187
app_io_type_t
app_io_type_t
GPIO type Enumerations definition.
Definition: app_io.h:141
app_ctx_type_t
app_ctx_type_t
GPIO handler context type Enumerations definition.
Definition: app_io.h:178
app_io_mode_t
app_io_mode_t
GPIO mode Enumerations definition.
Definition: app_io.h:152
app_gpiote_event_handler_t
void(* app_gpiote_event_handler_t)(app_gpiote_evt_t *p_evt)
GPIOTE input event handler type.
Definition: app_gpiote.h:75
app_io_callback_t
void(* app_io_callback_t)(app_gpiote_evt_t *p_evt)
GPIOTE callback type.
Definition: app_gpiote.h:80
app_gpiote_evt_t::pin
uint32_t pin
Specifies the IO pins to be configured.
Definition: app_gpiote.h:68
app_gpiote_init
uint16_t app_gpiote_init(const app_gpiote_param_t *p_params, uint8_t table_cnt)
Initialize the APP GPIO Interrupt DRIVER according to the specified parameters in the app_gpiote_para...
app_io.h
Header file containing functions prototypes of GPIO app library.
app_gpiote_param_t::io_evt_cb
app_io_callback_t io_evt_cb
IO callback function.
Definition: app_gpiote.h:92
app_gpiote_param_t
GPIOTE Interrupt parameters structure definition.
Definition: app_gpiote.h:86
app_gpiote_param_t::pin
uint32_t pin
Specifies the IO pins to be configured.
Definition: app_gpiote.h:88
app_gpiote_evt_t::type
app_io_type_t type
Type of event.
Definition: app_gpiote.h:67
app_handle_mode_t
app_handle_mode_t
GPIO wake-up mode Enumerations definition.
Definition: app_io.h:168
app_gpiote_param_t::type
app_io_type_t type
Specifies IO type.
Definition: app_gpiote.h:87
app_gpiote_deinit
void app_gpiote_deinit(void)
De-initialize the APP GPIO Interrupt DRIVER peripheral.
app_drv_error.h
Header file of app driver error code.
app_gpiote_evt_t
GPIO Interrupt event Structure definition.
Definition: app_gpiote.h:66