Developer World
Spresense SDK Library v3.3.0-375c679
GPIO Interface driver

GPIO Interrupt Setting

GPIO interrupt level and edge trigger types

int board_gpio_config (uint32_t pin, int mode, bool input, bool drive, int pull)
 
int board_gpio_status (uint32_t pin, bool *input, bool *output, bool *drive, int *pull)
 
void board_gpio_write (uint32_t pin, int value)
 
int board_gpio_read (uint32_t pin)
 
int board_gpio_intconfig (uint32_t pin, int mode, bool filter, xcpt_t isr)
 
int board_gpio_intstatus (uint32_t pin, int *mode, bool *filter, bool *enabled)
 
int board_gpio_int (uint32_t pin, bool enable)
 
#define INT_HIGH_LEVEL   (2) /* High Level */
 
#define INT_LOW_LEVEL   (3) /* Low Level */
 
#define INT_RISING_EDGE   (4) /* Rising Edge */
 
#define INT_FALLING_EDGE   (5) /* Falling Edge */
 
#define INT_BOTH_EDGE   (7) /* Both Edge */
 

Pin Pull Setting

Pin floating, pull up, pull down definitions

#define PIN_FLOAT   (0) /* Floating */
 
#define PIN_PULLUP   (1) /* Internal Weak Pull Up */
 
#define PIN_PULLDOWN   (2) /* Internal Weak Pull Down */
 
#define PIN_BUSKEEPER   (3) /* Internal Bus-Keeper */
 

Detailed Description

Function Documentation

◆ board_gpio_config()

int board_gpio_config ( uint32_t  pin,
int  mode,
bool  input,
bool  drive,
int  pull 
)

GPIO Configure

Parameters
[in]pinPin number
[in]modeFunction mode 0=GPIO
[in]inputInput Enable true=enable, false=disable
[in]driveDrive Strength true=High Drive(4mA), false=Normal(2mA)
[in]pull0=float, 1=pullup, 2=pulldown, 3=buskeeper
  • #PIN_FLOAT
  • #PIN_PULLUP
  • #PIN_PULLDOWN
  • #PIN_BUSKEEPER
Returns
OK(0) is success. negative value is failure.

◆ board_gpio_status()

int board_gpio_status ( uint32_t  pin,
bool *  input,
bool *  output,
bool *  drive,
int *  pull 
)

GPIO Status

Parameters
[in]pinPin number
[out]inputInput Enable true=enable, false=disable
[out]outputOutput Enable true=enable, false=disable
[out]driveDrive Strength true=HighDrive(4mA), false=Normal(2mA)
[out]pull0=float, 1=pullup, 2=pulldown, 3=buskeeper
  • #PIN_FLOAT
  • #PIN_PULLUP
  • #PIN_PULLDOWN
  • #PIN_BUSKEEPER
Returns
Pin function mode. negative value is failure.

◆ board_gpio_write()

void board_gpio_write ( uint32_t  pin,
int  value 
)

GPIO Write

Parameters
[in]pinPin number
[in]valueWrite Value 0<high, 0=low, 0>hiz

◆ board_gpio_read()

int board_gpio_read ( uint32_t  pin)

GPIO Read

Parameters
[in]pinPin number
Returns
read value 1=high, 0=low

◆ board_gpio_intconfig()

int board_gpio_intconfig ( uint32_t  pin,
int  mode,
bool  filter,
xcpt_t  isr 
)

GPIO Interrupt Configure

Parameters
[in]pinPin number
[in]modeInterrupt polarity
  • #INT_HIGH_LEVEL
  • #INT_LOW_LEVEL
  • #INT_RISING_EDGE
  • #INT_FALLING_EDGE
  • #INT_BOTH_EDGE
[in]filterNoise Filter true=enable, false=disable
[in]isrInterrupt Service Routine
Returns
IRQ number. negative value is failure.

◆ board_gpio_intstatus()

int board_gpio_intstatus ( uint32_t  pin,
int *  mode,
bool *  filter,
bool *  enabled 
)

GPIO Interrupt Configure

Parameters
[in]pinPin number
[out]modeInterrupt polarity
  • #INT_HIGH_LEVEL
  • #INT_LOW_LEVEL
  • #INT_RISING_EDGE
  • #INT_FALLING_EDGE
  • #INT_BOTH_EDGE
[out]filterNoise Filter true=enable, false=disable
[out]enabledInterrupt true=enable, false=disable
Returns
IRQ number. negative value is failure.

◆ board_gpio_int()

int board_gpio_int ( uint32_t  pin,
bool  enable 
)

GPIO Interrupt Enable/Disable

Parameters
[in]pinPin number
[in]enableInterrupt true=enable, false=disable
Returns
IRQ number. negative value is failure.