|
libeasymcp2221 2.0.3
|
High-level MCP2221 GP pin-function configuration. More...
Go to the source code of this file.
Classes | |
| struct | mcp2221_pin_functions_t |
| Batch configuration for GP0 through GP3. More... | |
Enumerations | |
| enum | mcp2221_gpio_pin_t { MCP2221_GPIO_PIN_GP0 = 0 , MCP2221_GPIO_PIN_GP1 = 1 , MCP2221_GPIO_PIN_GP2 = 2 , MCP2221_GPIO_PIN_GP3 = 3 } |
| MCP2221 general-purpose pin identifiers. More... | |
| enum | mcp2221_pin_function_t { MCP2221_PIN_FUNC_KEEP = -1 , MCP2221_PIN_FUNC_DEDICATED = 0 , MCP2221_PIN_FUNC_ALT0 = 1 , MCP2221_PIN_FUNC_ALT1 = 2 , MCP2221_PIN_FUNC_ALT2 = 3 , MCP2221_PIN_FUNC_GPIO_IN = 4 , MCP2221_PIN_FUNC_GPIO_OUT = 5 } |
| High-level pin functions. More... | |
Functions | |
| mcp2221_error_code_t | mcp2221_pin_set_function (mcp2221_t *dev, mcp2221_gpio_pin_t pin, mcp2221_pin_function_t function) |
| Set the function of one GP pin. More... | |
| mcp2221_error_code_t | mcp2221_pin_set_functions (mcp2221_t *dev, const mcp2221_pin_functions_t *cfg) |
| Configure the functions of GP0 through GP3 in one operation. More... | |
High-level MCP2221 GP pin-function configuration.
Definition in file mcp2221_pin.h.
| enum mcp2221_gpio_pin_t |
MCP2221 general-purpose pin identifiers.
| Enumerator | |
|---|---|
| MCP2221_GPIO_PIN_GP0 | GP0. |
| MCP2221_GPIO_PIN_GP1 | GP1. |
| MCP2221_GPIO_PIN_GP2 | GP2. |
| MCP2221_GPIO_PIN_GP3 | GP3. |
Definition at line 18 of file mcp2221_pin.h.
High-level pin functions.
The ALT function values represent the MCP2221 alternate-function selector, but not every alternate function is valid on every GP pin.
Definition at line 31 of file mcp2221_pin.h.
| mcp2221_error_code_t mcp2221_pin_set_function | ( | mcp2221_t * | dev, |
| mcp2221_gpio_pin_t | pin, | ||
| mcp2221_pin_function_t | function | ||
| ) |
Set the function of one GP pin.
MCP2221_PIN_FUNC_KEEP is not accepted by this single-pin helper and returns MCP2221_ERR_INVALID. Use mcp2221_pin_set_functions() when a batch configuration needs to preserve selected pins.
For accepted functions, the helper writes a complete GP configuration. GPIO outputs are initialized low because this function has no output-value parameter.
Supported functions by pin:
| [in] | dev | Open MCP2221 device handle. |
| [in] | pin | GP pin to configure. |
| [in] | function | Requested high-level pin function. |
| mcp2221_error_code_t mcp2221_pin_set_functions | ( | mcp2221_t * | dev, |
| const mcp2221_pin_functions_t * | cfg | ||
| ) |
Configure the functions of GP0 through GP3 in one operation.
Pins whose mcp2221_pin_functions_t::gp entry is MCP2221_PIN_FUNC_KEEP are preserved. For GPIO outputs, the corresponding mcp2221_pin_functions_t::out entry selects the initial output value.
| [in] | dev | Open MCP2221 device handle. |
| [in] | cfg | Four-pin configuration. Must not be NULL. |