mikroSDK Reference Manual
|
GPIO Hardware Abstraction Layer API Reference. More...
API for configuring and manipulating GPIO HAL module.
void hal_gpio_configure_pin | ( | hal_gpio_pin_t * | pin, |
hal_pin_name_t | name, | ||
hal_gpio_direction_t | direction | ||
) |
Configure pin as digital input or output.
[in,out] | pin | GPIO HAL pin context structure. See hal_gpio_pin_t structure definition for detailed explanation. |
[in] | name | Pin name. |
[in] | direction | GPIO pin direction. See hal_gpio_direction_t for valid values. |
Predefined values for direction:
Function | Default value |
---|---|
input | HAL_GPIO_DIGITAL_INPUT |
output | HAL_GPIO_DIGITAL_OUTPUT |
pin
structure has been declared. See hal_gpio_pin_t structure definition for detailed explanation. Example
uint8_t hal_gpio_read_pin_input | ( | hal_gpio_pin_t * | pin | ) |
Reads the current pin input level.
[in,out] | pin | GPIO HAL pin context structure. See hal_gpio_pin_t structure definition for detailed explanation. |
pin
structure has been configured. See hal_gpio_configure_pin for detailed explanation.Example
uint8_t hal_gpio_read_pin_output | ( | hal_gpio_pin_t * | pin | ) |
Reads the current pin output level.
[in,out] | pin | GPIO HAL pin context structure. See hal_gpio_pin_t structure definition for detailed explanation. |
pin
structure has been configured. See hal_gpio_configure_pin for detailed explanation.Example
void hal_gpio_write_pin_output | ( | hal_gpio_pin_t * | pin, |
uint8_t | value | ||
) |
Sets the current output logic of the GPIO pin to 0 or 1.
[in,out] | pin | GPIO HAL pin context structure. See hal_gpio_pin_t structure definition for detailed explanation. |
[in] | value | Pin state, 0 or 1. |
pin
structure has been configured. See hal_gpio_configure_pin for detailed explanation.Example
void hal_gpio_toggle_pin_output | ( | hal_gpio_pin_t * | pin | ) |
Toggles the current output logic of the GPIO pin.
[in,out] | pin | GPIO HAL pin context structure. See hal_gpio_pin_t structure definition for detailed explanation. |
pin
structure has been configured. See hal_gpio_configure_pin for detailed explanation.Example
void hal_gpio_set_pin_output | ( | hal_gpio_pin_t * | pin | ) |
Sets the current output logic of the GPIO pin to 1.
[in,out] | pin | GPIO HAL pin context structure. See hal_gpio_pin_t structure definition for detailed explanation. |
pin
structure has been configured. See hal_gpio_configure_pin for detailed explanation.Example
void hal_gpio_clear_pin_output | ( | hal_gpio_pin_t * | pin | ) |
Sets the current output logic of the GPIO pin to 0.
[in,out] | pin | GPIO HAL pin context structure. See hal_gpio_pin_t structure definition for detailed explanation. |
pin
structure has been configured. See hal_gpio_configure_pin for detailed explanation.Example
void hal_gpio_configure_port | ( | hal_gpio_port_t * | port, |
hal_port_name_t | name, | ||
hal_gpio_mask_t | mask, | ||
hal_gpio_direction_t | direction | ||
) |
Configure port as digital input or output.
[in,out] | port | GPIO HAL port context structure. See hal_gpio_port_t structure definition for detailed explanation. |
[in] | name | Port name. |
[in] | mask | Port bit mask. See hal_gpio_mask_t structure definition for detailed explanation. |
[in] | direction | GPIO pin direction. See hal_gpio_direction_t structure definition for detailed explanation. |
Predefined values for direction:
Function | Default value |
---|---|
input | HAL_GPIO_DIGITAL_INPUT |
output | HAL_GPIO_DIGITAL_OUTPUT |
port
structure has been declared. See hal_gpio_port_t structure definition for detailed explanation. Example
hal_port_size_t hal_gpio_read_port_input | ( | hal_gpio_port_t * | port | ) |
Reads the current input logic of the GPIO port.
[in,out] | port | GPIO HAL port context structure. See hal_gpio_port_t structure definition for detailed explanation. |
port
structure has been configured. See hal_gpio_configure_port for detailed explanation.Example
hal_port_size_t hal_gpio_read_port_output | ( | hal_gpio_port_t * | port | ) |
Reads the current output logic of the GPIO port.
[in,out] | port | GPIO HAL port context structure. See hal_gpio_port_t structure definition for detailed explanation. |
port
structure has been configured. See hal_gpio_configure_port for detailed explanation.Example
void hal_gpio_write_port_output | ( | hal_gpio_port_t * | port, |
hal_port_size_t | value | ||
) |
Sets the current output logic of the GPIO port to 0.
[in,out] | port | GPIO HAL port context structure. See hal_gpio_port_t structure definition for detailed explanation. |
[in] | value | Port state / mask. See hal_port_size_t structure definition for detailed explanation. |
port
structure has been configured. See hal_gpio_configure_port for detailed explanation.Example