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,
76 int bus_speed = 400000,
77 bool address_is_eight_bit =
false);
92 bool address_is_eight_bit =
false);
175 uint32_t _i2c_buffer[
sizeof(
mbed::I2C) /
sizeof(uint32_t)];
177 bool _address_is_eight_bit;
BlockDevice for I2C based flash device such as Microchip's 24LC or ATMEL's AT24C ranges.
virtual const char * get_type() const
Get the BlockDevice class type.
virtual mbed::bd_size_t get_read_size() const
Get the size of a readable block.
virtual int read(void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size)
Read blocks from a block device.
virtual int program(const void *buffer, mbed::bd_addr_t addr, mbed::bd_size_t size)
Program blocks to a block device.
I2CEEBlockDevice(PinName sda, PinName scl, uint8_t address, mbed::bd_size_t size, mbed::bd_size_t block=32, int bus_speed=400000, bool address_is_eight_bit=false)
Constructor to create an I2CEEBlockDevice on I2C pins.
virtual mbed::bd_size_t get_program_size() const
Get the size of a programable block.
virtual mbed::bd_size_t size() const
Get the total size of the underlying device.
I2CEEBlockDevice(mbed::I2C *i2c_obj, uint8_t address, mbed::bd_size_t size, mbed::bd_size_t block=32, bool address_is_eight_bit=false)
Constructor to create an I2CEEBlockDevice using the pins and frequency of an existing I2C bus.
virtual mbed::bd_size_t get_erase_size() const
Get the size of a eraseable block.
virtual int deinit()
Deinitialize a block device.
virtual int erase(mbed::bd_addr_t addr, mbed::bd_size_t size)
Erase blocks on a block device.
virtual ~I2CEEBlockDevice()
Destructor of I2CEEBlockDevice.
virtual int init()
Initialize a block device.
A hardware device capable of writing and reading blocks.
An I2C Master, used for communicating with I2C slave devices.
uint64_t bd_size_t
Type representing a quantity of 8-bit bytes.
uint64_t bd_addr_t
Type representing the address of a specific block.