15#define EXTI_LINE_UNUSED (19U)
50 else if (port ==
GPIOB)
54 else if (port ==
GPIOC)
58 else if (port ==
GPIOD)
62 else if (port ==
GPIOE)
66 else if (port ==
GPIOF)
70 else if (port ==
GPIOG)
74 else if (port ==
GPIOH)
88 uint32_t selector = 0U;
108 uint32_t index = line / 4U;
109 uint32_t shift = (line % 4U) * 4U;
112 (syscfg->
EXTICR[index] & ~((uint32_t)0xFU << shift)) | (selector << shift);
130 uint32_t bit = (uint32_t)1U << line;
160 exti->
IMR |= (uint32_t)1U << line;
172 exti->
IMR &= ~((uint32_t)1U << line);
185 exti->
SWIER |= (uint32_t)1U << line;
202 *pending = ((exti->
PR & ((uint32_t)1U << line)) != 0U);
216 exti->
PR = (uint32_t)1U << line;
EXTI driver: route a GPIO pin to an EXTI line, choose its edges, and manage its interrupt and pending...
DriverStatus_e
Outcome of a driver call: a category for control flow, not a diagnosis.
@ DRIVER_STATUS_OK
Succeeded.
@ DRIVER_STATUS_ERR_INVALID_PARAM
A parameter is outside its valid domain.
#define EXTI_LINE_MAX
Highest EXTI line on the F446.
DRIVER_MUST_CHECK DriverStatus_e extiIsPending(const ExtiRegisters_t *exti, uint32_t line, bool *pending)
Report whether line's pending bit (PR) is set.
ExtiEdge_e
Which edges of a line's input set its pending bit.
DRIVER_MUST_CHECK DriverStatus_e extiTriggerSoftware(ExtiRegisters_t *exti, uint32_t line)
Raise line's interrupt from software (SWIER).
DRIVER_MUST_CHECK DriverStatus_e extiSelectPort(SyscfgRegisters_t *syscfg, uint32_t line, const GpioRegisters_t *port)
Route GPIO pin line of port to EXTI line line.
DRIVER_MUST_CHECK DriverStatus_e extiDisableInterrupt(ExtiRegisters_t *exti, uint32_t line)
Mask line's interrupt (IMR).
DRIVER_MUST_CHECK DriverStatus_e extiClearPending(ExtiRegisters_t *exti, uint32_t line)
Clear line's pending bit, and its SWIER bit with it.
DRIVER_MUST_CHECK DriverStatus_e extiEnableInterrupt(ExtiRegisters_t *exti, uint32_t line)
Unmask line's interrupt (IMR).
static DriverStatus_e extiPortSelector(const GpioRegisters_t *port, uint32_t *selector)
Map a GPIO port to its EXTICR selector.
static DriverStatus_e extiValidateLine(uint32_t line)
Accept a line that exists: 0 to EXTI_LINE_MAX, except 19.
#define EXTI_GPIO_LINE_MAX
Highest line fed by a GPIO pin.
DRIVER_MUST_CHECK DriverStatus_e extiConfigure(ExtiRegisters_t *exti, uint32_t line, ExtiEdge_e edge)
Set which edges trigger line; the other edge is cleared.
#define EXTI_LINE_UNUSED
The line with no source on the F446 (RM0390 section 10.2.5).
@ EXTI_EDGE_RISING
Rising edge only (RTSR).
@ EXTI_EDGE_BOTH
Both edges.
@ EXTI_EDGE_FALLING
Falling edge only (FTSR).
#define SYSCFG_EXTICR_PE
GPIOE.
#define SYSCFG_EXTICR_PD
GPIOD.
#define SYSCFG_EXTICR_PH
GPIOH.
#define SYSCFG_EXTICR_PG
GPIOG.
#define SYSCFG_EXTICR_PF
GPIOF.
#define SYSCFG_EXTICR_PB
GPIOB.
#define SYSCFG_EXTICR_PC
GPIOC.
#define SYSCFG_EXTICR_PA
GPIOA.
volatile uint32_t SWIER
0x10: software interrupt trigger
volatile uint32_t PR
0x14: pending, <span class="regaccess">rc_w1</span>
volatile uint32_t FTSR
0x0C: falling-edge trigger
volatile uint32_t IMR
0x00: interrupt mask (1 = enabled)
volatile uint32_t RTSR
0x08: rising-edge trigger
GPIO port register block.
volatile uint32_t EXTICR[4]
0x08-0x14: EXTI line routing, 4 lines per register