memorymap module allows you to read and write memory addresses in the
address space seen from the processor running CircuitPython. It is usually
the physical address space.
Available on these boards
- class memorymap.AddressRange(*, start, length)¶
Presents a range of addresses as a bytearray.
The addresses may access memory or memory mapped peripherals.
Some address ranges may be protected by CircuitPython to prevent errors. An exception will be raised when constructing an AddressRange for an invalid or protected address.
Multiple AddressRanges may overlap. There is no “claiming” of addresses.
Example usage on ESP32-S2:
import memorymap rtc_slow_mem = memorymap.AddressRange(start=0x50000000, length=0x2000) rtc_slow_mem[0:3] = b"\xcc\x10\x00"
Constructs an address range starting at
startand ending at
start + length. An exception will be raised if any of the addresses are invalid or protected.
- __getitem__(index: slice) bytearray ¶
- __getitem__(index: int) int
Returns the value(s) at the given index.
1, 2, 4 and 8 byte aligned reads will be done in one transaction. All others may use multiple transactions.