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 /** @addtogroup GR5xxx_pins Defines
63 * @{
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_IO_PIN_ALL ((uint32_t)0x0000FFFFU) /**< All pins selected */
108 #define APP_AON_IO_PIN_ALL ((uint32_t)0x000000FFU) /**< All AON pins selected */
109 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X)
110 #define APP_MSIO_IO_PIN_ALL ((uint32_t)0x000003FFU) /**< All MISO pins selected */
111 #else
112 #define APP_MSIO_IO_PIN_ALL ((uint32_t)0x000000FFU) /**< All MISO pins selected */
113 #endif
114 #define APP_IO_PIN_MASK ((uint32_t)0xFFFFFFFFU) /**< PIN mask for assert test */
115
116 /**
117 * @brief GR5xxx_APP_GPIO_default_config initStruct default configuart APP_GPIOn
118 */
119 #define APP_IO_DEFAULT_CONFIG \
120 { \
121 .pin = APP_IO_PIN_ALL, \
122 .mode = APP_IO_MODE_INPUT, \
123 .pull = APP_IO_PULLDOWN, \
124 }
125
126 /** @} */
127
128
129 /** @addtogroup APP_GPIO_ENUMERATIONS Enumerations
130 * @{
131 */
132 /**
133 * @brief GPIO state Enumerations definition
134 */
135 typedef enum
136 {
137 APP_IO_PIN_RESET, /**< IO pin low level. */
138 APP_IO_PIN_SET, /**< IO pin high level. */
139 } app_io_pin_state_t;
140
141 /**
142 * @brief GPIO type Enumerations definition
143 */
144 typedef enum
145 {
146 APP_IO_TYPE_GPIOA, /**< General Purpose Input/Output. */
147 APP_IO_TYPE_GPIOB, /**< General Purpose Input/Output. */
148 APP_IO_TYPE_GPIOC, /**< General Purpose Input/Output. */
149 // #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X)
150 APP_IO_TYPE_NORMAL, /**< General Purpose Input/Output. */
151 // #endif
152 APP_IO_TYPE_AON, /**< Always-on Input/Output. */
153 APP_IO_TYPE_MSIO, /**< Mixed Signal I/O. */
154 APP_IO_TYPE_MAX, /**< Only for check parameter, not used as input parameters. */
155 } app_io_type_t;
156
157 /**
158 * @brief GPIO mode Enumerations definition
159 */
160 typedef enum
161 {
162 APP_IO_MODE_NONE,
163 APP_IO_MODE_INPUT, /**< Input Mode. */
164 APP_IO_MODE_OUTPUT, /**< Output Mode. */
165 APP_IO_MODE_MUX, /**< Mux Mode. */
166 APP_IO_MODE_IT_RISING, /**< Interrupt Mode with Rising edge trigger detection. */
167 APP_IO_MODE_IT_FALLING, /**< Interrupt Mode with Falling edge trigger detection. */
168 #if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X)
169 APP_IO_MODE_IT_BOTH_EDGE, /**< Interrupt Mode with Rising and Falling edge trigger detection */
170 #endif
171 APP_IO_MODE_IT_HIGH, /**< Interrupt Mode with High-level trigger detection. */
172 APP_IO_MODE_IT_LOW, /**< Interrupt Mode with Low-level trigger detection. */
173 APP_IO_MODE_ANALOG, /**< Analog IO Mode. */
174 APP_IO_MODE_MAX, /**< Only for check parameter, not used as input parameters. */
175 } app_io_mode_t;
176
177 /**
178 * @brief GPIO pull Enumerations definition
179 */
180 typedef enum
181 {
182 APP_IO_NOPULL, /**< No Pull-up or Pull-down activation. */
183 APP_IO_PULLUP, /**< Pull-up activation. */
184 APP_IO_PULLDOWN, /**< Pull-down activation. */
185 APP_IO_PULL_MAX /**< Only for check parameter, not used as input parameters. */
186 } app_io_pull_t;
187
188 /**
189 * @brief GPIO mux Enumerations definition
190 */
191 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X)
192 typedef enum
193 {
194 APP_IO_MUX_0, /**< IO_MUX_GPIO. */
195 APP_IO_MUX_1, /**< IO_MUX_I2C0_SCL. */
196 APP_IO_MUX_2, /**< IO_MUX_I2C0_SDA. */
197 APP_IO_MUX_3, /**< IO_MUX_I2C1_SCL. */
198 APP_IO_MUX_4, /**< IO_MUX_I2C1_SDA. */
199 APP_IO_MUX_5, /**< IO_MUX_UART0_CTS. */
200 APP_IO_MUX_6, /**< IO_MUX_UART0_RTS. */
201 APP_IO_MUX_7, /**< IO_MUX_UART0_TX. */
202 APP_IO_MUX_8, /**< IO_MUX_UART0_RX. */
203 APP_IO_MUX_9, /**< IO_MUX_UART1_CTS. */
204 APP_IO_MUX_10, /**< IO_MUX_UART1_RTS. */
205 APP_IO_MUX_11, /**< IO_MUX_UART1_TX. */
206 APP_IO_MUX_12, /**< IO_MUX_UART1_RX.*/
207 APP_IO_MUX_13, /**< IO_MUX_PWM0. */
208 APP_IO_MUX_14, /**< IO_MUX_PWM1. */
209 APP_IO_MUX_15, /**< IO_MUX_PWM2. */
210 APP_IO_MUX_16, /**< IO_MUX_PWM3. */
211 APP_IO_MUX_17, /**< IO_MUX_PWM4. */
212 APP_IO_MUX_18, /**< IO_MUX_PWM5. */
213 APP_IO_MUX_19, /**< IO_MUX_df_ant_sw_0.*/
214 APP_IO_MUX_20, /**< IO_MUX_df_ant_sw_1.*/
215 APP_IO_MUX_21, /**< IO_MUX_df_ant_sw_2.*/
216 APP_IO_MUX_22, /**< IO_MUX_df_ant_sw_3.*/
217 APP_IO_MUX_23, /**< IO_MUX_df_ant_sw_4.*/
218 APP_IO_MUX_24, /**< IO_MUX_df_ant_sw_5.*/
219 APP_IO_MUX_25, /**< IO_MUX_df_ant_sw_6.*/
220 APP_IO_MUX_26, /**< IO_MUX_ferp_gpio_trig_0.*/
221 APP_IO_MUX_27, /**< IO_MUX_SWO.*/
222 APP_IO_MUX_28, /**< IO_MUX_coex_ble_rx.*/
223 APP_IO_MUX_29, /**< IO_MUX_coex_ble_tx.*/
224 APP_IO_MUX_30, /**< IO_MUX_coex_wlan_rx.*/
225 APP_IO_MUX_31, /**< IO_MUX_coex_wlan_tx.*/
226 APP_IO_MUX_32, /**< IO_MUX_coex_ble_in_process.*/
227 APP_IO_MUX_33, /**< IO_MUX_SWD_CLK.*/
228 APP_IO_MUX_34, /**< IO_MUX_SWD_DATA.*/
229 APP_IO_MUX_35, /**< IO_MUX_reserve3.*/
230 APP_IO_MUX_36, /**< IO_MUX_reserve4.*/
231 APP_IO_MUX_37, /**< IO_MUX_reserve5.*/
232 APP_IO_MUX_38, /**< IO_MUX_SPI_S_MOSI.*/
233 APP_IO_MUX_39, /**< IO_MUX_SPI_S_CS_N.*/
234 APP_IO_MUX_40, /**< IO_MUX_SPI_S_CLK.*/
235 APP_IO_MUX_41, /**< IO_MUX_SPI_S_MISO.*/
236 APP_IO_MUX_42, /**< IO_MUX_SPI_M_CLK.*/
237 APP_IO_MUX_43, /**< IO_MUX_SPI_M_CS0_N.*/
238 APP_IO_MUX_44, /**< IO_MUX_SPI_M_CS1_N.*/
239 APP_IO_MUX_45, /**< IO_MUX_SPI_M_MISO.*/
240 APP_IO_MUX_46, /**< IO_MUX_SPI_M_MOSIss*/
241 APP_IO_MUX_47, /**< RESERVED */
242 APP_IO_MUX_48, /**< RESERVED */
243 APP_IO_MUX_49, /**< IO_MUX_DUAL_TIMER0_A */
244 APP_IO_MUX_50, /**< IO_MUX_DUAL_TIMER0_B */
245 APP_IO_MUX_51, /**< IO_MUX_DUAL_TIMER0_C */
246 APP_IO_MUX_52, /**< IO_MUX_DUAL_TIMER1_A */
247 APP_IO_MUX_53, /**< IO_MUX_DUAL_TIMER1_B */
248 APP_IO_MUX_54, /**< IO_MUX_DUAL_TIMER1_C */
249 APP_IO_MUX_MAX, /**< Only for check parameter, not used as input parameters. */
250 } app_io_mux_t;
251 #else
252 typedef enum
253 {
254 APP_IO_MUX_0, /**< IO mux mode 0. */
255 APP_IO_MUX_1, /**< IO mux mode 1. */
256 APP_IO_MUX_2, /**< IO mux mode 2. */
257 APP_IO_MUX_3, /**< IO mux mode 3. */
258 APP_IO_MUX_4, /**< IO mux mode 4. */
259 APP_IO_MUX_5, /**< IO mux mode 5. */
260 APP_IO_MUX_6, /**< IO mux mode 6. */
261 APP_IO_MUX_7, /**< IO mux mode 7. */
262 APP_IO_MUX_8, /**< IO mux mode 8. */
263 APP_IO_MUX_MAX, /**< Only for check parameter, not used as input parameters. */
264 } app_io_mux_t;
265 #endif
266
267 /**
268 * @brief GPIO mux for different APP_DRIVER_CHIP_TYPE
269 */
270 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X)
271 #define APP_IO_MUX APP_IO_MUX_0 /**< IO mux for GR5332X. */
272 #elif (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)
273 #define APP_IO_MUX APP_IO_MUX_8 /**< IO mux for GR5525X. */
274 #else
275 #define APP_IO_MUX APP_IO_MUX_7 /**< IO mux for others. */
276 #endif
277
278 /** @} */
279
280 /** @addtogroup APP_GPIO_STRUCT Structures
281 * @{
282 */
283 /**
284 * @brief GPIO parameter structure definition
285 */
286 typedef struct
287 {
288 uint32_t pin; /**< Specifies the IO pins to be configured.
289 This parameter can be any value of @ref GR5xxx_pins */
290 app_io_mode_t mode; /**< Specifies the operating mode for the selected pins. */
291 app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */
292 app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */
293 } app_io_init_t;
294 /** @} */
295
296 /**
297 * @brief GPIO Interrupt event Structure definition
298 */
299 typedef struct
300 {
301 app_io_type_t type; /**< Type of event. */
302 uint32_t pin; /**< Specifies the IO pins to be configured. */
303 void *arg; /**< User parameters */
304 } app_io_evt_t;
305
306 /**
307 * @brief GPIO Speed Structure definition
308 */
309 typedef enum {
310 APP_IO_SPPED_MEDIUM, /**< Select medium speed. */
311 APP_IO_SPPED_HIGH, /**< Select high speed. */
312 APP_IO_SPPED_MAX /**< Only for check parameter, not used as input parameters. */
313 } app_io_speed_t;
314
315
316 /**
317 * @brief GPIO Input type Structure definition
318 */
319 typedef enum {
320 APP_IO_INPUT_TYPE_CMOS, /**< Select CMOS input. */
321 APP_IO_INPUT_TYPE_SCHMITT, /**< Select Schmitt input. */
322 APP_IO_INPUT_TYPE_MAX /**< Only for check parameter, not used as input parameters. */
323 } app_io_input_type_t;
324
325 /**
326 * @brief GPIO Strength Structure definition
327 */
328 typedef enum {
329 APP_IO_STRENGTH_LOW, /**< Select low output driver strength */
330 APP_IO_STRENGTH_MEDIUM, /**< Select medium output driver strength */
331 APP_IO_STRENGTH_HIGH, /**< Select high output driver strength */
332 APP_IO_STRENGTH_ULTRA, /**< Select high output driver strength */
333 APP_IO_STRENGTH_MAX, /**< Only for check parameter, not used as input parameters. */
334 } app_io_strength_t;
335
336 /**
337 * @brief GPIO callback type.
338 */
339 typedef void (*app_io_callback_t)(app_io_evt_t *p_evt);
340
341
342 /* Exported functions --------------------------------------------------------*/
343 /** @addtogroup HAL_APP_GPIO_DRIVER_FUNCTIONS Functions
344 * @{
345 */
346 /**
347 ****************************************************************************************
348 * @brief Initialize the APP GPIO DRIVER according to the specified parameters
349 * in the app_io_type_t and app_io_init_t.
350 *
351 * @param[in] type: GPIO type.
352 * @param[in] p_init: Pointer to app_io_init_t parameter which contains the
353 * configuration information for the specified GPIO.
354 *
355 * @return Result of initialization.
356 ****************************************************************************************
357 */
358 uint16_t app_io_init(app_io_type_t type, app_io_init_t *p_init);
359
360 /**
361 ****************************************************************************************
362 * @brief De-initialize the GPIOx peripheral.
363 *
364 * @param[in] type: GPIO type, See app_io_type_t.
365 * @param[in] pin: The pin want to De-initialization.
366 *
367 * @return Result of De-initialization.
368 ****************************************************************************************
369 */
370 uint16_t app_io_deinit(app_io_type_t type, uint32_t pin);
371
372 /**
373 ****************************************************************************************
374 * @brief Read the specified input port pin..
375 *
376 * @param[in] type: GPIO type, See app_io_type_t.
377 * @param[in] pin: The pin want to read.
378 *
379 * @return The GPIO state.
380 ****************************************************************************************
381 */
382 app_io_pin_state_t app_io_read_pin(app_io_type_t type, uint32_t pin);
383
384 /**
385 ****************************************************************************************
386 * @brief Set or clear the selected data port bit.
387 *
388 * @param[in] type: GPIO type, See app_io_type_t.
389 * @param[in] pin: The pin want to set or clear.
390 * @param[in] pin_state: Specifies the value to be written to the selected bit.
391 *
392 * @return Result of write.
393 ****************************************************************************************
394 */
395 uint16_t app_io_write_pin(app_io_type_t type, uint32_t pin, app_io_pin_state_t pin_state);
396
397 /**
398 ****************************************************************************************
399 * @brief Toggle the specified GPIO pin.
400 *
401 * @param[in] type: GPIO type, See app_io_type_t.
402 * @param[in] pin: The pin want to toggle.
403 *
404 * @return Result of toggle.
405 ****************************************************************************************
406 */
407 uint16_t app_io_toggle_pin(app_io_type_t type, uint32_t pin);
408
409 /**
410 ****************************************************************************************
411 * @brief Set the speed of the GPIO.
412 *
413 * @param[in] type: GPIO type, See app_io_type_t.
414 * @param[in] pin: The pin want to set.
415 * @param[in] speed: GPIO speed type, See app_io_speed_t.
416 *
417 * @return Result of seting.
418 ****************************************************************************************
419 */
420 uint16_t app_io_set_speed(app_io_type_t type, uint32_t pin, app_io_speed_t speed);
421
422 /**
423 ****************************************************************************************
424 * @brief Set the strength of the GPIO.
425 *
426 * @param[in] type: GPIO type, See app_io_type_t.
427 * @param[in] pin: The pin want to set.
428 * @param[in] strength: GPIO strength type, See app_io_strength_t.
429 *
430 * @return Result of seting.
431 ****************************************************************************************
432 */
433 uint16_t app_io_set_strength(app_io_type_t type, uint32_t pin, app_io_strength_t strength);
434
435 /**
436 ****************************************************************************************
437 * @brief Set the input type of the GPIO.
438 *
439 * @param[in] type: GPIO type, See app_io_type_t.
440 * @param[in] pin: The pin want to toggle.
441 * @param[in] input_type: GPIO input type, See app_io_input_type_t.
442 *
443 * @return Result of seting.
444 ****************************************************************************************
445 */
446 uint16_t app_io_set_intput_type(app_io_type_t type, uint32_t pin, app_io_input_type_t input_type);
447
448 /**
449 ****************************************************************************************
450 * @brief Initialize GPIO to interrupt mode and register interrupt callback function.
451 *
452 * @param[in] type: GPIO type, See app_io_type_t.
453 * @param[in] p_init: Pointer to app_io_init_t parameter which contains the
454 * configuration information for the specified GPIO.
455 * @param[in] io_evt_cb: Interrupt callback function.
456 * @param[in] arg: User parameters.
457 *
458 * @return Result of register.
459 ****************************************************************************************
460 */
461 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);
462
463 /**
464 ****************************************************************************************
465 * @brief Deinitialize GPIO to normal mode and unregister interrupt.
466 *
467 * @param[in] type: GPIO type, See app_io_type_t.
468 * @param[in] pin: The pin want to unregister.
469 *
470 * @return Result of unregister.
471 ****************************************************************************************
472 */
473 uint16_t app_io_event_unregister(app_io_type_t type, uint32_t pin);
474
475 /** @} */
476 #endif
477
478 /** @} */
479
480 /** @} */
481
482 /** @} */
483
484 /** @} */
485
APP_IO_MUX_1
@ APP_IO_MUX_1
IO mux mode 1.
Definition: app_io.h:255
app_io_callback_t
void(* app_io_callback_t)(app_io_evt_t *p_evt)
GPIO callback type.
Definition: app_io.h:339
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:260
app_io_init_t::mode
app_io_mode_t mode
Specifies the operating mode for the selected pins.
Definition: app_io.h:290
app_io_evt_t
GPIO Interrupt event Structure definition.
Definition: app_io.h:300
APP_IO_INPUT_TYPE_MAX
@ APP_IO_INPUT_TYPE_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:322
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:171
APP_IO_MODE_ANALOG
@ APP_IO_MODE_ANALOG
Analog IO Mode.
Definition: app_io.h:173
APP_IO_NOPULL
@ APP_IO_NOPULL
No Pull-up or Pull-down activation.
Definition: app_io.h:182
app_io_input_type_t
app_io_input_type_t
GPIO Input type Structure definition.
Definition: app_io.h:319
APP_IO_MUX_4
@ APP_IO_MUX_4
IO mux mode 4.
Definition: app_io.h:258
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:166
APP_IO_MODE_MAX
@ APP_IO_MODE_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:174
app_io_speed_t
app_io_speed_t
GPIO Speed Structure definition.
Definition: app_io.h:309
app_io_deinit
uint16_t app_io_deinit(app_io_type_t type, uint32_t pin)
De-initialize the GPIOx peripheral.
APP_IO_SPPED_MEDIUM
@ APP_IO_SPPED_MEDIUM
Select medium speed.
Definition: app_io.h:310
app_io_pull_t
app_io_pull_t
GPIO pull Enumerations definition.
Definition: app_io.h:181
app_io_type_t
app_io_type_t
GPIO type Enumerations definition.
Definition: app_io.h:145
APP_IO_MUX_7
@ APP_IO_MUX_7
IO mux mode 7.
Definition: app_io.h:261
APP_IO_MODE_OUTPUT
@ APP_IO_MODE_OUTPUT
Output Mode.
Definition: app_io.h:164
APP_IO_TYPE_AON
@ APP_IO_TYPE_AON
Always-on Input/Output.
Definition: app_io.h:152
app_io_mode_t
app_io_mode_t
GPIO mode Enumerations definition.
Definition: app_io.h:161
APP_IO_STRENGTH_MEDIUM
@ APP_IO_STRENGTH_MEDIUM
Select medium output driver strength.
Definition: app_io.h:330
APP_IO_MUX_8
@ APP_IO_MUX_8
IO mux mode 8.
Definition: app_io.h:262
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:291
APP_IO_INPUT_TYPE_SCHMITT
@ APP_IO_INPUT_TYPE_SCHMITT
Select Schmitt input.
Definition: app_io.h:321
APP_IO_PULL_MAX
@ APP_IO_PULL_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:185
APP_IO_PIN_RESET
@ APP_IO_PIN_RESET
IO pin low level.
Definition: app_io.h:137
APP_IO_MODE_NONE
@ APP_IO_MODE_NONE
Definition: app_io.h:162
APP_IO_MODE_IT_FALLING
@ APP_IO_MODE_IT_FALLING
Interrupt Mode with Falling edge trigger detection.
Definition: app_io.h:167
APP_IO_TYPE_NORMAL
@ APP_IO_TYPE_NORMAL
General Purpose Input/Output.
Definition: app_io.h:150
APP_IO_PULLUP
@ APP_IO_PULLUP
Pull-up activation.
Definition: app_io.h:183
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:153
APP_IO_MUX_MAX
@ APP_IO_MUX_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:263
APP_IO_MUX_3
@ APP_IO_MUX_3
IO mux mode 3.
Definition: app_io.h:257
app_io_strength_t
app_io_strength_t
GPIO Strength Structure definition.
Definition: app_io.h:328
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_MUX_5
@ APP_IO_MUX_5
IO mux mode 5.
Definition: app_io.h:259
APP_IO_MUX_0
@ APP_IO_MUX_0
IO mux mode 0.
Definition: app_io.h:254
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:256
APP_IO_STRENGTH_LOW
@ APP_IO_STRENGTH_LOW
Select low output driver strength.
Definition: app_io.h:329
APP_IO_STRENGTH_MAX
@ APP_IO_STRENGTH_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:333
APP_IO_MODE_INPUT
@ APP_IO_MODE_INPUT
Input Mode.
Definition: app_io.h:163
app_io_evt_t::arg
void * arg
User parameters.
Definition: app_io.h:303
APP_IO_PIN_SET
@ APP_IO_PIN_SET
IO pin high level.
Definition: app_io.h:138
APP_IO_PULLDOWN
@ APP_IO_PULLDOWN
Pull-down activation.
Definition: app_io.h:184
APP_IO_TYPE_MAX
@ APP_IO_TYPE_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:154
APP_IO_STRENGTH_HIGH
@ APP_IO_STRENGTH_HIGH
Select high output driver strength.
Definition: app_io.h:331
APP_IO_SPPED_MAX
@ APP_IO_SPPED_MAX
Only for check parameter, not used as input parameters.
Definition: app_io.h:312
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:136
app_io_evt_t::type
app_io_type_t type
Type of event.
Definition: app_io.h:301
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_toggle_pin
uint16_t app_io_toggle_pin(app_io_type_t type, uint32_t pin)
Toggle the specified GPIO pin.
app_io_mux_t
app_io_mux_t
GPIO mux Enumerations definition.
Definition: app_io.h:253
APP_IO_TYPE_GPIOA
@ APP_IO_TYPE_GPIOA
General Purpose Input/Output.
Definition: app_io.h:146
app_io_init_t::mux
app_io_mux_t mux
Specifies the Peripheral to be connected to the selected pins.
Definition: app_io.h:292
APP_IO_MODE_MUX
@ APP_IO_MODE_MUX
Mux Mode.
Definition: app_io.h:165
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:302
APP_IO_SPPED_HIGH
@ APP_IO_SPPED_HIGH
Select high speed.
Definition: app_io.h:311
app_drv_config.h
Header file of app driver config code.
APP_IO_INPUT_TYPE_CMOS
@ APP_IO_INPUT_TYPE_CMOS
Select CMOS input.
Definition: app_io.h:320
APP_IO_TYPE_GPIOC
@ APP_IO_TYPE_GPIOC
General Purpose Input/Output.
Definition: app_io.h:148
APP_IO_TYPE_GPIOB
@ APP_IO_TYPE_GPIOB
General Purpose Input/Output.
Definition: app_io.h:147
APP_IO_MODE_IT_LOW
@ APP_IO_MODE_IT_LOW
Interrupt Mode with Low-level trigger detection.
Definition: app_io.h:172
app_io_init_t
GPIO parameter structure definition.
Definition: app_io.h:287
APP_IO_STRENGTH_ULTRA
@ APP_IO_STRENGTH_ULTRA
Select high output driver strength.
Definition: app_io.h:332
app_io_init_t::pin
uint32_t pin
Specifies the IO pins to be configured.
Definition: app_io.h:288