| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| logicpython:cubloc_api:eeread [2026/04/13 02:02] – mfranklin | logicpython:cubloc_api:eeread [2026/04/14 05:14] (current) – [Return Value] mfranklin |
|---|
| ====== EERead ====== | ====== EERead ====== |
| |
| Read data from non-volatile memory | Read data from non-volatile memory. |
| | |
| | This feature is supported only on models with built-in FRAM. |
| |
| ===== Syntax ===== | ===== Syntax ===== |
| from cubloc import EERead | from cubloc import EERead |
| |
| EERead( address: int, byteLength: int, returnType: type[int] | type[float] | type[bytes] | type[bytearray] = int, ) | EERead(address: int, |
| | byteLength: int, |
| | returnType: type[int] | type[float] | type[bytes] | type[bytearray] = int) |
| </code> | </code> |
| |
| |
| * **address**: EEPROM ''address'' (0 to 4095). | * **address**: EEPROM ''address'' (0 to 4095). |
| * **byteLength**: Number of bytes to read. Must be positive and remain within the EEPROM bounds. | * **byteLength**: Number of bytes to read. Must be positive and remain within the non-volatile memory's bounds. |
| * **returnType**: Use int, float, bytes, or bytearray to control how the EEPROM bytes are decoded. The default is int. | * **returnType**: Use ''int'', ''float'', ''bytes'', or ''bytearray'' to control how the data is decoded. The default is ''int''. |
| |
| ===== Return Value ===== | ===== Return Value ===== |
| |
| Returns the EEPROM data decoded according to ''returnType'' as int, float, bytes, or bytearray. | Returns the data according to ''returnType'' as ''int'', ''float'', ''bytes'', or ''bytearray''. |
| |
| ===== Exceptions ===== | ===== Exceptions ===== |
| |
| * [[https://docs.micropython.org/en/latest/library/builtins.html#TypeError|TypeError]]: ''address'', ''byteLength'', or ''returnType'' is invalid. | * [[https://docs.micropython.org/en/latest/library/builtins.html#TypeError|TypeError]]: ''address'', ''byteLength'', or ''returnType'' is invalid. |
| * [[https://docs.micropython.org/en/latest/library/builtins.html#ValueError|ValueError]]: ''address'' or ''byteLength'' is out of range, the read would extend past ''address'' 4095, or a float read was requested with a ''byteLength'' other than 4. | * [[https://docs.micropython.org/en/latest/library/builtins.html#ValueError|ValueError]]: ''address'' or ''byteLength'' is out of range, the read would extend past ''address'' 4095, or a ''float'' read was requested with a ''byteLength'' other than 4. |
| |
| ===== Example ===== | ===== Example ===== |