adafruit_fram

CircuitPython/Python library to support the I2C and SPI FRAM Breakouts.

  • Author(s): Michael Schroeder

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_fram.FRAM(max_size, write_protect=False, wp_pin=None)

Driver base for the FRAM Breakout.

__getitem__(key)

Read the value at the given index, or values in a slice.

# read single index
fram[0]

# read values 0 thru 9 with a slice
fram[0:9]
__len__()

The maximum size of the current FRAM chip. This is the highest register location that can be read or written to.

fram = adafruit_fram.FRAM_xxx() # xxx = 'I2C' or 'SPI'

# maximum size returned by len()
len(fram)

# can be used with range
for i in range(0, len(fram))
__setitem__(key, value)

Write the value at the given starting index.

# write single index
fram[0] = 1

# write values 0 thru 4 with a list
fram[0] = [0,1,2,3]
write_protected

The status of write protection. Default value on initialization is False.

When a WP pin is supplied during initialization, or using write_protect_pin, the status is tied to that pin and enables hardware-level protection.

When no WP pin is supplied, protection is only at the software level in this library.

write_wraparound

Determines if sequential writes will wrapaound highest memory address (len(FRAM)) address. If False, and a requested write will extend beyond the maximum size, an exception is raised.

class adafruit_fram.FRAM_I2C(i2c_bus, address=80, write_protect=False, wp_pin=None)

I2C class for FRAM.

Param:~busio.I2C i2c_bus: The I2C bus the FRAM is connected to.
Param:int address: I2C address of FRAM. Default address is 0x50.
Param:bool write_protect: Turns on/off initial write protection. Default is False.
Param:wp_pin: (Optional) Physical pin connected to the WP breakout pin. Must be a digitalio.DigitalInOut object.