eeprom.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef PERIPH_EEPROM_H
23 #define PERIPH_EEPROM_H
24 
25 #include <stdint.h>
26 
27 #include "periph_cpu.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #ifndef EEPROM_SIZE
34 #error "periph/eeprom: EEPROM_SIZE is not defined"
35 #endif
36 
40 #ifndef EEPROM_CLEAR_BYTE
41 #define EEPROM_CLEAR_BYTE 0x00
42 #endif
43 
51 uint8_t eeprom_read_byte(uint32_t pos);
52 
65 size_t eeprom_read(uint32_t pos, void *data, size_t len);
66 
73 void eeprom_write_byte(uint32_t pos, uint8_t data);
74 
87 size_t eeprom_write(uint32_t pos, const void *data, size_t len);
88 
98 size_t eeprom_set(uint32_t pos, uint8_t val, size_t len);
99 
110 size_t eeprom_clear(uint32_t pos, size_t len);
111 
117 size_t eeprom_erase(void);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* PERIPH_EEPROM_H */
124 
eeprom_write_byte
void eeprom_write_byte(uint32_t pos, uint8_t data)
Write a byte at the given position.
eeprom_read
size_t eeprom_read(uint32_t pos, void *data, size_t len)
Read len bytes from the given position.
eeprom_clear
size_t eeprom_clear(uint32_t pos, size_t len)
Clear len bytes from the given position pos.
eeprom_erase
size_t eeprom_erase(void)
Erase the whole EEPROM content.
eeprom_write
size_t eeprom_write(uint32_t pos, const void *data, size_t len)
Write len bytes at the given position.
eeprom_set
size_t eeprom_set(uint32_t pos, uint8_t val, size_t len)
Set len bytes from the given position pos with value val.
eeprom_read_byte
uint8_t eeprom_read_byte(uint32_t pos)
Read a byte at the given position in eeprom.