ARMEBS4  revision-26.06.2015
Enumerations | Functions
Collaboration diagram for GPIO Interrupts:

Enumerations

enum  gpio_irq_mode_e {
  GPIO_IRQ_MODE_DISABLED,
  GPIO_IRQ_MODE_EDGE_FALLING,
  GPIO_IRQ_MODE_EDGE_RISING,
  GPIO_IRQ_MODE_EDGE_BOTH,
  GPIO_IRQ_MODE_LEVEL_LOW,
  GPIO_IRQ_MODE_LEVEL_HIGH
}
 

Functions

status_e gpio_irq_setup (const struct gpio_t *gpio, uint32_t(*handler)(const struct gpio_t *gpio), enum gpio_irq_mode_e mode, uint32_t prio)
 Setup interrupt on GPIO. More...
 
status_e gpio_irq_disable (const struct gpio_t *gpio)
 Disable a gpio interrupt. More...
 
status_e gpio_irq_restore (const struct gpio_t *gpio)
 Restore a gpio interrupt. More...
 

Detailed Description

Enumeration Type Documentation

Gpio IRQ modes

Enumerator
GPIO_IRQ_MODE_DISABLED 

Disabled.

GPIO_IRQ_MODE_EDGE_FALLING 

Falling edge.

GPIO_IRQ_MODE_EDGE_RISING 

Rising edge.

GPIO_IRQ_MODE_EDGE_BOTH 

Both edge.

GPIO_IRQ_MODE_LEVEL_LOW 

Level low (emulated)

GPIO_IRQ_MODE_LEVEL_HIGH 

Level high (emulated)

Definition at line 22 of file stm32_gpio_irq.h.

Function Documentation

status_e gpio_irq_setup ( const struct gpio_t gpio,
uint32_t(*)(const struct gpio_t *gpio)  handler,
enum gpio_irq_mode_e  mode,
uint32_t  prio 
)

Setup interrupt on GPIO.

Parameters
gpiothe gpio to use (will be configured)
handlerhandler's return value: see below
modegpio_irq_mode_e of the interrupt
priothe priority for the NVIC
Returns
NO_ERROR for no problem
Warning
GPIO_IRQ_MODE_LEVEL_LOW and GPIO_IRQ_MODE_LEVEL_HIGH interrupts are emulated.

When using GPIO_IRQ_MODE_LEVEL_LOW and GPIO_IRQ_MODE_LEVEL_HIGH, the handler will be called continuously unless the pin level change to the inactive level. Deferred processing is possible, the handler can return true, and the loop will break. The deferred handler MUST call gpio_irq_restore() after the interrupt has been handled to restore normal behavior.

Definition at line 217 of file stm32_gpio_irq.c.

References ARRAY_SIZE, gpio_t::ctrl, ERROR_BAD_PARAM, ERROR_BAD_SWITCH, EXTI_InitTypeDef::EXTI_Line, EXTI_InitTypeDef::EXTI_LineCmd, EXTI_InitTypeDef::EXTI_Mode, EXTI_InitTypeDef::EXTI_Trigger, gpio_get(), GPIO_IRQ_MODE_DISABLED, GPIO_IRQ_MODE_EDGE_BOTH, GPIO_IRQ_MODE_EDGE_FALLING, GPIO_IRQ_MODE_EDGE_RISING, GPIO_IRQ_MODE_LEVEL_HIGH, GPIO_IRQ_MODE_LEVEL_LOW, gpio_setup(), NO_ERROR, gpio_t::nr, NVIC_InitTypeDef::NVIC_IRQChannel, NVIC_InitTypeDef::NVIC_IRQChannelCmd, NVIC_InitTypeDef::NVIC_IRQChannelPreemptionPriority, and NVIC_InitTypeDef::NVIC_IRQChannelSubPriority.

Referenced by bsp_set_button_irq_handler(), and gpio_irq_disable().

Here is the call graph for this function:

Here is the caller graph for this function:

status_e gpio_irq_disable ( const struct gpio_t gpio)

Disable a gpio interrupt.

Parameters
gpiothe gpio to use
Returns
NO_ERROR for no problem

Definition at line 44 of file stm32_gpio_irq.c.

References GPIO_IRQ_MODE_DISABLED, and gpio_irq_setup().

Here is the call graph for this function:

status_e gpio_irq_restore ( const struct gpio_t gpio)

Restore a gpio interrupt.

Parameters
gpiothe gpio to use
See also
used with gpio_irq_setup and GPIO_IRQ_MODE_LEVEL_LOW or GPIO_IRQ_MODE_LEVEL_HIGH

Definition at line 183 of file stm32_gpio_irq.c.

References ERROR_BAD_SWITCH, gpio_get(), GPIO_IRQ_MODE_EDGE_BOTH, GPIO_IRQ_MODE_EDGE_FALLING, GPIO_IRQ_MODE_EDGE_RISING, GPIO_IRQ_MODE_LEVEL_HIGH, GPIO_IRQ_MODE_LEVEL_LOW, NO_ERROR, and gpio_t::nr.

Here is the call graph for this function: