PER Firmware
Loading...
Searching...
No Matches
exti.h File Reference

G4 EXTI public API. More...

#include <stddef.h>
#include <stdint.h>
#include "stm32g474xx.h"
Include dependency graph for exti.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PHAL_EXTI_InitConfig_t
 Configuration for one GPIO-backed EXTI line. More...
 

Enumerations

enum  PHAL_EXTI_Trigger_t : uint8_t { PHAL_EXTI_TRIGGER_RISING = 0U , PHAL_EXTI_TRIGGER_FALLING = 1U , PHAL_EXTI_TRIGGER_BOTH = 2U }
 GPIO edge or edges that generate an EXTI interrupt. More...
 

Functions

bool PHAL_EXTI_init (const PHAL_EXTI_InitConfig_t config[], size_t config_len)
 Configure GPIO EXTI lines from a configuration table.
 
bool PHAL_EXTI_deinit (GPIO_TypeDef *bank, uint8_t pin)
 Disable a configured GPIO EXTI line.
 
void PHAL_EXTI_callback (GPIO_TypeDef *bank, uint8_t pin)
 Weak callback invoked for each pending GPIO EXTI line.
 

Detailed Description

G4 EXTI public API.

Author
Ronak Jain (jain7.nosp@m.17@p.nosp@m.urdue.nosp@m..edu)

Enumeration Type Documentation

◆ PHAL_EXTI_Trigger_t

enum PHAL_EXTI_Trigger_t : uint8_t

GPIO edge or edges that generate an EXTI interrupt.

Enumerator
PHAL_EXTI_TRIGGER_RISING 
PHAL_EXTI_TRIGGER_FALLING 
PHAL_EXTI_TRIGGER_BOTH 

Function Documentation

◆ PHAL_EXTI_callback()

void PHAL_EXTI_callback ( GPIO_TypeDef * bank,
uint8_t pin )
extern

Weak callback invoked for each pending GPIO EXTI line.

Called from an EXTI interrupt handler. Keep overrides short and non-blocking. For both-edge triggers, sample the GPIO input to determine its current level. The default implementation does nothing.

Parameters
bankGPIO port that generated the interrupt
pinPin number, 0-15
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_EXTI_deinit()

bool PHAL_EXTI_deinit ( GPIO_TypeDef * bank,
uint8_t pin )

Disable a configured GPIO EXTI line.

The line is disabled only when its current SYSCFG route matches bank/pin. A shared NVIC interrupt is disabled when no GPIO EXTI lines in its group remain enabled.

Parameters
bankGPIO port containing the input pin
pinPin number, 0-15
Returns
true if the route matched and the line was disabled; false otherwise
Here is the call graph for this function:

◆ PHAL_EXTI_init()

bool PHAL_EXTI_init ( const PHAL_EXTI_InitConfig_t config[],
size_t config_len )

Configure GPIO EXTI lines from a configuration table.

Configure the corresponding GPIO pins as inputs separately with PHAL_GPIO_init(). Only pins 0-15 can be used, and each pin number can be routed from one GPIO port at a time. Configuring a line selects its port, trigger edge, interrupt mask, and shared NVIC interrupt. Entries are all validated before any line is changed; duplicate pin numbers are rejected. The IRQ priority is set from each entry's irq_priority. Lines 0-4 each have a separate IRQ; lines 5-9 share EXTI9_5_IRQn and lines 10-15 share EXTI15_10_IRQn. Entries sharing a vector must specify the same priority, including any already-enabled sibling lines. Priorities must fit the device's implemented NVIC priority bits.

Parameters
configArray of line configurations; may be nullptr when config_len is zero
config_lenNumber of entries in config
Returns
true if every configuration is valid and applied; false otherwise
Here is the call graph for this function:
Here is the caller graph for this function: