Documentation ¶
Overview ¶
Package at24cx provides a driver for the AT24C32/64/128/256/512 2-wire serial EEPROM
Datasheet: https://www.openimpulse.com/blog/wp-content/uploads/wpsc/downloadables/24C32-Datasheet.pdf
Index ¶
- Constants
- type Config
- type Device
- func (d *Device) Configure(cfg Config)
- func (d *Device) Read(data []uint8) (n int, err error)
- func (d *Device) ReadAt(data []byte, offset int64) (n int, err error)
- func (d *Device) ReadByte(eepromAddress uint16) (uint8, error)
- func (d *Device) Seek(offset int64, whence int) (int64, error)
- func (d *Device) Write(data []byte) (n int, err error)
- func (d *Device) WriteAt(data []byte, offset int64) (n int, err error)
- func (d *Device) WriteByte(eepromAddress uint16, value uint8) error
Constants ¶
const Address = 0x57
The I2C address which this device listens to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Address uint16 // contains filtered or unexported fields }
Device wraps an I2C connection to a DS3231 device.
func New ¶
New creates a new AT24C32/64 connection. The I2C bus must already be configured.
This function only creates the Device object, it does not touch the device.
func (*Device) Read ¶
Read reads len(data) from SRAM returns number of bytes written and error, if any
func (*Device) Seek ¶
Seek sets the offset for the next Read or Write on SRAM to offset, interpreted according to whence: 0 means relative to the origin of the SRAM, 1 means relative to the current offset, and 2 means relative to the end. returns new offset and error, if any
func (*Device) Write ¶
Write writes len(data) bytes to SRAM returns number of bytes written and error, if any