16 #ifndef MBED_I2CEEPROM_BLOCK_DEVICE_H 17 #define MBED_I2CEEPROM_BLOCK_DEVICE_H 19 #include "features/storage/blockdevice/BlockDevice.h" 20 #include "drivers/I2C.h" 70 PinName sda, PinName scl, uint8_t address,
71 bd_size_t
size, bd_size_t block = 32,
72 int bus_speed = 400000);
84 bd_size_t size, bd_size_t block = 32);
110 virtual int read(
void *buffer, bd_addr_t addr, bd_size_t size);
121 virtual int program(
const void *buffer, bd_addr_t addr, bd_size_t size);
131 virtual int erase(bd_addr_t addr, bd_size_t size);
157 virtual bd_size_t
size()
const;
163 virtual const char *
get_type()
const;
167 uint32_t _i2c_buffer[
sizeof(
mbed::I2C) /
sizeof(uint32_t)];
I2CEEBlockDevice(PinName sda, PinName scl, uint8_t address, bd_size_t size, bd_size_t block=32, int bus_speed=400000)
Constructor to create an I2CEEBlockDevice on I2C pins.
virtual bd_size_t size() const
Get the total size of the underlying device.
virtual int erase(bd_addr_t addr, bd_size_t size)
Erase blocks on a block device.
virtual bd_size_t get_read_size() const
Get the size of a readable block.
A hardware device capable of writing and reading blocks.
virtual int deinit()
Deinitialize a block device.
An I2C Master, used for communicating with I2C slave devices.
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size)
Program blocks to a block device.
virtual bd_size_t get_erase_size() const
Get the size of a eraseable block.
virtual int init()
Initialize a block device.
virtual ~I2CEEBlockDevice()
Destructor of I2CEEBlockDevice.
virtual int read(void *buffer, bd_addr_t addr, bd_size_t size)
Read blocks from a block device.
virtual const char * get_type() const
Get the BlockDevice class type.
virtual bd_size_t get_program_size() const
Get the size of a programable block.
BlockDevice for I2C based flash device such as Microchip's 24LC or ATMEL's AT24C ranges.