Driver for the AT25xxx series of EEPROMs.
More...
Driver for the AT25xxx series of EEPROMs.
- Author
- Benjamin Valentin benja.nosp@m.min..nosp@m.valen.nosp@m.tin@.nosp@m.ml-pa.nosp@m..com
Definition in file at25xxx.h.
#include <stdint.h>
#include <stdbool.h>
#include "periph/spi.h"
#include "periph/gpio.h"
Go to the source code of this file.
|
int | at25xxx_init (at25xxx_t *dev, const at25xxx_params_t *params) |
| Initialize an AT25XXX device handle with AT25XXX parameters. More...
|
|
uint8_t | at25xxx_read_byte (const at25xxx_t *dev, uint32_t pos) |
| Read a byte at a given position pos . More...
|
|
int | at25xxx_read (const at25xxx_t *dev, uint32_t pos, void *data, size_t len) |
| Sequentially read len bytes from a given position pos . More...
|
|
void | at25xxx_write_byte (const at25xxx_t *dev, uint32_t pos, uint8_t data) |
| Write a byte at a given position pos . More...
|
|
int | at25xxx_write (const at25xxx_t *dev, uint32_t pos, const void *data, size_t len) |
| Sequentially write len bytes from a given position pos . More...
|
|
int | at25xxx_write_page (const at25xxx_t *dev, uint32_t page, uint32_t offset, const void *data, size_t len) |
| Sequentially write len bytes to a given page . More...
|
|
int | at25xxx_set (const at25xxx_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 | at25xxx_clear (const at25xxx_t *dev, uint32_t pos, size_t len) |
| Set len bytes from position pos to 0. More...
|
|
◆ at25xxx_clear()
int at25xxx_clear |
( |
const at25xxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
size_t |
len |
|
) |
| |
Set len
bytes from position pos
to 0.
This is a wrapper around
- See also
- at25xxx_set.
- Parameters
-
[in] | dev | AT25XXX device handle |
[in] | pos | position in EEPROM memory |
[in] | len | requested length to be written |
- Returns
- 0 on success
-
-ERANGE if pos + len > EEPROM size
◆ at25xxx_init()
Initialize an AT25XXX device handle with AT25XXX parameters.
- Parameters
-
[in,out] | dev | AT25XXX device handle |
[in] | params | AT25XXX parameters |
- Returns
- 0 on success, -1 on failure
◆ at25xxx_read()
int at25xxx_read |
( |
const at25xxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
void * |
data, |
|
|
size_t |
len |
|
) |
| |
Sequentially read len
bytes from a given position pos
.
- Parameters
-
[in] | dev | AT25XXX device handle |
[in] | pos | position in EEPROM memory |
[out] | data | read buffer |
[in] | len | requested length to be read |
- Returns
- 0 on success
-
-ERANGE if pos + len > EEPROM size
◆ at25xxx_read_byte()
uint8_t at25xxx_read_byte |
( |
const at25xxx_t * |
dev, |
|
|
uint32_t |
pos |
|
) |
| |
Read a byte at a given position pos
.
- Parameters
-
[in] | dev | AT25XXX device handle |
[in] | pos | position in EEPROM memory |
- Returns
- read byte
◆ at25xxx_set()
int at25xxx_set |
( |
const at25xxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
uint8_t |
val, |
|
|
size_t |
len |
|
) |
| |
Set len
bytes from a given position pos
to the value val
.
- Parameters
-
[in] | dev | AT25XXX device handle |
[in] | pos | position in EEPROM memory |
[in] | val | value to be set |
[in] | len | requested length to be written |
- Returns
- 0 on success
-
-ERANGE if pos + len > EEPROM size
◆ at25xxx_write()
int at25xxx_write |
( |
const at25xxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
const void * |
data, |
|
|
size_t |
len |
|
) |
| |
Sequentially write len
bytes from a given position pos
.
- Parameters
-
[in] | dev | AT25XXX device handle |
[in] | pos | position in EEPROM memory |
[in] | data | write buffer |
[in] | len | requested length to be written |
- Returns
- 0 on success
-
-ERANGE if pos + len > EEPROM size
◆ at25xxx_write_byte()
void at25xxx_write_byte |
( |
const at25xxx_t * |
dev, |
|
|
uint32_t |
pos, |
|
|
uint8_t |
data |
|
) |
| |
Write a byte at a given position pos
.
- Parameters
-
[in] | dev | AT25XXX device handle |
[in] | pos | position in EEPROM memory |
[in] | data | value to be written |
◆ at25xxx_write_page()
int at25xxx_write_page |
( |
const at25xxx_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.
- Parameters
-
[in] | dev | AT25XXX 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