Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gd32_exti.h File Reference
#include <stdint.h>
#include <zephyr/sys/util_macro.h>

Go to the source code of this file.

Macros

EXTI trigger modes.

#define GD32_EXTI_TRIG_NONE   0U
 No trigger.
 
#define GD32_EXTI_TRIG_RISING   BIT(0)
 Trigger on rising edge.
 
#define GD32_EXTI_TRIG_FALLING   BIT(1)
 Trigger on falling edge.
 
#define GD32_EXTI_TRIG_BOTH   (GD32_EXTI_TRIG_RISING | GD32_EXTI_TRIG_FALLING)
 Trigger on rising and falling edge.
 

Typedefs

typedef void(* gd32_exti_cb_t) (uint8_t line, void *user)
 Callback for EXTI interrupt.
 

Functions

void gd32_exti_enable (uint8_t line)
 Enable EXTI interrupt for the given line.
 
void gd32_exti_disable (uint8_t line)
 Disable EXTI interrupt for the given line.
 
void gd32_exti_trigger (uint8_t line, uint8_t trigger)
 Configure EXTI interrupt trigger mode for the given line.
 
int gd32_exti_configure (uint8_t line, gd32_exti_cb_t cb, void *user)
 Configure EXTI interrupt callback.
 

Macro Definition Documentation

◆ GD32_EXTI_TRIG_BOTH

#define GD32_EXTI_TRIG_BOTH   (GD32_EXTI_TRIG_RISING | GD32_EXTI_TRIG_FALLING)

Trigger on rising and falling edge.

◆ GD32_EXTI_TRIG_FALLING

#define GD32_EXTI_TRIG_FALLING   BIT(1)

Trigger on falling edge.

◆ GD32_EXTI_TRIG_NONE

#define GD32_EXTI_TRIG_NONE   0U

No trigger.

◆ GD32_EXTI_TRIG_RISING

#define GD32_EXTI_TRIG_RISING   BIT(0)

Trigger on rising edge.

Typedef Documentation

◆ gd32_exti_cb_t

typedef void(* gd32_exti_cb_t) (uint8_t line, void *user)

Callback for EXTI interrupt.

Function Documentation

◆ gd32_exti_configure()

int gd32_exti_configure ( uint8_t  line,
gd32_exti_cb_t  cb,
void *  user 
)

Configure EXTI interrupt callback.

Parameters
lineEXTI line.
cbCallback (NULL to disable).
userUser data (optional).
Return values
0On success.
-EALREADYIf callback is already set and cb is not NULL.

◆ gd32_exti_disable()

void gd32_exti_disable ( uint8_t  line)

Disable EXTI interrupt for the given line.

Parameters
lineEXTI line.

◆ gd32_exti_enable()

void gd32_exti_enable ( uint8_t  line)

Enable EXTI interrupt for the given line.

Parameters
lineEXTI line.

◆ gd32_exti_trigger()

void gd32_exti_trigger ( uint8_t  line,
uint8_t  trigger 
)

Configure EXTI interrupt trigger mode for the given line.

Parameters
lineEXTI line.
triggerTrigger mode (see GD32_EXTI_TRIG).