Go to the documentation of this file.
52 #ifndef __GR55xx_HAL_GPIO_H__
53 #define __GR55xx_HAL_GPIO_H__
147 #define GPIO_PIN_0 ((uint16_t)0x0001U)
148 #define GPIO_PIN_1 ((uint16_t)0x0002U)
149 #define GPIO_PIN_2 ((uint16_t)0x0004U)
150 #define GPIO_PIN_3 ((uint16_t)0x0008U)
151 #define GPIO_PIN_4 ((uint16_t)0x0010U)
152 #define GPIO_PIN_5 ((uint16_t)0x0020U)
153 #define GPIO_PIN_6 ((uint16_t)0x0040U)
154 #define GPIO_PIN_7 ((uint16_t)0x0080U)
155 #define GPIO_PIN_8 ((uint16_t)0x0100U)
156 #define GPIO_PIN_9 ((uint16_t)0x0200U)
157 #define GPIO_PIN_10 ((uint16_t)0x0400U)
158 #define GPIO_PIN_11 ((uint16_t)0x0800U)
159 #define GPIO_PIN_12 ((uint16_t)0x1000U)
160 #define GPIO_PIN_13 ((uint16_t)0x2000U)
161 #define GPIO_PIN_14 ((uint16_t)0x4000U)
162 #define GPIO_PIN_15 ((uint16_t)0x8000U)
163 #define GPIO_PIN_ALL ((uint16_t)0xFFFFU)
165 #define GPIO_PIN_MASK (0x0000FFFFU)
175 #define GPIO_MODE_NONE (LL_GPIO_MODE_NONE << 0)
176 #define GPIO_MODE_INPUT (LL_GPIO_MODE_INPUT << 0)
177 #define GPIO_MODE_OUTPUT (LL_GPIO_MODE_OUTPUT << 0)
178 #define GPIO_MODE_MUX (LL_GPIO_MODE_INOUT << 0)
179 #define GPIO_MODE_IT_RISING (LL_GPIO_TRIGGER_RISING << 4 | GPIO_MODE_INPUT )
180 #define GPIO_MODE_IT_FALLING (LL_GPIO_TRIGGER_FALLING << 4 | GPIO_MODE_INPUT)
181 #define GPIO_MODE_IT_HIGH (LL_GPIO_TRIGGER_HIGH << 4 | GPIO_MODE_INPUT)
182 #define GPIO_MODE_IT_LOW (LL_GPIO_TRIGGER_LOW << 4 | GPIO_MODE_INPUT)
183 #define GPIO_MODE_IT_BOTH_EDGE (LL_GPIO_TRIGGER_BOTH_EDGE << 4 | GPIO_MODE_INPUT)
191 #define GPIO_NOPULL LL_GPIO_PULL_NO
192 #define GPIO_PULLUP LL_GPIO_PULL_UP
193 #define GPIO_PULLDOWN LL_GPIO_PULL_DOWN
200 #define GPIO_SPEED_MEDIUM LL_GPIO_SPEED_MEDIUM
201 #define GPIO_SPEED_HIGH LL_GPIO_SPEED_HIGH
208 #define GPIO_STRENGTH_LOW LL_GPIO_STRENGTH_LOW
209 #define GPIO_STRENGTH_MEDIUM LL_GPIO_STRENGTH_MEDIUM
210 #define GPIO_STRENGTH_HIGH LL_GPIO_STRENGTH_HIGH
211 #define GPIO_STRENGTH_ULTRA LL_GPIO_STRENGTH_ULTRA
218 #define GPIO_INPUT_TYPE_CMOS LL_GPIO_INPUT_TYPE_CMOS
219 #define GPIO_INPUT_TYPE_SCHMITT LL_GPIO_INPUT_TYPE_SCHMITT
224 #define GPIO_DEFAULT_CONFIG \
226 .pin = GPIO_PIN_ALL, \
227 .mode = GPIO_MODE_INPUT, \
228 .pull = GPIO_PULLDOWN, \
230 .speed = GPIO_SPEED_MEDIUM, \
231 .strength = GPIO_STRENGTH_MEDIUM, \
232 .input_type = GPIO_INPUT_TYPE_CMOS, \
249 #define __HAL_GPIO_IT_GET_IT(__GPIOX__, __GPIO_PIN__) ll_gpio_read_flag_it(__GPIOX__, __GPIO_PIN__)
258 #define __HAL_GPIO_IT_CLEAR_IT(__GPIOX__, __GPIO_PIN__) ll_gpio_clear_flag_it(__GPIOX__, __GPIO_PIN__)
272 #define IS_GPIO_PIN_ACTION(__ACTION__) (((__ACTION__) == GPIO_PIN_RESET) || ((__ACTION__) == GPIO_PIN_SET))
279 #define IS_GPIO_PIN(__PIN__) ((((__PIN__) & GPIO_PIN_MASK) != 0x00U) &&\
280 (((__PIN__) & ~GPIO_PIN_MASK) == 0x00U))
288 #define IS_GPIO_MODE(__MODE__) (((__MODE__) == GPIO_MODE_INPUT) ||\
289 ((__MODE__) == GPIO_MODE_OUTPUT) ||\
290 ((__MODE__) == GPIO_MODE_MUX) ||\
291 ((__MODE__) == GPIO_MODE_IT_RISING) ||\
292 ((__MODE__) == GPIO_MODE_IT_FALLING) ||\
293 ((__MODE__) == GPIO_MODE_IT_HIGH) ||\
294 ((__MODE__) == GPIO_MODE_IT_LOW) ||\
295 ((__MODE__) == GPIO_MODE_IT_BOTH_EDGE))
302 #define IS_GPIO_PULL(__PULL__) (((__PULL__) == GPIO_NOPULL) ||\
303 ((__PULL__) == GPIO_PULLUP) || \
304 ((__PULL__) == GPIO_PULLDOWN))
gpio_pin_state_t
GPIO Bit SET and Bit RESET Enumerations.
void hal_gpio_exti_callback(gpio_regs_t *GPIOx, uint16_t gpio_pin)
GPIO pin detection callback.
struct _hal_gpio_callback hal_gpio_callback_t
HAL_GPIO Callback function definition.
void hal_gpio_init(gpio_regs_t *GPIOx, gpio_init_t *p_gpio_init)
Initialize the GPIOx peripheral according to the specified parameters in the p_gpio_init.
HAL_GPIO Callback function definition.
Header file containing functions prototypes of GPIO LL library.
gpio_pin_state_t hal_gpio_read_pin(gpio_regs_t *GPIOx, uint16_t gpio_pin)
Read the specified input port pin.
void hal_gpio_toggle_pin(gpio_regs_t *GPIOx, uint16_t gpio_pin)
Toggle the specified GPIO pin.
void hal_gpio_exti_irq_handler(gpio_regs_t *GPIOx)
Handle GPIO interrupt request.
GPIO init structure definition.
Header file containing extended macro of GPIO HAL library.
void(* gpio_callback)(gpio_regs_t *GPIOx, uint16_t gpio_pin)
void hal_gpio_deinit(gpio_regs_t *GPIOx, uint32_t gpio_pin)
De-initialize the GPIOx peripheral registers to their default reset values.
void hal_gpio_write_pin(gpio_regs_t *GPIOx, uint16_t gpio_pin, gpio_pin_state_t pin_state)
Set or clear the selected data port bit.
struct _gpio_init gpio_init_t
GPIO init structure definition.
This file contains HAL common definitions, enumeration, macros and structures definitions.