|
libeasymcp2221 2.0.3
|
Aggregate flash-information and configuration-save helpers. More...
Go to the source code of this file.
Classes | |
| struct | mcp2221_flash_info_t |
| Snapshot of the public MCP2221 flash-information sections. More... | |
Functions | |
| mcp2221_error_code_t | mcp2221_flash_read_info (mcp2221_t *dev, mcp2221_flash_info_t *info) |
| Read all public flash-information sections. More... | |
| mcp2221_error_code_t | mcp2221_flash_get_usb_serial (mcp2221_t *dev, char *serial, size_t serial_size) |
| Read the persistent USB serial number from flash. More... | |
| mcp2221_error_code_t | mcp2221_flash_get_factory_serial (mcp2221_t *dev, char *serial, size_t serial_size) |
| Read the read-only factory/chip serial number from flash. More... | |
| mcp2221_error_code_t | mcp2221_flash_save_config (mcp2221_t *dev) |
| Save the current runtime configuration to persistent flash. More... | |
Aggregate flash-information and configuration-save helpers.
Definition in file mcp2221_flash_info.h.
| mcp2221_error_code_t mcp2221_flash_get_factory_serial | ( | mcp2221_t * | dev, |
| char * | serial, | ||
| size_t | serial_size | ||
| ) |
Read the read-only factory/chip serial number from flash.
Reads only the factory/chip serial-number flash section.
| [in] | dev | Open MCP2221 device handle. |
| [out] | serial | Receives the null-terminated factory serial on success. |
| [in] | serial_size | Size of serial in bytes, including the terminator. |
| mcp2221_error_code_t mcp2221_flash_get_usb_serial | ( | mcp2221_t * | dev, |
| char * | serial, | ||
| size_t | serial_size | ||
| ) |
Read the persistent USB serial number from flash.
Reads only the USB serial-number flash section and decodes its validated UTF-16LE descriptor payload to UTF-8.
| [in] | dev | Open MCP2221 device handle. |
| [out] | serial | Receives the null-terminated UTF-8 serial on success. |
| [in] | serial_size | Size of serial in bytes, including the terminator. |
| mcp2221_error_code_t mcp2221_flash_read_info | ( | mcp2221_t * | dev, |
| mcp2221_flash_info_t * | info | ||
| ) |
Read all public flash-information sections.
The output structure is cleared first, then the chip settings, GP settings, USB manufacturer, USB product, USB serial, and factory/chip serial sections are read. USB descriptor metadata is validated before USB-style wide-character structures are decoded to UTF-8 on a best-effort basis.
| [in] | dev | Open MCP2221 device handle. |
| [out] | info | Receives raw flash sections and decoded strings. |
| mcp2221_error_code_t mcp2221_flash_save_config | ( | mcp2221_t * | dev | ) |
Save the current runtime configuration to persistent flash.
The function updates the persistent chip-settings and GP-settings sections from the current device SRAM state. GPIO values are taken from the library's cached GPIO state when available so that changes made through the GPIO API are retained.
Enumeration-time USB power attributes and requested-current values remain unchanged unless the corresponding USB setter has staged an explicit update.
| [in] | dev | Open MCP2221 device handle. |