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 the orientation of one or more pins of the gpio instance.
 
void vsf_gpio_set_input (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 input.
 
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 
)

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]cfga 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 the orientation of one or more pins of the gpio instance

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]direction_maskdirection mask, 1 for output, 0 for input
[in]pin_maskpin mask, each pin corresponds to one bit, the value of this bit 1 means configuration is required

◆ 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 the orientation of 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
Returns
vsf_gpio_pin_mask_t: The value of all pin_mask directions, 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 the direction of one or more pins of the gpio instance to input.

Parameters
[in]gpio_ptra pointer to structure vsf_gpio_t
[in]Pinmask, each pin corresponds to one bit, the value of the bit 1 indicates the need to set to 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]Pinmask, 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]Pinmask, 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 high
[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() (is_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() (is_support_output_and_set)

◆ 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]cfga pointer to structure vsf_gpio_exti_irq_cfg_t

◆ 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
[in]priopriority of the interrupt or vsf_arch_prio_invalid for disable
Note
For some devices, prio parameter maybe 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
Note
For some devices, prio parameter maybe shared between pins on the gpio.