Device driver interface for the AT24CXXX EEPROM units.
More...
Device driver interface for the AT24CXXX EEPROM units.
|
enum | { AT24CXXX_OK,
AT24CXXX_I2C_ERROR
} |
| Return values.
|
|
|
int | at24cxxx_init (at24cxxx_t *dev, const at24cxxx_params_t *params) |
| Initialize an AT24CXXX device handle with AT24CXXX parameters. More...
|
|
int | at24cxxx_read_byte (const at24cxxx_t *dev, uint32_t pos, void *dest) |
| Read a byte at a given position pos . More...
|
|
int | at24cxxx_read (const at24cxxx_t *dev, uint32_t pos, void *data, size_t len) |
| Sequentially read len bytes from a given position pos . More...
|
|
int | at24cxxx_write_byte (const at24cxxx_t *dev, uint32_t pos, uint8_t data) |
| Write a byte at a given position pos . More...
|
|
int | at24cxxx_write (const at24cxxx_t *dev, uint32_t pos, const void *data, size_t len) |
| Sequentially write len bytes from a given position pos . More...
|
|
int | at24cxxx_write_page (const at24cxxx_t *dev, uint32_t page, uint32_t offset, const void *data, size_t len) |
| Sequentially write len bytes to a given page . More...
|
|
int | at24cxxx_set (const at24cxxx_t *dev, uint32_t pos, uint8_t val, size_t len) |
| Set len bytes from a given position pos to the value val . More...
|
|
int | at24cxxx_clear (const at24cxxx_t *dev, uint32_t pos, size_t len) |
| Set len bytes from position pos to AT24CXXX_CLEAR_BYTE. More...
|
|
int | at24cxxx_erase (const at24cxxx_t *dev) |
| Set the entire EEPROM memory to AT24CXXX_CLEAR_BYTE. More...
|
|
int | at24cxxx_enable_write_protect (const at24cxxx_t *dev) |
| Enable write protection. More...
|
|
int | at24cxxx_disable_write_protect (const at24cxxx_t *dev) |
| Disable write protection. More...
|
|
◆ at24cxxx_clear()
int at24cxxx_clear |
( |
const at24cxxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
size_t |
len |
|
) |
| |
Set len
bytes from position pos
to AT24CXXX_CLEAR_BYTE.
This is a wrapper around
- See also
- at24cxxx_set.
- Parameters
-
[in] | dev | AT24CXXX device handle |
[in] | pos | Position in EEPROM memory |
[in] | len | Requested length to be written |
- Returns
- See also
- at24cxxx_set
◆ at24cxxx_disable_write_protect()
int at24cxxx_disable_write_protect |
( |
const at24cxxx_t * |
dev | ) |
|
Disable write protection.
- Parameters
-
[in] | dev | AT24CXXX device handle |
- Returns
- AT24CXXX_OK on success
-
-ENOTSUP if pin_wp was initialized with GPIO_UNDEF
◆ at24cxxx_enable_write_protect()
int at24cxxx_enable_write_protect |
( |
const at24cxxx_t * |
dev | ) |
|
Enable write protection.
- Parameters
-
[in] | dev | AT24CXXX device handle |
- Returns
- AT24CXXX_OK on success
-
-ENOTSUP if pin_wp was initialized with GPIO_UNDEF
◆ at24cxxx_erase()
Set the entire EEPROM memory to AT24CXXX_CLEAR_BYTE.
This is a wrapper around
- See also
- at24cxxx_clear.
- Parameters
-
[in] | dev | AT24CXXX device handle |
- Returns
- See also
- at24cxxx_set
◆ at24cxxx_init()
Initialize an AT24CXXX device handle with AT24CXXX parameters.
- Parameters
-
[in,out] | dev | AT24CXXX device handle |
[in] | params | AT24CXXX parameters |
- Returns
- AT24CXXX_OK on success
-
-AT24CXXX_I2C_ERROR if i2c could not be acquired
-
-EINVAL if input parameters are NULL
◆ at24cxxx_read()
int at24cxxx_read |
( |
const at24cxxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
void * |
data, |
|
|
size_t |
len |
|
) |
| |
Sequentially read len
bytes from a given position pos
.
- Parameters
-
[in] | dev | AT24CXXX device handle |
[in] | pos | Position in EEPROM memory |
[out] | data | Read buffer |
[in] | len | Requested length to be read |
- Returns
- AT24CXXX_OK on success
-
-ERANGE if
pos
+ len
is out of bounds
-
- See also
- i2c_read_regs
◆ at24cxxx_read_byte()
int at24cxxx_read_byte |
( |
const at24cxxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
void * |
dest |
|
) |
| |
Read a byte at a given position pos
.
- Parameters
-
[in] | dev | AT24CXXX device handle |
[in] | pos | Position in EEPROM memory |
[out] | dest | Read byte |
- Returns
- AT24CXXX_OK on success
-
-ERANGE if
pos
is out of bounds
-
- See also
- i2c_read_regs
◆ at24cxxx_set()
int at24cxxx_set |
( |
const at24cxxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
uint8_t |
val, |
|
|
size_t |
len |
|
) |
| |
Set len
bytes from a given position pos
to the value val
.
Writing is performed in chunks of size AT24CXXX_SET_BUFFER_SIZE.
- Parameters
-
[in] | dev | AT24CXXX device handle |
[in] | pos | Position in EEPROM memory |
[in] | val | Value to be set |
[in] | len | Requested length to be written |
- Returns
- AT24CXXX_OK on success
-
-ERANGE if
pos
+ len
is out of bounds
-
- See also
- i2c_write_byte
◆ at24cxxx_write()
int at24cxxx_write |
( |
const at24cxxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
const void * |
data, |
|
|
size_t |
len |
|
) |
| |
Sequentially write len
bytes from a given position pos
.
Writing is performed in chunks of size AT24CXXX_PAGE_SIZE.
- Parameters
-
[in] | dev | AT24CXXX device handle |
[in] | pos | Position in EEPROM memory |
[in] | data | Write buffer |
[in] | len | Requested length to be written |
- Returns
- AT24CXXX_OK on success
-
-ERANGE if
pos
+ len
is out of bounds
-
- See also
- i2c_write_regs
◆ at24cxxx_write_byte()
int at24cxxx_write_byte |
( |
const at24cxxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
uint8_t |
data |
|
) |
| |
Write a byte at a given position pos
.
- Parameters
-
[in] | dev | AT24CXXX device handle |
[in] | pos | Position in EEPROM memory |
[in] | data | Value to be written |
- Returns
- AT24CXXX_OK on success
-
-ERANGE if
pos
is out of bounds
-
- See also
- i2c_write_regs
◆ at24cxxx_write_page()
int at24cxxx_write_page |
( |
const at24cxxx_t * |
dev, |
|
|
uint32_t |
page, |
|
|
uint32_t |
offset, |
|
|
const void * |
data, |
|
|
size_t |
len |
|
) |
| |
Sequentially write len
bytes to a given page
.
The function will write up to the page boundary and then return the number of bytes written up to that.
- Parameters
-
[in] | dev | AT24CXXX device handle |
[in] | page | page of EEPROM memory |
[in] | offset | offset from the start of the page, must be < page size |
[in] | data | write buffer |
[in] | len | requested length to be written |
- Returns
- number of bytes written on success
-
error on failure