@@ -59,29 +59,37 @@ class I2CEEBlockDevice : public BlockDevice {
59
59
public:
60
60
/* * Constructor to create an I2CEEBlockDevice on I2C pins
61
61
*
62
- * @param sda The pin name for the sda line of the I2C bus.
63
- * @param scl The pin name for the scl line of the I2C bus.
64
- * @param addr The 8bit I2C address of the chip, common range 0xa0 - 0xae.
65
- * @param size The size of the device in bytes
66
- * @param block The page size of the device in bytes, defaults to 32bytes
67
- * @param freq The frequency of the I2C bus, defaults to 400K.
62
+ * @param sda The pin name for the sda line of the I2C bus.
63
+ * @param scl The pin name for the scl line of the I2C bus.
64
+ * @param addr The 8bit I2C address of the chip, common range 0xa0 - 0xae.
65
+ * @param size The size of the device in bytes
66
+ * @param block The page size of the device in bytes, defaults to 32bytes
67
+ * @param freq The frequency of the I2C bus, defaults to 400K.
68
+ * @param address_is_eight_bit Specifies whether the EEPROM device is using eight bit
69
+ * addresses instead of 16 bit addresses. This should not be needed
70
+ * unless dealing with very cheap devices.
68
71
*/
69
72
I2CEEBlockDevice (
70
73
PinName sda, PinName scl, uint8_t address,
71
74
bd_size_t size, bd_size_t block = 32 ,
72
- int bus_speed = 400000 );
75
+ int bus_speed = 400000 ,
76
+ bool address_is_eight_bit = false );
73
77
74
78
/* * Constructor to create an I2CEEBlockDevice on I2C pins
75
- *
76
- * @param i2c The I2C instance pointer
77
- * @param addr The 8bit I2C address of the chip, common range 0xa0 - 0xae.
78
- * @param size The size of the device in bytes
79
- * @param block The page size of the device in bytes, defaults to 32bytes
80
- * @param freq The frequency of the I2C bus, defaults to 400K.
81
- */
79
+ *
80
+ * @param i2c The I2C instance pointer
81
+ * @param addr The 8bit I2C address of the chip, common range 0xa0 - 0xae.
82
+ * @param size The size of the device in bytes
83
+ * @param block The page size of the device in bytes, defaults to 32bytes
84
+ * @param freq The frequency of the I2C bus, defaults to 400K.
85
+ * @param address_is_eight_bit Specifies whether the EEPROM device is using eight bit
86
+ * addresses instead of 16 bit addresses. This should not be needed
87
+ * unless dealing with very cheap devices.
88
+ */
82
89
I2CEEBlockDevice (
83
90
mbed::I2C *i2c_obj, uint8_t address,
84
- bd_size_t size, bd_size_t block = 32 );
91
+ bd_size_t size, bd_size_t block = 32 ,
92
+ bool address_is_eight_bit = false );
85
93
86
94
/* * Destructor of I2CEEBlockDevice
87
95
*/
@@ -169,6 +177,8 @@ class I2CEEBlockDevice : public BlockDevice {
169
177
uint32_t _size;
170
178
uint32_t _block;
171
179
180
+ bool _address_is_eight_bit;
181
+
172
182
int _sync ();
173
183
};
174
184
0 commit comments