![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
#include <io.h>#include <stdarg.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <types.h>#include <log.h>#include <reg-ncat.h>#include <sys-gpio.h>
Enumerations | |
| enum | { GPIO_CFG0 = 0x00 , GPIO_CFG1 = 0x04 , GPIO_CFG2 = 0x08 , GPIO_CFG3 = 0x0c , GPIO_DAT = 0x10 , GPIO_DRV0 = 0x14 , GPIO_DRV1 = 0x18 , GPIO_DRV2 = 0x1c , GPIO_DRV3 = 0x20 , GPIO_PUL0 = 0x24 , GPIO_PUL1 = 0x28 , GPIO_OFFSET = 0x30 , GPIO_CFG_MASK = 0xf , GPIO_DRV_MASK = 0x3 } |
Functions | |
| static uint32_t | _port_num (gpio_t pin) |
| Extracts the port number from a GPIO pin. | |
| static uint32_t | _port_base_get (gpio_t pin) |
| Gets the base address of the port register for a GPIO pin. | |
| static uint32_t | _pin_num (gpio_t pin) |
| Extracts the pin number within a port from a GPIO pin. | |
| void | sunxi_gpio_init (gpio_t pin, int cfg) |
| Initializes a Sunxi GPIO pin with the specified configuration. | |
| void | sunxi_gpio_set_value (gpio_t pin, int value) |
| Sets the value of a Sunxi GPIO pin. | |
| int | sunxi_gpio_read (gpio_t pin) |
| Reads the value of a Sunxi GPIO pin. | |
| void | sunxi_gpio_set_pull (gpio_t pin, enum gpio_pull_t pull) |
| Sets the pull configuration of a Sunxi GPIO pin. | |
| void | sunxi_gpio_set_drv (gpio_t pin, gpio_drv_t drv) |
| Sets the drive strength of a Sunxi GPIO pin. | |
| anonymous enum |
Extracts the pin number within a port from a GPIO pin.
This inline function extracts the pin number within a port from the given GPIO pin number.
| pin | The GPIO pin number. |
Gets the base address of the port register for a GPIO pin.
This function calculates and returns the base address of the port register for the specified GPIO pin.
| pin | The GPIO pin number. |
Extracts the port number from a GPIO pin.
This inline function extracts the port number from the given GPIO pin number.
| pin | The GPIO pin number. |
| void sunxi_gpio_init | ( | gpio_t | pin, |
| int | cfg | ||
| ) |
Initializes a Sunxi GPIO pin with the specified configuration.
Initialize the specified GPIO pin with the given configuration.
This function initializes a Sunxi GPIO pin with the specified configuration. It sets the pin's configuration based on the provided parameters.
| pin | The GPIO pin to initialize. |
| cfg | The configuration value for the GPIO pin. |
| int sunxi_gpio_read | ( | gpio_t | pin | ) |
Reads the value of a Sunxi GPIO pin.
Read the value of the specified GPIO pin.
This function reads the current value of a Sunxi GPIO pin and returns it.
| pin | The GPIO pin to read the value from. |
| void sunxi_gpio_set_drv | ( | gpio_t | pin, |
| gpio_drv_t | drv | ||
| ) |
Sets the drive strength of a Sunxi GPIO pin.
This function sets the drive strength for the specified GPIO pin.
| pin | The GPIO pin to set the drive strength for. |
| drv | The drive strength value to set (GPIO_DRV_LOW, GPIO_DRV_MEDIUM, or GPIO_DRV_HIGH). |
| void sunxi_gpio_set_pull | ( | gpio_t | pin, |
| enum gpio_pull_t | pull | ||
| ) |
Sets the pull configuration of a Sunxi GPIO pin.
Set the pull configuration for the specified GPIO pin.
This function sets the pull-up, pull-down, or no pull configuration for the specified GPIO pin.
| pin | The GPIO pin to set the pull configuration for. |
| pull | The pull configuration to set (GPIO_PULL_UP, GPIO_PULL_DOWN, or GPIO_PULL_NONE). |
| void sunxi_gpio_set_value | ( | gpio_t | pin, |
| int | value | ||
| ) |
Sets the value of a Sunxi GPIO pin.
Set the value of the specified GPIO pin.
This function sets the value of a Sunxi GPIO pin to the specified value (0 or 1).
| pin | The GPIO pin to set the value for. |
| value | The value to set (0 or 1). |