Adafruit SPI FRAM Library
Public Member Functions | List of all members
Adafruit_FRAM_SPI Class Reference

Class that stores state and functions for interacting with FRAM SPI. More...

#include <Adafruit_FRAM_SPI.h>

Public Member Functions

 Adafruit_FRAM_SPI (int8_t cs, SPIClass *theSPI=&SPI, uint32_t freq=1000000)
 Instantiates a new SPI FRAM class using hardware SPI. More...
 
 Adafruit_FRAM_SPI (int8_t clk, int8_t miso, int8_t mosi, int8_t cs)
 Instantiates a new SPI FRAM class using bitbang SPI. More...
 
bool begin (uint8_t nAddressSizeBytes=2)
 Initializes SPI and configures the chip (call this function before doing anything else) More...
 
bool writeEnable (bool enable)
 Enables or disables writing to the SPI flash. More...
 
bool write8 (uint32_t addr, uint8_t value)
 Writes a byte at the specific FRAM address. More...
 
bool write (uint32_t addr, const uint8_t *values, size_t count)
 Writes count bytes starting at the specific FRAM address. More...
 
uint8_t read8 (uint32_t addr)
 Reads an 8 bit value from the specified FRAM address. More...
 
bool read (uint32_t addr, uint8_t *values, size_t count)
 Read count bytes starting at the specific FRAM address. More...
 
bool getDeviceID (uint8_t *manufacturerID, uint16_t *productID)
 Reads the Manufacturer ID and the Product ID from the IC. More...
 
uint8_t getStatusRegister (void)
 Reads the status register. More...
 
bool setStatusRegister (uint8_t value)
 Sets the status register. More...
 
void setAddressSize (uint8_t nAddressSize)
 Sets adress size to provided value. More...
 

Detailed Description

Class that stores state and functions for interacting with FRAM SPI.

Constructor & Destructor Documentation

◆ Adafruit_FRAM_SPI() [1/2]

Adafruit_FRAM_SPI::Adafruit_FRAM_SPI ( int8_t  cs,
SPIClass *  theSPI = &SPI,
uint32_t  freq = 1000000 
)

Instantiates a new SPI FRAM class using hardware SPI.

Parameters
csRequired chip select pin number
*theSPISPI interface object, defaults to &SPI
freqThe SPI clock frequency to use, defaults to 1MHz

◆ Adafruit_FRAM_SPI() [2/2]

Adafruit_FRAM_SPI::Adafruit_FRAM_SPI ( int8_t  clk,
int8_t  miso,
int8_t  mosi,
int8_t  cs 
)

Instantiates a new SPI FRAM class using bitbang SPI.

Parameters
clkCLK pin
misoMISO pin
mosiMOSI pin
csCS pin

Member Function Documentation

◆ begin()

bool Adafruit_FRAM_SPI::begin ( uint8_t  nAddressSizeBytes = 2)

Initializes SPI and configures the chip (call this function before doing anything else)

Parameters
nAddressSizeBytessddress size in bytes (default 2)
Returns
true if successful

◆ writeEnable()

bool Adafruit_FRAM_SPI::writeEnable ( bool  enable)

Enables or disables writing to the SPI flash.

Parameters
enableTrue enables writes, false disables writes
Returns
true if successful

◆ write8()

bool Adafruit_FRAM_SPI::write8 ( uint32_t  addr,
uint8_t  value 
)

Writes a byte at the specific FRAM address.

Parameters
addrThe 32-bit address to write to in FRAM memory
valueThe 8-bit value to write at framAddr
Returns
true if successful

◆ write()

bool Adafruit_FRAM_SPI::write ( uint32_t  addr,
const uint8_t *  values,
size_t  count 
)

Writes count bytes starting at the specific FRAM address.

Parameters
addrThe 32-bit address to write to in FRAM memory
valuesThe pointer to an array of 8-bit values to write starting at addr
countThe number of bytes to write
Returns
true if successful

◆ read8()

uint8_t Adafruit_FRAM_SPI::read8 ( uint32_t  addr)

Reads an 8 bit value from the specified FRAM address.

Parameters
addrThe 32-bit address to read from in FRAM memory
Returns
The 8-bit value retrieved at framAddr

◆ read()

bool Adafruit_FRAM_SPI::read ( uint32_t  addr,
uint8_t *  values,
size_t  count 
)

Read count bytes starting at the specific FRAM address.

Parameters
addrThe 32-bit address to write to in FRAM memory
valuesThe pointer to an array of 8-bit values to read starting at addr
countThe number of bytes to read
Returns
true if successful

◆ getDeviceID()

bool Adafruit_FRAM_SPI::getDeviceID ( uint8_t *  manufacturerID,
uint16_t *  productID 
)

Reads the Manufacturer ID and the Product ID from the IC.

Parameters
manufacturerIDThe 8-bit manufacturer ID (Fujitsu = 0x04)
productIDThe memory density (bytes 15..8) and proprietary Product ID fields (bytes 7..0). Should be 0x0302 for the MB85RS64VPNF-G-JNERE1.
Returns
true if successful

◆ getStatusRegister()

uint8_t Adafruit_FRAM_SPI::getStatusRegister ( void  )

Reads the status register.

Returns
register value

◆ setStatusRegister()

bool Adafruit_FRAM_SPI::setStatusRegister ( uint8_t  value)

Sets the status register.

Parameters
valuevalue that will be set
Returns
true if successful

◆ setAddressSize()

void Adafruit_FRAM_SPI::setAddressSize ( uint8_t  nAddressSize)

Sets adress size to provided value.

Parameters
nAddressSizeaddress size in bytes

The documentation for this class was generated from the following files: