Mistake on this page?
Report an issue in GitHub or email us
Modules | Functions
GPIO HAL functions

Defined behavior

More...

Modules

 GPIO HAL tests
 The GPIO HAL tests ensure driver conformance to defined behaviour.
 

Functions

uint32_t gpio_set (PinName pin)
 Set the given pin as GPIO. More...
 
int gpio_is_connected (const gpio_t *obj)
 Checks if gpio object is connected (pin was not initialized with NC) More...
 
void gpio_init (gpio_t *obj, PinName pin)
 Initialize the GPIO pin. More...
 
void gpio_free (gpio_t *obj)
 Releases the GPIO pin. More...
 
void gpio_mode (gpio_t *obj, PinMode mode)
 Set the input pin mode. More...
 
void gpio_dir (gpio_t *obj, PinDirection direction)
 Set the pin direction. More...
 
void gpio_write (gpio_t *obj, int value)
 Set the output value. More...
 
int gpio_read (gpio_t *obj)
 Read the input value. More...
 
void gpio_init_in (gpio_t *gpio, PinName pin)
 Init the input pin and set mode to PullDefault. More...
 
void gpio_init_in_ex (gpio_t *gpio, PinName pin, PinMode mode)
 Init the input pin and set the mode. More...
 
void gpio_init_out (gpio_t *gpio, PinName pin)
 Init the output pin as an output, with predefined output value 0. More...
 
void gpio_init_out_ex (gpio_t *gpio, PinName pin, int value)
 Init the pin as an output and set the output value. More...
 
void gpio_init_inout (gpio_t *gpio, PinName pin, PinDirection direction, PinMode mode, int value)
 Init the pin to be in/out. More...
 
const PinMapgpio_pinmap (void)
 Get the pins that support all GPIO tests. More...
 

Detailed Description

Defined behavior

Undefined behavior

Function Documentation

void gpio_dir ( gpio_t *  obj,
PinDirection  direction 
)

Set the pin direction.

Parameters
objThe GPIO object (must be connected)
directionThe pin direction to be set
void gpio_free ( gpio_t *  obj)

Releases the GPIO pin.

Parameters
objThe GPIO object to release
void gpio_init ( gpio_t *  obj,
PinName  pin 
)

Initialize the GPIO pin.

Parameters
objThe GPIO object to initialize
pinThe GPIO pin to initialize (may be NC)
void gpio_init_in ( gpio_t *  gpio,
PinName  pin 
)

Init the input pin and set mode to PullDefault.

Parameters
gpioThe GPIO object
pinThe pin name (may be NC)
void gpio_init_in_ex ( gpio_t *  gpio,
PinName  pin,
PinMode  mode 
)

Init the input pin and set the mode.

Parameters
gpioThe GPIO object
pinThe pin name (may be NC)
modeThe pin mode to be set
void gpio_init_inout ( gpio_t *  gpio,
PinName  pin,
PinDirection  direction,
PinMode  mode,
int  value 
)

Init the pin to be in/out.

Parameters
gpioThe GPIO object
pinThe pin name (may be NC)
directionThe pin direction to be set
modeThe pin mode to be set
valueThe value to be set for an output pin
void gpio_init_out ( gpio_t *  gpio,
PinName  pin 
)

Init the output pin as an output, with predefined output value 0.

Parameters
gpioThe GPIO object
pinThe pin name (may be NC)
Returns
An integer value 1 or 0
void gpio_init_out_ex ( gpio_t *  gpio,
PinName  pin,
int  value 
)

Init the pin as an output and set the output value.

Parameters
gpioThe GPIO object
pinThe pin name (may be NC)
valueThe value to be set
int gpio_is_connected ( const gpio_t *  obj)

Checks if gpio object is connected (pin was not initialized with NC)

Parameters
objThe GPIO object
Returns
0 if object was initialized with NC
non-zero if object was initialized with a valid PinName
void gpio_mode ( gpio_t *  obj,
PinMode  mode 
)

Set the input pin mode.

Parameters
objThe GPIO object (must be connected)
modeThe pin mode to be set
const PinMap* gpio_pinmap ( void  )

Get the pins that support all GPIO tests.

Return a PinMap array of pins that support GPIO. The array is terminated with {NC, NC, 0}.

Targets should override the weak implementation of this function to provide the actual pinmap for GPIO testing.

Returns
PinMap array
int gpio_read ( gpio_t *  obj)

Read the input value.

Parameters
objThe GPIO object (must be connected)
Returns
An integer value 1 or 0
uint32_t gpio_set ( PinName  pin)

Set the given pin as GPIO.

Parameters
pinThe pin to be set as GPIO
Returns
The GPIO port mask for this pin
void gpio_write ( gpio_t *  obj,
int  value 
)

Set the output value.

Parameters
objThe GPIO object (must be connected)
valueThe value to be set
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.