I2cEeprom

Description

The I2cEeprom object implements a driver for I2C-based EEPROMs, usually referred to as AT24 or similar. The data in the EEPROM can be mapped into the data property

This object was introduced in InCore 2.0.

› Inherits:I2cDevice

Properties

data

This property holds a mapped data buffer containing the EEPROM data starting from dataAddress. It’s cached and only read again whenever dataAddress or dataSize are changed.

› Type:ByteArray
› Signal:dataChanged()
› Attributes:Readonly

dataAddress

This property holds the address where to start reading data from the EEPROM.

› Type:UnsignedInteger
› Default:0
› Signal:dataAddressChanged()
› Attributes:Writable

dataSize

This property holds the number of bytes to read from the EEPROM into the data property.

› Type:UnsignedInteger
› Default:0
› Signal:dataSizeChanged()
› Attributes:Writable

Methods

read(UnsignedInteger startAddress, UnsignedInteger bytes)

This method reads – starting from a given address – the specified number of bytes from the EEPROM.

› Returns:ArrayBuffer

Example

import InCore.Foundation 2.5
import InCore.IO 2.5

Application {
    FtdiI2cBus {
        I2cEeprom {
            id: eeprom
            address: 0x50
            dataAddress: 0x0
            dataSize: 16
        }
    }

    onCompleted: console.log(eeprom.data.hex)
}