|
libeasymcp2221 2.0.3
|
Direct GPIO input and output helpers. More...
Go to the source code of this file.
Classes | |
| struct | mcp2221_gpio_write_t |
| Per-pin GPIO output update request. More... | |
Macros | |
| #define | MCP2221_GPIO_KEEP (-1) |
| Preserve the current GPIO output value. More... | |
Functions | |
| mcp2221_error_code_t | mcp2221_gpio_write (mcp2221_t *dev, const mcp2221_gpio_write_t *wr) |
| Update GPIO output values. More... | |
| mcp2221_error_code_t | mcp2221_gpio_read (mcp2221_t *dev, int out_state[4]) |
| Read the current state of GP0 through GP3. More... | |
| mcp2221_error_code_t | mcp2221_gpio_read_mask (mcp2221_t *dev, int out_state[4], uint8_t *out_valid_mask) |
| Read GPIO state and report which GP pins are configured as GPIO. More... | |
Direct GPIO input and output helpers.
Definition in file mcp2221_gpio.h.
| #define MCP2221_GPIO_KEEP (-1) |
Preserve the current GPIO output value.
Use this value in a member of mcp2221_gpio_write_t to leave the corresponding output unchanged.
Definition at line 24 of file mcp2221_gpio.h.
| mcp2221_error_code_t mcp2221_gpio_read | ( | mcp2221_t * | dev, |
| int | out_state[4] | ||
| ) |
Read the current state of GP0 through GP3.
Each element of out_state corresponds to the same-numbered GP pin.
| [in] | dev | Open MCP2221 device handle. |
| [out] | out_state | Four-element array receiving pin states:
|
| mcp2221_error_code_t mcp2221_gpio_read_mask | ( | mcp2221_t * | dev, |
| int | out_state[4], | ||
| uint8_t * | out_valid_mask | ||
| ) |
Read GPIO state and report which GP pins are configured as GPIO.
This mirrors the EasyMCP2221 GPIO-read semantics while providing an explicit validity mask in C.
| [in] | dev | Open MCP2221 device handle. |
| [out] | out_state | Four-element array receiving -1 for non-GPIO pins, otherwise 0 or 1 for the sampled logic level. |
| [out] | out_valid_mask | Receives a bit mask where bit 0 through bit 3 correspond to GP0 through GP3. A set bit means the corresponding pin is configured as GPIO. |
| mcp2221_error_code_t mcp2221_gpio_write | ( | mcp2221_t * | dev, |
| const mcp2221_gpio_write_t * | wr | ||
| ) |
Update GPIO output values.
Only members whose value is 0 or 1 are changed; members set to MCP2221_GPIO_KEEP preserve the current output value.
| [in] | dev | Open MCP2221 device handle. |
| [in] | wr | Per-pin output update request. Must not be NULL. |