app_io.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file app_io.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of GPIO 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 GPIO
47 * @brief GPIO APP module driver.
48 * @{
49 */
50
51
52 #ifndef _APP_IO_H_
53 #define _APP_IO_H_
54
55 #include "app_drv_error.h"
56 #include "app_drv_config.h"
57 #include <stdint.h>
58
59 /** @addtogroup APP_GPIO_PIN_DEFINES Defines
60 * @{
61 */
62
63 /** @addtogroup GR5xxx_pins Defines
64 * @{
65 */
66 /**
67 * @brief APP_GPIO_DEFINE IO pins
68 */
69 #define APP_IO_PIN_0 ((uint32_t)0x00000001U) /**< Pin 0 selected */
70 #define APP_IO_PIN_1 ((uint32_t)0x00000002U) /**< Pin 1 selected */
71 #define APP_IO_PIN_2 ((uint32_t)0x00000004U) /**< Pin 2 selected */
72 #define APP_IO_PIN_3 ((uint32_t)0x00000008U) /**< Pin 3 selected */
73 #define APP_IO_PIN_4 ((uint32_t)0x00000010U) /**< Pin 4 selected */
74 #define APP_IO_PIN_5 ((uint32_t)0x00000020U) /**< Pin 5 selected */
75 #define APP_IO_PIN_6 ((uint32_t)0x00000040U) /**< Pin 6 selected */
76 #define APP_IO_PIN_7 ((uint32_t)0x00000080U) /**< Pin 7 selected */
77 #define APP_IO_PIN_8 ((uint32_t)0x00000100U) /**< Pin 8 selected */
78 #define APP_IO_PIN_9 ((uint32_t)0x00000200U) /**< Pin 9 selected */
79 #define APP_IO_PIN_10 ((uint32_t)0x00000400U) /**< Pin 10 selected */
80 #define APP_IO_PIN_11 ((uint32_t)0x00000800U) /**< Pin 11 selected */
81 #define APP_IO_PIN_12 ((uint32_t)0x00001000U) /**< Pin 12 selected */
82 #define APP_IO_PIN_13 ((uint32_t)0x00002000U) /**< Pin 13 selected */
83 #define APP_IO_PIN_14 ((uint32_t)0x00004000U) /**< Pin 14 selected */
84 #define APP_IO_PIN_15 ((uint32_t)0x00008000U) /**< Pin 15 selected */
85 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X)
86 #define APP_IO_PIN_16 ((uint32_t)0x00010000U) /**< Pin 16 selected */
87 #define APP_IO_PIN_17 ((uint32_t)0x00020000U) /**< Pin 17 selected */
88 #define APP_IO_PIN_18 ((uint32_t)0x00040000U) /**< Pin 18 selected */
89 #define APP_IO_PIN_19 ((uint32_t)0x00080000U) /**< Pin 19 selected */
90 #define APP_IO_PIN_20 ((uint32_t)0x00100000U) /**< Pin 20 selected */
91 #define APP_IO_PIN_21 ((uint32_t)0x00200000U) /**< Pin 21 selected */
92 #define APP_IO_PIN_22 ((uint32_t)0x00400000U) /**< Pin 22 selected */
93 #define APP_IO_PIN_23 ((uint32_t)0x00800000U) /**< Pin 23 selected */
94 #define APP_IO_PIN_24 ((uint32_t)0x01000000U) /**< Pin 24 selected */
95 #define APP_IO_PIN_25 ((uint32_t)0x02000000U) /**< Pin 25 selected */
96 #define APP_IO_PIN_26 ((uint32_t)0x04000000U) /**< Pin 26 selected */
97 #define APP_IO_PIN_27 ((uint32_t)0x08000000U) /**< Pin 27 selected */
98 #define APP_IO_PIN_28 ((uint32_t)0x10000000U) /**< Pin 28 selected */
99 #define APP_IO_PIN_29 ((uint32_t)0x20000000U) /**< Pin 29 selected */
100 #define APP_IO_PIN_30 ((uint32_t)0x40000000U) /**< Pin 30 selected */
101 #define APP_IO_PIN_31 ((uint32_t)0x80000000U) /**< Pin 31 selected */
102 #endif
103
104 #define APP_IO_PINS_0_7 ((uint32_t)0x000000FFU) /**< 0~7 pins selected */
105 #define APP_IO_PINS_0_15 ((uint32_t)0x0000FFFFU) /**< 0~15 pins selected */
106 #define APP_IO_PINS_16_31 ((uint32_t)0xFFFF0000U) /**< 16~31 pins selected */
107 #define APP_AON_IO_PIN_ALL ((uint32_t)0x000000FFU) /**< All AON pins selected */
108 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X)
109 #define APP_IO_PIN_ALL ((uint32_t)0x00003FFFU) /**< All pins selected */
110 #define APP_MSIO_IO_PIN_ALL ((uint32_t)0x000003FFU) /**< All MISO pins selected */
111 #else
112 #define APP_IO_PIN_ALL ((uint32_t)0x0000FFFFU) /**< All pins selected */
113 #define APP_MSIO_IO_PIN_ALL ((uint32_t)0x000000FFU) /**< All MISO pins selected */
114 #endif
115 #define APP_IO_PIN_MASK ((uint32_t)0xFFFFFFFFU) /**< PIN mask for assert test */
116
117 /**
118 * @brief GR5xxx_APP_GPIO_default_config initStruct default config of APP_GPIOn
119 */
120 #define APP_IO_DEFAULT_CONFIG \
121 { \
122 .pin = APP_IO_PIN_ALL, \
123 .mode = APP_IO_MODE_INPUT, \
124 .pull = APP_IO_PULLDOWN, \
125 }
126
127 /** @} */
128
129 /** @} */
130
131 /** @addtogroup APP_GPIO_ENUMERATIONS Enumerations
132 * @{
133 */
134 /**
135 * @brief GPIO state Enumerations definition
136 */
137 typedef enum
138 {
139 APP_IO_PIN_RESET, /**< IO pin low level. */
140 APP_IO_PIN_SET, /**< IO pin high level. */
141 } app_io_pin_state_t;
142
143 /**
144 * @brief GPIO type Enumerations definition
145 */
146 typedef enum
147 {
148 APP_IO_TYPE_GPIOA, /**< General Purpose Input/Output. */
149 APP_IO_TYPE_GPIOB, /**< General Purpose Input/Output. */
150 APP_IO_TYPE_GPIOC, /**< General Purpose Input/Output. */
151 APP_IO_TYPE_AON, /**< Always-on Input/Output. */
152 APP_IO_TYPE_MSIO, /**< Mixed Signal I/O. */
153 // #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X)
154 APP_IO_TYPE_NORMAL, /**< General Purpose Input/Output. */
155 // #endif
156 APP_IO_TYPE_MAX, /**< Only for check parameter, not used as input parameters. */
157 } app_io_type_t;
158
159 /**
160 * @brief GPIO mode Enumerations definition
161 */
162 typedef enum
163 {
164 APP_IO_MODE_NONE,
165 APP_IO_MODE_INPUT, /**< Input Mode. */
166 APP_IO_MODE_OUTPUT, /**< Output Mode. */
167 APP_IO_MODE_MUX, /**< Mux Mode. */
168 APP_IO_MODE_IT_RISING, /**< Interrupt Mode with Rising edge trigger detection. */
169 APP_IO_MODE_IT_FALLING, /**< Interrupt Mode with Falling edge trigger detection. */
170 #if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X)
171 APP_IO_MODE_IT_BOTH_EDGE, /**< Interrupt Mode with Rising and Falling edge trigger detection */
172 #endif
173 APP_IO_MODE_IT_HIGH, /**< Interrupt Mode with High-level trigger detection. */
174 APP_IO_MODE_IT_LOW, /**< Interrupt Mode with Low-level trigger detection. */
175 APP_IO_MODE_ANALOG, /**< Analog IO Mode. */
176 APP_IO_MODE_MAX, /**< Only for check parameter, not used as input parameters. */
177 } app_io_mode_t;
178
179 /**
180 * @brief GPIO pull Enumerations definition
181 */
182 typedef enum
183 {
184 APP_IO_NOPULL, /**< No Pull-up or Pull-down activation. */
185 APP_IO_PULLUP, /**< Pull-up activation. */
186 APP_IO_PULLDOWN, /**< Pull-down activation. */
187 APP_IO_PULL_MAX /**< Only for check parameter, not used as input parameters. */
188 } app_io_pull_t;
189
190 /**
191 * @brief GPIO mux Enumerations definition
192 */
193 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X)
194 typedef enum
195 {
196 APP_IO_MUX_0, /**< IO_MUX_GPIO. */
197 APP_IO_MUX_1, /**< IO_MUX_I2C0_SCL. */
198 APP_IO_MUX_2, /**< IO_MUX_I2C0_SDA. */
199 APP_IO_MUX_3, /**< IO_MUX_I2C1_SCL. */
200 APP_IO_MUX_4, /**< IO_MUX_I2C1_SDA. */
201 APP_IO_MUX_5, /**< IO_MUX_UART0_CTS. */
202 APP_IO_MUX_6, /**< IO_MUX_UART0_RTS. */
203 APP_IO_MUX_7, /**< IO_MUX_UART0_TX. */
204 APP_IO_MUX_8, /**< IO_MUX_UART0_RX. */
205 APP_IO_MUX_9, /**< IO_MUX_UART1_CTS. */
206 APP_IO_MUX_10, /**< IO_MUX_UART1_RTS. */
207 APP_IO_MUX_11, /**< IO_MUX_UART1_TX. */
208 APP_IO_MUX_12, /**< IO_MUX_UART1_RX. */
209 APP_IO_MUX_13, /**< IO_MUX_PWM0. */
210 APP_IO_MUX_14, /**< IO_MUX_PWM1. */
211 APP_IO_MUX_15, /**< IO_MUX_PWM2. */
212 APP_IO_MUX_16, /**< IO_MUX_PWM3. */
213 APP_IO_MUX_17, /**< IO_MUX_PWM4. */
214 APP_IO_MUX_18, /**< IO_MUX_PWM5. */
215 APP_IO_MUX_19, /**< IO_MUX_df_ant_sw_0. */
216 APP_IO_MUX_20, /**< IO_MUX_df_ant_sw_1. */
217 APP_IO_MUX_21, /**< IO_MUX_df_ant_sw_2. */
218 APP_IO_MUX_22, /**< IO_MUX_df_ant_sw_3. */
219 APP_IO_MUX_23, /**< IO_MUX_df_ant_sw_4. */
220 APP_IO_MUX_24, /**< IO_MUX_df_ant_sw_5. */
221 APP_IO_MUX_25, /**< IO_MUX_df_ant_sw_6. */
222 APP_IO_MUX_26, /**< IO_MUX_ferp_gpio_trig_0. */
223 APP_IO_MUX_27, /**< IO_MUX_SWO. */
224 APP_IO_MUX_28, /**< IO_MUX_coex_ble_rx. */
225 APP_IO_MUX_29, /**< IO_MUX_coex_ble_tx. */
226 APP_IO_MUX_30, /**< IO_MUX_coex_wlan_rx. */
227 APP_IO_MUX_31, /**< IO_MUX_coex_wlan_tx. */
228 APP_IO_MUX_32, /**< IO_MUX_coex_ble_in_process. */
229 APP_IO_MUX_33, /**< IO_MUX_SWD_CLK. */
230 APP_IO_MUX_34, /**< IO_MUX_SWD_DATA. */
231 APP_IO_MUX_35, /**< IO_MUX_reserve3. */
232 APP_IO_MUX_36, /**< IO_MUX_reserve4. */
233 APP_IO_MUX_37, /**< IO_MUX_reserve5. */
234 APP_IO_MUX_38, /**< IO_MUX_SPI_S_MOSI. */
235 APP_IO_MUX_39, /**< IO_MUX_SPI_S_CS_N. */
236 APP_IO_MUX_40, /**< IO_MUX_SPI_S_CLK. */
237 APP_IO_MUX_41, /**< IO_MUX_SPI_S_MISO. */
238 APP_IO_MUX_42, /**< IO_MUX_SPI_M_CLK. */
239 APP_IO_MUX_43, /**< IO_MUX_SPI_M_CS0_N. */
240 APP_IO_MUX_44, /**< IO_MUX_SPI_M_CS1_N. */
241 APP_IO_MUX_45, /**< IO_MUX_SPI_M_MISO. */
242 APP_IO_MUX_46, /**< IO_MUX_SPI_M_MOSIss. */
243 APP_IO_MUX_47, /**< RESERVED. */
244 APP_IO_MUX_48, /**< RESERVED. */
245 APP_IO_MUX_49, /**< IO_MUX_DUAL_TIMER0_A. */
246 APP_IO_MUX_50, /**< IO_MUX_DUAL_TIMER0_B. */
247 APP_IO_MUX_51, /**< IO_MUX_DUAL_TIMER0_C. */
248 APP_IO_MUX_52, /**< IO_MUX_DUAL_TIMER1_A. */
249 APP_IO_MUX_53, /**< IO_MUX_DUAL_TIMER1_B. */
250 APP_IO_MUX_54, /**< IO_MUX_DUAL_TIMER1_C. */
251 APP_IO_MUX_MAX, /**< Only for check parameter, not used as input parameters. */
252 } app_io_mux_t;
253 #else
254 typedef enum
255 {
256 APP_IO_MUX_0, /**< IO mux mode 0. */
257 APP_IO_MUX_1, /**< IO mux mode 1. */
258 APP_IO_MUX_2, /**< IO mux mode 2. */
259 APP_IO_MUX_3, /**< IO mux mode 3. */
260 APP_IO_MUX_4, /**< IO mux mode 4. */
261 APP_IO_MUX_5, /**< IO mux mode 5. */
262 APP_IO_MUX_6, /**< IO mux mode 6. */
263 APP_IO_MUX_7, /**< IO mux mode 7. */
264 APP_IO_MUX_8, /**< IO mux mode 8. */
265 APP_IO_MUX_MAX, /**< Only for check parameter, not used as input parameters. */
266 } app_io_mux_t;
267 #endif
268 /** @} */
269
270 /** @addtogroup APP_GPIO_PIN_DEFINES Defines
271 * @{
272 */
273 /**
274 * @brief GPIO mux for different APP_DRIVER_CHIP_TYPE
275 */
276 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X)
277 #define APP_IO_MUX APP_IO_MUX_0 /**< IO mux for GR5332X. */
278 #elif (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)
279 #define APP_IO_MUX APP_IO_MUX_8 /**< IO mux for GR5525X. */
280 #else
281 #define APP_IO_MUX APP_IO_MUX_7 /**< IO mux for others. */
282 #endif
283
284 /** @} */
285
286 /** @addtogroup APP_GPIO_STRUCT Structures
287 * @{
288 */
289 /**
290 * @brief GPIO parameter structure definition
291 */
292 typedef struct
293 {
294 uint32_t pin; /**< Specifies the IO pins to be configured.
295 This parameter can be any value of @ref GR5xxx_pins */
296 app_io_mode_t mode; /**< Specifies the operating mode for the selected pins. */
297 app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */
298 app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */
299 } app_io_init_t;
300
301 /**
302 * @brief GPIO Interrupt event Structure definition
303 */
304 typedef struct
305 {
306 app_io_type_t type; /**< Type of event. */
307 uint32_t pin; /**< Specifies the IO pins to be configured. */
308 void *arg; /**< User parameters */
309 } app_io_evt_t;
310
311 /** @} */
312
313 /** @addtogroup APP_GPIO_ENUMERATIONS Enumerations
314 * @{
315 */
316 /**
317 * @brief GPIO Speed Structure definition
318 */
319 typedef enum {
320 APP_IO_SPPED_MEDIUM, /**< Select medium speed. */
321 APP_IO_SPPED_HIGH, /**< Select high speed. */
322 APP_IO_SPPED_MAX /**< Only for check parameter, not used as input parameters. */
323 } app_io_speed_t;
324
325
326 /**
327 * @brief GPIO Input type Structure definition
328 */
329 typedef enum {
330 APP_IO_INPUT_TYPE_CMOS, /**< Select CMOS input. */
331 APP_IO_INPUT_TYPE_SCHMITT, /**< Select Schmitt input. */
332 APP_IO_INPUT_TYPE_MAX /**< Only for check parameter, not used as input parameters. */
333 } app_io_input_type_t;
334
335 /**
336 * @brief GPIO Strength Structure definition
337 */
338 typedef enum {
339 APP_IO_STRENGTH_LOW, /**< Select low output driver strength. */
340 APP_IO_STRENGTH_MEDIUM, /**< Select medium output driver strength. */
341 APP_IO_STRENGTH_HIGH, /**< Select high output driver strength. */
342 APP_IO_STRENGTH_ULTRA, /**< Select high output driver strength. */
343 APP_IO_STRENGTH_MAX, /**< Only for check parameter, not used as input parameters. */
344 } app_io_strength_t;
345
346 /** @} */
347
348 /** @addtogroup APP_GPIO_TYPEDEFS Type definitions
349 * @{
350 */
351 /**
352 * @brief GPIO callback type.
353 */
354 typedef void (*app_io_callback_t)(app_io_evt_t *p_evt);
355
356 /** @} */
357
358 /* Exported functions --------------------------------------------------------*/
359 /** @addtogroup HAL_APP_GPIO_DRIVER_FUNCTIONS Functions
360 * @{
361 */
362 /**
363 ****************************************************************************************
364 * @brief Initialize the APP GPIO DRIVER according to the specified parameters
365 * in the app_io_type_t and app_io_init_t.
366 *
367 * @param[in] type: GPIO type.
368 * @param[in] p_init: Pointer to app_io_init_t parameter which contains the
369 * configuration information for the specified GPIO.
370 *
371 * @return Result of initialization.
372 ****************************************************************************************
373 */
374 uint16_t app_io_init(app_io_type_t type, app_io_init_t *p_init);
375
376 /**
377 ****************************************************************************************
378 * @brief De-initialize the GPIOx peripheral.
379 *
380 * @param[in] type: GPIO type, See app_io_type_t.
381 * @param[in] pin: The pin want to De-initialization.
382 *
383 * @return Result of De-initialization.
384 ****************************************************************************************
385 */
386 uint16_t app_io_deinit(app_io_type_t type, uint32_t pin);
387
388 /**
389 ****************************************************************************************
390 * @brief Read the specified input port pin..
391 *
392 * @param[in] type: GPIO type, See app_io_type_t.
393 * @param[in] pin: The pin want to read.
394 *
395 * @return The GPIO state.
396 ****************************************************************************************
397 */
398 app_io_pin_state_t app_io_read_pin(app_io_type_t type, uint32_t pin);
399
400 /**
401 ****************************************************************************************
402 * @brief Set or clear the selected data port bit.
403 *
404 * @param[in] type: GPIO type, See app_io_type_t.
405 * @param[in] pin: The pin want to set or clear.
406 * @param[in] pin_state: Specifies the value to be written to the selected bit.
407 *
408 * @return Result of write.
409 ****************************************************************************************
410 */
411 uint16_t app_io_write_pin(app_io_type_t type, uint32_t pin, app_io_pin_state_t pin_state);
412
413 /**
414 ****************************************************************************************
415 * @brief Toggle the specified GPIO pin.
416 *
417 * @param[in] type: GPIO type, See app_io_type_t.
418 * @param[in] pin: The pin want to toggle.
419 *
420 * @return Result of toggle.
421 ****************************************************************************************
422 */
423 uint16_t app_io_toggle_pin(app_io_type_t type, uint32_t pin);
424
425 /**
426 ****************************************************************************************
427 * @brief Set the speed of the GPIO.
428 *
429 * @param[in] type: GPIO type, See app_io_type_t.
430 * @param[in] pin: The pin want to set.
431 * @param[in] speed: GPIO speed type, See app_io_speed_t.
432 *
433 * @return Result of setting.
434 ****************************************************************************************
435 */
436 uint16_t app_io_set_speed(app_io_type_t type, uint32_t pin, app_io_speed_t speed);
437
438 /**
439 ****************************************************************************************
440 * @brief Set the strength of the GPIO.
441 *
442 * @param[in] type: GPIO type, See app_io_type_t.
443 * @param[in] pin: The pin want to set.
444 * @param[in] strength: GPIO strength type, See app_io_strength_t.
445 *
446 * @return Result of setting.
447 ****************************************************************************************
448 */
449 uint16_t app_io_set_strength(app_io_type_t type, uint32_t pin, app_io_strength_t strength);
450
451 /**
452 ****************************************************************************************
453 * @brief Set the input type of the GPIO.
454 *
455 * @param[in] type: GPIO type, See app_io_type_t.
456 * @param[in] pin: The pin want to toggle.
457 * @param[in] input_type: GPIO input type, See app_io_input_type_t.
458 *
459 * @return Result of setting.
460 ****************************************************************************************
461 */
462 uint16_t app_io_set_intput_type(app_io_type_t type, uint32_t pin, app_io_input_type_t input_type);
463
464 /**
465 ****************************************************************************************
466 * @brief Initialize GPIO to interrupt mode and register interrupt callback function.
467 *
468 * @param[in] type: GPIO type, See app_io_type_t.
469 * @param[in] p_init: Pointer to app_io_init_t parameter which contains the
470 * configuration information for the specified GPIO.
471 * @param[in] io_evt_cb: Interrupt callback function.
472 * @param[in] arg: User parameters.
473 *
474 * @return Result of register.
475 ****************************************************************************************
476 */
477 uint16_t app_io_event_register_cb(app_io_type_t type, app_io_init_t *p_init, app_io_callback_t io_evt_cb, void *arg);
478
479 /**
480 ****************************************************************************************
481 * @brief Deinitialize GPIO to normal mode and unregister interrupt.
482 *
483 * @param[in] type: GPIO type, See app_io_type_t.
484 * @param[in] pin: The pin want to unregister.
485 *
486 * @return Result of unregister.
487 ****************************************************************************************
488 */
489 uint16_t app_io_event_unregister(app_io_type_t type, uint32_t pin);
490
491 /** @} */
492 #endif
493
494 /** @} */
495
496 /** @} */
497
498 /** @} */
499
APP_IO_MUX_1
@ APP_IO_MUX_1
IO mux mode 1.
Definition: app_io.h:257
APP_IO_SPPED_MEDIUM
@ APP_IO_SPPED_MEDIUM
Select medium speed.
Definition: app_io.h:320
app_io_speed_t
app_io_speed_t
GPIO Speed Structure definition.
Definition: app_io.h:319
app_io_set_intput_type
uint16_t app_io_set_intput_type(app_io_type_t type, uint32_t pin, app_io_input_type_t input_type)
Set the input type of the GPIO.
APP_IO_MUX_6
@ APP_IO_MUX_6
IO mux mode 6.
Definition: app_io.h:262
app_io_init_t::mode
app_io_mode_t mode
Specifies the operating mode for the selected pins.
Definition: app_io.h:296
app_io_evt_t
GPIO Interrupt event Structure definition.
Definition: app_io.h:305
app_io_input_type_t
app_io_input_type_t
GPIO Input type Structure definition.
Definition: app_io.h:329
app_io_event_unregister
uint16_t app_io_event_unregister(app_io_type_t type, uint32_t pin)
Deinitialize GPIO to normal mode and unregister interrupt.
APP_IO_MODE_IT_HIGH
@ APP_IO_MODE_IT_HIGH
Interrupt Mode with High-level trigger detection.
Definition: app_io.h:173
APP_IO_MODE_ANALOG
@ APP_IO_MODE_ANALOG
Analog IO Mode.
Definition: app_io.h:175
APP_IO_NOPULL
@ APP_IO_NOPULL
No Pull-up or Pull-down activation.
Definition: app_io.h:184
app_io_callback_t
void(* app_io_callback_t)(app_io_evt_t *p_evt)
GPIO callback type.
Definition: app_io.h:354
APP_IO_INPUT_TYPE_CMOS
@ APP_IO_INPUT_TYPE_CMOS
Select CMOS input.
Definition: app_io.h:330
APP_IO_MUX_4
@ APP_IO_MUX_4
IO mux mode 4.
Definition: app_io.h:260
app_io_write_pin
uint16_t app_io_write_pin(app_io_type_t type, uint32_t pin, app_io_pin_state_t pin_state)
Set or clear the selected data port bit.
APP_IO_MODE_IT_RISING
@ APP_IO_MODE_IT_RISING
Interrupt Mode with Rising edge trigger detection.
Definition: app_io.h:168
APP_IO_MODE_MAX
@ APP_IO_MODE_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:176
app_io_deinit
uint16_t app_io_deinit(app_io_type_t type, uint32_t pin)
De-initialize the GPIOx peripheral.
app_io_pull_t
app_io_pull_t
GPIO pull Enumerations definition.
Definition: app_io.h:183
app_io_type_t
app_io_type_t
GPIO type Enumerations definition.
Definition: app_io.h:147
APP_IO_STRENGTH_HIGH
@ APP_IO_STRENGTH_HIGH
Select high output driver strength.
Definition: app_io.h:341
APP_IO_MUX_7
@ APP_IO_MUX_7
IO mux mode 7.
Definition: app_io.h:263
APP_IO_MODE_OUTPUT
@ APP_IO_MODE_OUTPUT
Output Mode.
Definition: app_io.h:166
APP_IO_STRENGTH_ULTRA
@ APP_IO_STRENGTH_ULTRA
Select high output driver strength.
Definition: app_io.h:342
APP_IO_TYPE_AON
@ APP_IO_TYPE_AON
Always-on Input/Output.
Definition: app_io.h:151
app_io_mode_t
app_io_mode_t
GPIO mode Enumerations definition.
Definition: app_io.h:163
APP_IO_MUX_8
@ APP_IO_MUX_8
IO mux mode 8.
Definition: app_io.h:264
app_io_init_t::pull
app_io_pull_t pull
Specifies the Pull-up or Pull-Down activation for the selected pins.
Definition: app_io.h:297
APP_IO_PULL_MAX
@ APP_IO_PULL_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:187
APP_IO_PIN_RESET
@ APP_IO_PIN_RESET
IO pin low level.
Definition: app_io.h:139
APP_IO_MODE_NONE
@ APP_IO_MODE_NONE
Definition: app_io.h:164
APP_IO_MODE_IT_FALLING
@ APP_IO_MODE_IT_FALLING
Interrupt Mode with Falling edge trigger detection.
Definition: app_io.h:169
APP_IO_TYPE_NORMAL
@ APP_IO_TYPE_NORMAL
General Purpose Input/Output.
Definition: app_io.h:154
APP_IO_PULLUP
@ APP_IO_PULLUP
Pull-up activation.
Definition: app_io.h:185
APP_IO_STRENGTH_MAX
@ APP_IO_STRENGTH_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:343
app_io_set_strength
uint16_t app_io_set_strength(app_io_type_t type, uint32_t pin, app_io_strength_t strength)
Set the strength of the GPIO.
APP_IO_TYPE_MSIO
@ APP_IO_TYPE_MSIO
Mixed Signal I/O.
Definition: app_io.h:152
APP_IO_MUX_MAX
@ APP_IO_MUX_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:265
APP_IO_MUX_3
@ APP_IO_MUX_3
IO mux mode 3.
Definition: app_io.h:259
app_io_event_register_cb
uint16_t app_io_event_register_cb(app_io_type_t type, app_io_init_t *p_init, app_io_callback_t io_evt_cb, void *arg)
Initialize GPIO to interrupt mode and register interrupt callback function.
APP_IO_INPUT_TYPE_MAX
@ APP_IO_INPUT_TYPE_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:332
APP_IO_MUX_5
@ APP_IO_MUX_5
IO mux mode 5.
Definition: app_io.h:261
APP_IO_MUX_0
@ APP_IO_MUX_0
IO mux mode 0.
Definition: app_io.h:256
app_io_set_speed
uint16_t app_io_set_speed(app_io_type_t type, uint32_t pin, app_io_speed_t speed)
Set the speed of the GPIO.
APP_IO_MUX_2
@ APP_IO_MUX_2
IO mux mode 2.
Definition: app_io.h:258
APP_IO_SPPED_MAX
@ APP_IO_SPPED_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:322
APP_IO_MODE_INPUT
@ APP_IO_MODE_INPUT
Input Mode.
Definition: app_io.h:165
app_io_evt_t::arg
void * arg
User parameters.
Definition: app_io.h:308
APP_IO_PIN_SET
@ APP_IO_PIN_SET
IO pin high level.
Definition: app_io.h:140
APP_IO_PULLDOWN
@ APP_IO_PULLDOWN
Pull-down activation.
Definition: app_io.h:186
APP_IO_TYPE_MAX
@ APP_IO_TYPE_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:156
app_io_read_pin
app_io_pin_state_t app_io_read_pin(app_io_type_t type, uint32_t pin)
Read the specified input port pin.
app_io_pin_state_t
app_io_pin_state_t
GPIO state Enumerations definition.
Definition: app_io.h:138
APP_IO_INPUT_TYPE_SCHMITT
@ APP_IO_INPUT_TYPE_SCHMITT
Select Schmitt input.
Definition: app_io.h:331
app_io_evt_t::type
app_io_type_t type
Type of event.
Definition: app_io.h:306
app_io_init
uint16_t app_io_init(app_io_type_t type, app_io_init_t *p_init)
Initialize the APP GPIO DRIVER according to the specified parameters in the app_io_type_t and app_io_...
APP_IO_STRENGTH_MEDIUM
@ APP_IO_STRENGTH_MEDIUM
Select medium output driver strength.
Definition: app_io.h:340
app_io_toggle_pin
uint16_t app_io_toggle_pin(app_io_type_t type, uint32_t pin)
Toggle the specified GPIO pin.
app_io_strength_t
app_io_strength_t
GPIO Strength Structure definition.
Definition: app_io.h:338
app_io_mux_t
app_io_mux_t
GPIO mux Enumerations definition.
Definition: app_io.h:255
APP_IO_TYPE_GPIOA
@ APP_IO_TYPE_GPIOA
General Purpose Input/Output.
Definition: app_io.h:148
app_io_init_t::mux
app_io_mux_t mux
Specifies the Peripheral to be connected to the selected pins.
Definition: app_io.h:298
APP_IO_MODE_MUX
@ APP_IO_MODE_MUX
Mux Mode.
Definition: app_io.h:167
app_drv_error.h
Header file of app driver error code.
app_io_evt_t::pin
uint32_t pin
Specifies the IO pins to be configured.
Definition: app_io.h:307
app_drv_config.h
Header file of app driver config code.
APP_IO_TYPE_GPIOC
@ APP_IO_TYPE_GPIOC
General Purpose Input/Output.
Definition: app_io.h:150
APP_IO_TYPE_GPIOB
@ APP_IO_TYPE_GPIOB
General Purpose Input/Output.
Definition: app_io.h:149
APP_IO_MODE_IT_LOW
@ APP_IO_MODE_IT_LOW
Interrupt Mode with Low-level trigger detection.
Definition: app_io.h:174
app_io_init_t
GPIO parameter structure definition.
Definition: app_io.h:293
APP_IO_STRENGTH_LOW
@ APP_IO_STRENGTH_LOW
Select low output driver strength.
Definition: app_io.h:339
APP_IO_SPPED_HIGH
@ APP_IO_SPPED_HIGH
Select high speed.
Definition: app_io.h:321
app_io_init_t::pin
uint32_t pin
Specifies the IO pins to be configured.
Definition: app_io.h:294