File syn_gpio.h¶
FileList > drivers > syn_gpio.h
Go to the source code of this file
GPIO driver — high-level convenience functions. More...
#include "../common/syn_defs.h"#include "../port/syn_port_gpio.h"
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_gpio_init_multiple (const SYN_GPIO_Pin * pins, size_t count, SYN_GPIO_Mode mode) Initialize multiple pins with the same mode. |
| SYN_Status | syn_gpio_write_multiple (const SYN_GPIO_Pin * pins, size_t count, SYN_GPIO_State state) Write the same state to multiple pins. |
Public Static Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_gpio_init (SYN_GPIO_Pin pin, SYN_GPIO_Mode mode) Initialize a GPIO pin. |
| SYN_GPIO_State | syn_gpio_read (SYN_GPIO_Pin pin) Read a pin's logical state. |
| SYN_Status | syn_gpio_toggle (SYN_GPIO_Pin pin) Toggle a pin. |
| SYN_Status | syn_gpio_write (SYN_GPIO_Pin pin, SYN_GPIO_State state) Write a logical state to a pin. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_GPIO_PIN (port_idx, pin_num) (((uint16\_t)(port\_idx) << 4) \| ((pin\_num) & 0x0F))Helper macro to pack Port Index (0..15) and Pin Number (0..15) into a 16-bit SYN_GPIO_Pin. |
| define | SYN_GPIO_PIN_NUM (pin) ((uint8\_t)((uint16\_t)(pin) & 0x0F))Helper macro to extract Pin Number (0..15) from a packed SYN_GPIO_Pin. |
| define | SYN_GPIO_PIN_PORT (pin) ((uint8\_t)(((uint16\_t)(pin) >> 4) & 0x0F))Helper macro to extract Port Index (0..15) from a packed SYN_GPIO_Pin. |
Detailed Description¶
This module builds on the port layer (syn_port_gpio.h) and adds convenience helpers like bulk operations. For simple use cases you can call the port functions directly — this module is optional.
Public Functions Documentation¶
function syn_gpio_init_multiple¶
Initialize multiple pins with the same mode.
Parameters:
pinsArray of pin identifiers.countNumber of pins.modeMode to apply to all pins.
Returns:
SYN_OK if all succeeded, or the first error encountered.
function syn_gpio_write_multiple¶
Write the same state to multiple pins.
SYN_Status syn_gpio_write_multiple (
const SYN_GPIO_Pin * pins,
size_t count,
SYN_GPIO_State state
)
Parameters:
pinsArray of pin identifiers.countNumber of pins.stateState to write.
Returns:
SYN_OK if all succeeded, or the first error encountered.
Public Static Functions Documentation¶
function syn_gpio_init¶
Initialize a GPIO pin.
Parameters:
pinPin identifier.modePin mode (input, output, etc.).
Returns:
SYN_OK on success.
function syn_gpio_read¶
Read a pin's logical state.
Parameters:
pinPin identifier.
Returns:
Logical state.
function syn_gpio_toggle¶
Toggle a pin.
Parameters:
pinPin identifier.
Returns:
SYN_OK on success.
function syn_gpio_write¶
Write a logical state to a pin.
Parameters:
pinPin identifier.stateLogical state.
Returns:
SYN_OK on success.
Macro Definition Documentation¶
define SYN_GPIO_PIN¶
Helper macro to pack Port Index (0..15) and Pin Number (0..15) into a 16-bit SYN_GPIO_Pin.
define SYN_GPIO_PIN_NUM¶
Helper macro to extract Pin Number (0..15) from a packed SYN_GPIO_Pin.
define SYN_GPIO_PIN_PORT¶
Helper macro to extract Port Index (0..15) from a packed SYN_GPIO_Pin.
The documentation for this class was generated from the following file src/syntropic/drivers/syn_gpio.h