class documentation
class PSRAM(picoware_psram.PSRAM):
MicroPython PSRAM interface with automatic GC-managed objects.
Provides a high-level and low-level interface to PSRAM memory for allocating, managing, and utilizing PSRAM in MicroPython applications.
Methods
- is_ready
- Check if PSRAM is initialized and ready for use.
- size
- Get total PSRAM memory size in bytes.
- test
- Run a PSRAM test to verify functionality.
- write
- Write data to PSRAM memory at a specific address.
- write8
- Write an 8-bit value to a specific PSRAM address.
- write16
- Write a 16-bit value to a specific PSRAM address.
- write32
- Write a 32-bit value to a specific PSRAM address.
- write32_bulk
- Write multiple 32-bit values to PSRAM starting at a specific address.
- read
- Read data from PSRAM memory at a specific address.
- read8
- Read an 8-bit value from a specific PSRAM address.
- read16
- Read a 16-bit value from a specific PSRAM address.
- read32
- Read a 32-bit value from a specific PSRAM address.
- read32_bulk
- Read multiple 32-bit values from PSRAM starting at a specific address.
- fill
- Fill a region of PSRAM memory with a specific byte value.
- copy
- Copy data from one PSRAM location to another.
- alloc_object
- Allocate PSRAM memory for a Python object and return a PSRAMObject
- get_next_free
- Get the next free PSRAM memory address.
- mem_free
- Get the amount of free PSRAM memory in bytes.
- collect
- Compact PSRAM free list, Returns the total moved.
- malloc
- Allocate PSRAM memory for the given data and return a PSRAMObject.
- memcpy
- Copy memory from one PSRAM location to another.
- memset
- Set memory region to a specific byte value using DMA-optimized fill.
| Method | from |
Load data from a file into PSRAM memory. |
| Method | malloc |
Allocate PSRAM memory for the given data. |
| Method | memcpy |
Copy memory from one PSRAM location to another. |
| Method | memset |
Set a memory region to a specific byte value. |
| Property | free |
Get free PSRAM memory in bytes. |
| Property | next |
Get the next free PSRAM memory address. |
| Property | total |
Get total PSRAM memory size in bytes. |
| Property | used |
Get used PSRAM memory in bytes. |
Load data from a file into PSRAM memory.
| Parameters | |
storage:object | Storage instance used to read the file. |
addr:int | PSRAM address to write the data to. |
filestr | Path of the file to load. |
chunkint | Number of bytes to read per chunk. Defaults to 2048. |
| Returns | |
int | The size of the data loaded, or -1 if the file could not be opened. |
Allocate PSRAM memory for the given data.
| Parameters | |
data:object | The Python object to store in PSRAM. |
| Returns | |
PSRAMObject | A PSRAMObject wrapping the data. |
Copy memory from one PSRAM location to another.
| Parameters | |
destint | Destination PSRAM address. |
srcint | Source PSRAM address. |
length:int | Number of bytes to copy. |