This driver supports Fujitsu MB85RC256V I2C FRAM.
It's based on Arduino library for I2C FRAM and will eventually support all devices listed there.
Ferroelectric RAM (FeRAM, F-RAM or FRAM) is a random-access memory similar in construction to DRAM but using a ferroelectric layer instead of a dielectric layer to achieve non-volatility.
To use the fram
driver, simply add the line below to your project's build.gradle
,
where <version>
matches the last version of the driver available on jcenter .
dependencies {
implementation 'com.knobtviker.android.things.contrib.community.driver:fram:<version>'
}
import com.knobtviker.android.things.contrib.community.driver.fram.Mb85rc256v;
// Access the FRAM device:
Mb85rc256v fram;
try {
//default constructor with default write protection pin and status
fram = new Mb85rc256v(i2cBusName);
} catch (IOException e) {
// couldn't configure the device...
}
// Reads one byte from the specified FRAM address
try {
final byte valueToRead = fram.readByte(0);
} catch (IOException e) {
// error reading value from address
}
// Write one byte from the specified FRAM address
try {
final byte valueToWrite = 111;
fram.writeByte(0, valueToWrite);
} catch (IOException e) {
// error writing value to address
}
// Close the FRAM device when finished:
try {
fram.close();
} catch (IOException e) {
// error closing device
}