gr55xx_hal_aon_gpio.h
Go to the documentation of this file.
1 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_AON_GPIO_H__
53 #define __GR55xx_HAL_AON_GPIO_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_aon_gpio.h"
61 #include "gr55xx_hal_def.h"
62 
63 /* Exported types ------------------------------------------------------------*/
71 typedef enum
72 {
76 
86 typedef struct _aon_gpio_init
87 {
88  uint32_t pin;
91  uint32_t mode;
94  uint32_t pull;
97  uint32_t mux;
100 
114 typedef struct _aon_gpio_callback
115 {
116  void (*aon_gpio_callback)(uint16_t aon_gpio_pin);
118 
128 /* Exported constants --------------------------------------------------------*/
136 #define AON_GPIO_PIN_0 ((uint16_t)0x0001U)
137 #define AON_GPIO_PIN_1 ((uint16_t)0x0002U)
138 #define AON_GPIO_PIN_2 ((uint16_t)0x0004U)
139 #define AON_GPIO_PIN_3 ((uint16_t)0x0008U)
140 #define AON_GPIO_PIN_4 ((uint16_t)0x0010U)
141 #define AON_GPIO_PIN_5 ((uint16_t)0x0020U)
142 #define AON_GPIO_PIN_6 ((uint16_t)0x0040U)
143 #define AON_GPIO_PIN_7 ((uint16_t)0x0080U)
145 #define AON_GPIO_PIN_ALL ((uint16_t)0x00FFU)
147 #define AON_GPIO_PIN_MASK (0x000000FFU)
157 #define AON_GPIO_MODE_INPUT (LL_AON_GPIO_MODE_INPUT << 0)
158 #define AON_GPIO_MODE_OUTPUT (LL_AON_GPIO_MODE_OUTPUT << 0)
159 #define AON_GPIO_MODE_MUX (LL_GPIO_MODE_MUX << 0)
160 #define AON_GPIO_MODE_IT_RISING (LL_AON_GPIO_TRIGGER_RISING << 4)
161 #define AON_GPIO_MODE_IT_FALLING (LL_AON_GPIO_TRIGGER_FALLING << 4)
162 #define AON_GPIO_MODE_IT_HIGH (LL_AON_GPIO_TRIGGER_HIGH << 4)
163 #define AON_GPIO_MODE_IT_LOW (LL_AON_GPIO_TRIGGER_LOW << 4)
171 #define AON_GPIO_NOPULL LL_AON_GPIO_PULL_NO
172 #define AON_GPIO_PULLUP LL_AON_GPIO_PULL_UP
173 #define AON_GPIO_PULLDOWN LL_AON_GPIO_PULL_DOWN
179 #define AON_GPIO_DEFAULT_CONFIG \
180 { \
181  .pin = AON_GPIO_PIN_ALL, \
182  .mode = AON_GPIO_MODE_INPUT, \
183  .pull = AON_GPIO_PULLDOWN, \
184  .mux = AON_GPIO_MUX_7, \
185 }
186 
188 /* Exported macro ------------------------------------------------------------*/
199 #define __HAL_AON_GPIO_IT_GET_IT(__AON_GPIO_PIN__) ll_aon_gpio_read_flag_it(__AON_GPIO_PIN__)
200 
207 #define __HAL_AON_GPIO_IT_CLEAR_IT(__AON_GPIO_PIN__) ll_aon_gpio_clear_flag_it(__AON_GPIO_PIN__)
208 
211 /* Private macros ------------------------------------------------------------*/
221 #define IS_AON_GPIO_PIN_ACTION(__ACTION__) (((__ACTION__) == AON_GPIO_PIN_RESET) || ((__ACTION__) == AON_GPIO_PIN_SET))
222 
228 #define IS_AON_GPIO_PIN(__PIN__) ((((__PIN__) & AON_GPIO_PIN_MASK) != 0x00U) &&\
229  (((__PIN__) & ~AON_GPIO_PIN_MASK) == 0x00U))
230 
236 #define IS_AON_GPIO_MODE(__MODE__) (((__MODE__) == AON_GPIO_MODE_INPUT) ||\
237  ((__MODE__) == AON_GPIO_MODE_OUTPUT) ||\
238  ((__MODE__) == AON_GPIO_MODE_MUX) ||\
239  ((__MODE__) == AON_GPIO_MODE_IT_RISING) ||\
240  ((__MODE__) == AON_GPIO_MODE_IT_FALLING) ||\
241  ((__MODE__) == AON_GPIO_MODE_IT_HIGH) ||\
242  ((__MODE__) == AON_GPIO_MODE_IT_LOW))
243 
249 #define IS_AON_GPIO_PULL(__PULL__) (((__PULL__) == AON_GPIO_NOPULL) ||\
250  ((__PULL__) == AON_GPIO_PULLUP) || \
251  ((__PULL__) == AON_GPIO_PULLDOWN))
252 
257 /* Include AON GPIO HAL Extended module */
258 #include "gr55xx_hal_aon_gpio_ex.h"
259 
260 /* Exported functions --------------------------------------------------------*/
278 void hal_aon_gpio_init(aon_gpio_init_t *p_aon_gpio_init);
279 
295 void hal_aon_gpio_deinit(uint32_t aon_gpio_pin);
296 
321 
341 void hal_aon_gpio_write_pin(uint16_t aon_gpio_pin, aon_gpio_pin_state_t pin_state);
342 
358 void hal_aon_gpio_toggle_pin(uint16_t aon_gpio_pin);
359 
373 
392 void hal_aon_gpio_callback(uint16_t aon_gpio_pin);
393 
399 #ifdef __cplusplus
400 }
401 #endif
402 
403 #endif /* __GR55xx_HAL_AON_GPIO_H__ */
404 
aon_gpio_init_t
struct _aon_gpio_init aon_gpio_init_t
AON_GPIO init structure definition.
hal_aon_gpio_toggle_pin
void hal_aon_gpio_toggle_pin(uint16_t aon_gpio_pin)
Toggle the specified AON_GPIO pin.
hal_aon_gpio_deinit
void hal_aon_gpio_deinit(uint32_t aon_gpio_pin)
De-initialize the AON_GPIOx peripheral registers to their default reset values.
gr55xx_ll_aon_gpio.h
Header file containing functions prototypes of AON GPIO LL library.
aon_gpio_pin_state_t
aon_gpio_pin_state_t
AON_GPIO Bit SET and Bit RESET enumerations.
Definition: gr55xx_hal_aon_gpio.h:72
AON_GPIO_PIN_RESET
@ AON_GPIO_PIN_RESET
Definition: gr55xx_hal_aon_gpio.h:73
_aon_gpio_callback::aon_gpio_callback
void(* aon_gpio_callback)(uint16_t aon_gpio_pin)
Definition: gr55xx_hal_aon_gpio.h:116
hal_aon_gpio_write_pin
void hal_aon_gpio_write_pin(uint16_t aon_gpio_pin, aon_gpio_pin_state_t pin_state)
Set or clear the selected data port bit.
_aon_gpio_init::pin
uint32_t pin
Definition: gr55xx_hal_aon_gpio.h:88
_aon_gpio_callback
HAL AON_GPIO Callback function definition.
Definition: gr55xx_hal_aon_gpio.h:115
hal_aon_gpio_callback
void hal_aon_gpio_callback(uint16_t aon_gpio_pin)
AON GPIO pin detection callback.
AON_GPIO_PIN_SET
@ AON_GPIO_PIN_SET
Definition: gr55xx_hal_aon_gpio.h:74
aon_gpio_callback_t
struct _aon_gpio_callback aon_gpio_callback_t
HAL AON_GPIO Callback function definition.
_aon_gpio_init::mux
uint32_t mux
Definition: gr55xx_hal_aon_gpio.h:97
_aon_gpio_init::pull
uint32_t pull
Definition: gr55xx_hal_aon_gpio.h:94
_aon_gpio_init::mode
uint32_t mode
Definition: gr55xx_hal_aon_gpio.h:91
hal_aon_gpio_init
void hal_aon_gpio_init(aon_gpio_init_t *p_aon_gpio_init)
Initialize the AON_GPIOx peripheral according to the specified parameters in the aon_gpio_init_t.
_aon_gpio_init
AON_GPIO init structure definition.
Definition: gr55xx_hal_aon_gpio.h:87
hal_aon_gpio_irq_handler
void hal_aon_gpio_irq_handler(void)
Handle AON_GPIO interrupt request.
hal_aon_gpio_read_pin
aon_gpio_pin_state_t hal_aon_gpio_read_pin(uint16_t aon_gpio_pin)
Read the specified input port pin.
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
gr55xx_hal_aon_gpio_ex.h
Header file containing extended macro of AON GPIO HAL library.