VSF Documented
Macros | Functions
gpio_common.c File Reference
#include "hal/driver/driver.h"

Macros

#define VSF_GPIO_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_gpio_port_config_pins (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask, vsf_gpio_cfg_t *cfg_ptr)
 Configure one or more pins of the gpio instance.
 
void vsf_gpio_set_direction (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask, vsf_gpio_pin_mask_t direction_mask)
 ‍**
 
vsf_gpio_pin_mask_t vsf_gpio_get_direction (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Get GPIO port pin direction.
 
void vsf_gpio_set_input (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 set specified pins to input mode
 
void vsf_gpio_set_output (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Set the direction of one or more pins of the gpio instance to output.
 
void vsf_gpio_switch_direction (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Toggle the orientation of one or more pins of a gpio instance.
 
vsf_gpio_pin_mask_t vsf_gpio_read (vsf_gpio_t *gpio_ptr)
 Read the values of all pins of the gpio instance.
 
void vsf_gpio_write (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask, vsf_gpio_pin_mask_t value)
 set the value of one or more of the gpio instances
 
void vsf_gpio_set (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Set the value of one or more pins of the gpio instance to high.
 
void vsf_gpio_clear (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Set the value of one or more pins of the gpio instance to low.
 
void vsf_gpio_toggle (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Toggle the value of one or more pins of the gpio instance.
 
void vsf_gpio_output_and_set (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Set the direction of one or more pins of the gpio instance to output high.
 
void vsf_gpio_output_and_clear (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Set the direction of one or more pins of the gpio instance to output low.
 
vsf_gpio_capability_t vsf_gpio_capability (vsf_gpio_t *gpio_ptr)
 Get the capability of gpio instance.
 
vsf_err_t vsf_gpio_exti_irq_config (vsf_gpio_t *gpio_ptr, vsf_gpio_exti_irq_cfg_t *irq_cfg_ptr)
 Configure external interrupt of the gpio instance.
 
vsf_err_t vsf_gpio_exti_irq_enable (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Enable interrupt of one or more pins.
 
vsf_err_t vsf_gpio_exti_irq_disable (vsf_gpio_t *gpio_ptr, vsf_gpio_pin_mask_t pin_mask)
 Disable interrupt of one or more pins.
 

Macro Definition Documentation

◆ VSF_GPIO_CFG_FUNCTION_RENAME

#define VSF_GPIO_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_gpio_port_config_pins()

vsf_err_t vsf_gpio_port_config_pins ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask,
vsf_gpio_cfg_t cfg_ptr 
)

Configure one or more pins of the gpio instance.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, the value of this bit 1 means configuration is required
[in]cfg_ptra pointer to structure vsf_gpio_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if GPIO Configuration Successful, or a negative error code

◆ vsf_gpio_set_direction()

void vsf_gpio_set_direction ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask,
vsf_gpio_pin_mask_t  direction_mask 
)

‍**

‍**

Set GPIO port pin direction

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maska pin mask, each pin corresponds to a bit, value 1 of the bit to change, 0 means unchanged
[in]direction_maska direction mask, each pin corresponds to a bit, value 1 for output, 0 for input

◆ vsf_gpio_get_direction()

vsf_gpio_pin_mask_t vsf_gpio_get_direction ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Get GPIO port pin direction.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maska pin mask, each pin corresponds to a bit. direction of all pins in pin_mask will be returned.
Returns
vsf_gpio_pin_mask_t: the direction of all pins, value 1 for output, 0 for input

◆ vsf_gpio_set_input()

void vsf_gpio_set_input ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

set specified pins to input mode

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maska pin mask, each pin corresponds to a bit, value 1 to set as input

◆ vsf_gpio_set_output()

void vsf_gpio_set_output ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Set the direction of one or more pins of the gpio instance to output.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, the value of the bit 1 indicates the need to set to output

◆ vsf_gpio_switch_direction()

void vsf_gpio_switch_direction ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Toggle the orientation of one or more pins of a gpio instance.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, the value of the bit 1 indicates the need to set to output

◆ vsf_gpio_read()

vsf_gpio_pin_mask_t vsf_gpio_read ( vsf_gpio_t gpio_ptr)

Read the values of all pins of the gpio instance.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
Returns
vsf_gpio_pin_mask_t: Value of all pins, 1 for output, 0 for input

◆ vsf_gpio_write()

void vsf_gpio_write ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask,
vsf_gpio_pin_mask_t  value 
)

set the value of one or more of the gpio instances

Parameters
[in]gpio_ptrpointer to the structure vsf_gpio_t, refer to vsf_gpio_t
[in]valuevalue of the pin, each pin corresponds to a bit, 1 means high, 0 means low
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be written, 0 means the bit does not need to be updated

◆ vsf_gpio_set()

void vsf_gpio_set ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Set the value of one or more pins of the gpio instance to high.

Parameters
[in]gpio_ptrpointer to the structure vsf_gpio_t, refer to vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be written, 0 means the bit does not need to be updated

◆ vsf_gpio_clear()

void vsf_gpio_clear ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Set the value of one or more pins of the gpio instance to low.

Parameters
[in]gpio_ptrpointer to the structure vsf_gpio_t, refer to vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be written, 0 means the bit does not need to be updated

◆ vsf_gpio_toggle()

void vsf_gpio_toggle ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Toggle the value of one or more pins of the gpio instance.

Parameters
[in]gpio_ptrpointer to the structure vsf_gpio_t, refer to vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be written, 0 means the bit does not need to be updated

◆ vsf_gpio_output_and_set()

void vsf_gpio_output_and_set ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Set the direction of one or more pins of the gpio instance to output high.

Parameters
[in]gpio_ptrpointer to the structure vsf_gpio_t, refer to vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be written, 0 means the bit does not need to be updated
Note
This API can be used when modifying the IO direction to output and set to high in order to avoid possible pulses. Note that it is not supported by all hardware. You can get if this mode is supported with vsf_gpio_capability() (support_output_and_set)

◆ vsf_gpio_output_and_clear()

void vsf_gpio_output_and_clear ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Set the direction of one or more pins of the gpio instance to output low.

Parameters
[in]gpio_ptrpointer to the structure vsf_gpio_t, refer to vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be written, 0 means the bit does not need to be updated
Note
This API can be used when modifying the IO direction to output and set to low in order to avoid possible pulses. Note that it is not supported by all hardware. You can get if this mode is supported with vsf_gpio_capability() (support_output_and_clear)

◆ vsf_gpio_capability()

vsf_gpio_capability_t vsf_gpio_capability ( vsf_gpio_t gpio_ptr)

Get the capability of gpio instance.

Parameters
[in]gpio_ptrpointer to the structure vsf_gpio_t, refer to vsf_gpio_t

◆ vsf_gpio_exti_irq_config()

vsf_err_t vsf_gpio_exti_irq_config ( vsf_gpio_t gpio_ptr,
vsf_gpio_exti_irq_cfg_t cfg_ptr 
)

Configure external interrupt of the gpio instance.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]cfg_ptra pointer to structure vsf_gpio_exti_irq_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if successful, or a negative error code

◆ vsf_gpio_exti_irq_enable()

vsf_err_t vsf_gpio_exti_irq_enable ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Enable interrupt of one or more pins.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be enabled, 0 means the bit does not need to be enabled
Returns
vsf_err_t: VSF_ERR_NONE if successful, or a negative error code
Note
For some devices, the interrupt priority may be shared between pins on the gpio.
All pending interrupts should be cleared before interrupts are enabled.

◆ vsf_gpio_exti_irq_disable()

vsf_err_t vsf_gpio_exti_irq_disable ( vsf_gpio_t gpio_ptr,
vsf_gpio_pin_mask_t  pin_mask 
)

Disable interrupt of one or more pins.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]pin_maskpin mask, each pin corresponds to one bit, 1 means the bit needs to be disabled, 0 means the bit does not need to be disabled
Returns
vsf_err_t: VSF_ERR_NONE if successful, or a negative error code
Note
For some devices, the interrupt settings may be shared between pins on the gpio.
Generated from commit: vsfteam/vsf@2b286be