Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MB85RCxx_I2C Class Reference
Interface for accessing Fujitsu MB85RCxx FRAM. More...
#include <MB85RCxx_I2C.h>
Public Member Functions | |
MB85RCxx_I2C (PinName sda, PinName scl, char slave_adr=MB85RC_I2C_ADDRESS) | |
Create an MB85RCxx_I2C instance which is connected to specified I2C pins with specified address. | |
virtual | ~MB85RCxx_I2C () |
Destructor of MB85RCxx_I2C. | |
int | read_device_id (char *device_id) |
Read device ID from MB85RCxx FRAM. | |
void | read (uint32_t address, char *data, uint32_t length) |
Read data from memory address. | |
void | write (uint32_t address, char *data, uint32_t length) |
Write data to memory address. | |
void | write (uint32_t address, char data) |
Write data to memory address. | |
void | fill (uint32_t address, uint8_t data, uint32_t length) |
Fill data to memory address. |
Detailed Description
Interface for accessing Fujitsu MB85RCxx FRAM.
#include "mbed.h" #include "MB85RCxx_I2C.h" Serial pc(USBTX, USBRX); #if defined(TARGET_LPC1768) MB85RCxx_I2C fram(p28, p27); #else MB85RCxx_I2C fram(D14, D15); #endif int main() { char buf[16]; uint32_t address; fram.fill(0, 0, 256); for (int i = 0; i < 16; i++) { buf[i] = i; } fram.write(0, buf, 16); for (address = 0; address < 0x80; address += 16) { fram.read(address, buf, 16); pc.printf("%08X : ", address); for (int i = 0; i < 16; i++) { pc.printf("%02X ", buf[i]); } pc.printf("\n"); } }
MB85RCxx_I2C class
MB85RCxx_I2C: A library to access Fujitsu MB85RCxx_I2C FRAM
Definition at line 88 of file MB85RCxx_I2C.h.
Constructor & Destructor Documentation
MB85RCxx_I2C | ( | PinName | sda, |
PinName | scl, | ||
char | slave_adr = MB85RC_I2C_ADDRESS |
||
) |
Create an MB85RCxx_I2C instance which is connected to specified I2C pins with specified address.
- Parameters:
-
sda I2C data line pin scl I2C clock line pin slave_adr (option) I2C slave address (default: 0xA0)
Definition at line 32 of file MB85RCxx_I2C.cpp.
~MB85RCxx_I2C | ( | ) | [virtual] |
Destructor of MB85RCxx_I2C.
Definition at line 41 of file MB85RCxx_I2C.cpp.
Member Function Documentation
void fill | ( | uint32_t | address, |
uint8_t | data, | ||
uint32_t | length | ||
) |
Fill data to memory address.
- Parameters:
-
address Memory address data data to fill out to memory length Number of bytes to write
Definition at line 90 of file MB85RCxx_I2C.cpp.
void read | ( | uint32_t | address, |
char * | data, | ||
uint32_t | length | ||
) |
Read data from memory address.
- Parameters:
-
address Memory address data Pointer to the byte-array to read data in to length Number of bytes to read
Definition at line 55 of file MB85RCxx_I2C.cpp.
int read_device_id | ( | char * | device_id ) |
Read device ID from MB85RCxx FRAM.
- Parameters:
-
device_id Pointer to the byte-array to read data in to
- Returns:
- memory dencity
Definition at line 47 of file MB85RCxx_I2C.cpp.
void write | ( | uint32_t | address, |
char * | data, | ||
uint32_t | length | ||
) |
Write data to memory address.
- Parameters:
-
address Memory address data Pointer to the byte-array data to write length Number of bytes to write
Definition at line 66 of file MB85RCxx_I2C.cpp.
void write | ( | uint32_t | address, |
char | data | ||
) |
Write data to memory address.
- Parameters:
-
address Memory address data data to write out to memory
Definition at line 79 of file MB85RCxx_I2C.cpp.
Generated on Tue Jul 12 2022 21:16:29 by
