17 #ifndef MBED_I2CEEPROM_BLOCK_DEVICE_H 18 #define MBED_I2CEEPROM_BLOCK_DEVICE_H 20 #include "blockdevice/BlockDevice.h" 21 #include "drivers/I2C.h" 74 PinName sda, PinName scl, uint8_t address,
75 bd_size_t
size, bd_size_t block = 32,
76 int bus_speed = 400000,
77 bool address_is_eight_bit =
false);
92 bd_size_t size, bd_size_t block = 32,
93 bool address_is_eight_bit =
false);
119 virtual int read(
void *buffer, bd_addr_t addr, bd_size_t size);
130 virtual int program(
const void *buffer, bd_addr_t addr, bd_size_t size);
140 virtual int erase(bd_addr_t addr, bd_size_t size);
166 virtual bd_size_t
size()
const;
172 virtual const char *
get_type()
const;
176 uint32_t _i2c_buffer[
sizeof(
mbed::I2C) /
sizeof(uint32_t)];
178 bool _address_is_eight_bit;
192 uint8_t get_paged_device_address(bd_addr_t address);
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.
I2CEEBlockDevice(PinName sda, PinName scl, uint8_t address, bd_size_t size, bd_size_t block=32, int bus_speed=400000, bool address_is_eight_bit=false)
Constructor to create an I2CEEBlockDevice on I2C pins.
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.