TM STM32Fxxx HAL Libraries  v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle

Library Functions. More...

Macros

#define TM_EXTI_SoftwareInterrupt(GPIO_Line)   (EXTI->SWIER |= (GPIO_Line))
 Creates software interrupt for specific external GPIO line. More...
 

Functions

TM_EXTI_Result_t TM_EXTI_Attach (GPIO_TypeDef *GPIOx, uint16_t GPIO_Line, TM_EXTI_Trigger_t trigger)
 Attach external interrupt on specific GPIO pin. More...
 
TM_EXTI_Result_t TM_EXTI_Detach (uint16_t GPIO_Line)
 Detach GPIO pin from interrupt lines. More...
 
void TM_EXTI_DeInit (void)
 Clears all interrupts on EXTI line. More...
 
void TM_EXTI_Handler (uint16_t GPIO_Pin)
 EXTI Global handler. More...
 

Detailed Description

Library Functions.

Macro Definition Documentation

#define TM_EXTI_SoftwareInterrupt (   GPIO_Line)    (EXTI->SWIER |= (GPIO_Line))

Creates software interrupt for specific external GPIO line.

Note
This also works for others EXTI lines from 16 to 23
Parameters
GPIO_LineGPIO line where you want software interrupt
Return values
None
Note
Defined as macro for faster execution

Function Documentation

TM_EXTI_Result_t TM_EXTI_Attach ( GPIO_TypeDef *  GPIOx,
uint16_t  GPIO_Line,
TM_EXTI_Trigger_t  trigger 
)

Attach external interrupt on specific GPIO pin.

Note
This function automatically enables the clock for GPIO peripheral and also sets pull resistors depending on trigger you use.
  • Falling edge: pull up is enabled
  • Rising edge: pull down is enabled
  • Any edge: no pull activated
You can attach only one GPIOx to specific GPIO_PIN. In other words, GPIO_PIN_5 can not be attached to GPIOA and GPIOB at the same time. If you will try that, my function will return error to you, because you have to detach GPIO_Line first and attach back on other GPIO port.
Parameters
*GPIOxGPIO port where you want EXTI interrupt line
GPIO_LineGPIO pin where you want EXTI interrupt line. Use OR (|) operator if you want to attach interrupt on more than one GPIO pin at the same GPIOx at the same time.
triggerPin trigger source. This parameter can be a value of TM_EXTI_Trigger_t enumeration
Return values
Attachresult:
    • TM_EXTI_Result_Ok: Everything ok, interrupt attached
    • TM_EXTI_Result_Error: An error occurred, interrupt was not attached
Note
If you use more than one GPIO_Pin with OR (|) operator at single call and if GPIO_Pin can't be attached because there is already one GPIO_Pin at this line, function will return error and other pins might not be initialized. If function return
  • TM_EXTI_Result_Ok, then all pins are attached correctly.
void TM_EXTI_DeInit ( void  )

Clears all interrupts on EXTI line.

Note
It clears bits for external pins (bit 0 to bit 15) only! It has no effect for internally connected peripherals (like RTC) to EXTI line
Parameters
None
Return values
None
TM_EXTI_Result_t TM_EXTI_Detach ( uint16_t  GPIO_Line)

Detach GPIO pin from interrupt lines.

Parameters
GPIO_LineGPIO line you want to disable. Valid GPIO is GPIO_Pin_0 to GPIO_Pin_15. Use OR (|) operator if you want to detach interrupt in more than one GPIO pin at the same GPIOx at the same time.
Return values
Detachingresult:
    • TM_EXTI_Result_Ok: Everything ok
    • TM_EXTI_Result_Error: An error occurred
void TM_EXTI_Handler ( uint16_t  GPIO_Pin)

EXTI Global handler.

Note
This function is called from TM EXTI library each time any interrupt occurs on EXTI line.
With __weak parameter to prevent link errors if not defined by user.
Parameters
GPIO_PinGPIO Line where interrupt occurred so you can identify what to do
Return values
None