Developer World
Spresense SDK Library v1.4.1-ee8f2dd
GPIO Interface driver

Functions

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)
 

Pin Pull Setting

Pin floating, pull up, pull down definitions

#define PIN_FLOAT   (0)
 
#define PIN_PULLUP   (1)
 
#define PIN_PULLDOWN   (2)
 
#define PIN_BUSKEEPER   (3)
 

GPIO Interrupt Setting

GPIO interrupt level and edge trigger types

#define INT_HIGH_LEVEL   (2)
 
#define INT_LOW_LEVEL   (3)
 
#define INT_RISING_EDGE   (4)
 
#define INT_FALLING_EDGE   (5)
 
#define INT_BOTH_EDGE   (7)
 

Detailed Description

Macro Definition Documentation

◆ PIN_FLOAT

#define PIN_FLOAT   (0)

Floating

◆ PIN_PULLUP

#define PIN_PULLUP   (1)

Internal Weak Pull Up

◆ PIN_PULLDOWN

#define PIN_PULLDOWN   (2)

Internal Weak Pull Down

◆ PIN_BUSKEEPER

#define PIN_BUSKEEPER   (3)

Internal Bus-Keeper

◆ INT_HIGH_LEVEL

#define INT_HIGH_LEVEL   (2)

High Level

◆ INT_LOW_LEVEL

#define INT_LOW_LEVEL   (3)

Low Level

◆ INT_RISING_EDGE

#define INT_RISING_EDGE   (4)

Rising Edge

◆ INT_FALLING_EDGE

#define INT_FALLING_EDGE   (5)

Falling Edge

◆ INT_BOTH_EDGE

#define INT_BOTH_EDGE   (7)

Both Edge

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
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
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
[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
[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.