-
Notifications
You must be signed in to change notification settings - Fork 1
FRAM
>>> import navio
>>> nio = navio.Navio()
>>> nio.FRAM_write(0, b'abcdefg')
>>> nio.FRAM_read(0, 7)
b'abcdefg'
>>> # Clear all stored data
>>> nio.FRAM_clear()
>>> # Perform FRAM read/write test
>>> "FRAM test OK!" if nio.FRAM_test() else "FRAM test failed!"
'FRAM test OK!'
instance method FRAM_read(address, length)
Reads length bytes from FRAM, starting at location address.
Returns: (read-only bytes-like object) Data read from FRAM.
Parameters:
- address: (int) Memory address to start the read from. Valid addresses range from 0 to 511 for Navio/Navio RAW and 0 to 32767 for Navio+.
- length: (int) Number of bytes to read. Maximum 127 bytes can be read at once.
raises ValueError if you try to read more than 127 bytes at once.
raises ValueError if you try to read beyond the FRAM boundary.
raises IOError if there is an error reading the data.
instance method FRAM_write(address, data)
Writes data to FRAM, starting at address address.
Returns: None
Parameters:
- address: (int) Memory address to start writing at. Valid addresses range from 0 to 511 for Navio/Navio RAW and 0 to 32767 for Navio+.
- data: (bytes-like object) Data to write. Maximum 127 bytes can be written at once.
raises ValueError if you try to write more than 127 bytes at once.
raises ValueError if you try to write beyond the FRAM boundary.
raises IOError if there is an error writing to the FRAM.
instance method FRAM_clear()
Clears all data stored in FRAM.
Returns: None
raises IOError if there is an error clearing the FRAM.
instance method FRAM_test()
Tests FRAM read/write operations.
This tries to write some data to a random memory location and then read back the same data. It restores the original data at that location when finished. If the test fails, the data at the test location might be partially or fully overwritten by the test-data, so be sure to check all stored data if this happens.Returns: (int) 1 on succes, 0 on failure.