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 
9 #pragma once
10 
24 #include <stdint.h>
25 
26 #include "periph_cpu.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #ifndef EEPROM_SIZE
33 #error "periph/eeprom: EEPROM_SIZE is not defined"
34 #endif
35 
39 #ifndef EEPROM_CLEAR_BYTE
40 #define EEPROM_CLEAR_BYTE 0x00
41 #endif
42 
50 uint8_t eeprom_read_byte(uint32_t pos);
51 
64 size_t eeprom_read(uint32_t pos, void *data, size_t len);
65 
72 void eeprom_write_byte(uint32_t pos, uint8_t data);
73 
86 size_t eeprom_write(uint32_t pos, const void *data, size_t len);
87 
97 size_t eeprom_set(uint32_t pos, uint8_t val, size_t len);
98 
109 size_t eeprom_clear(uint32_t pos, size_t len);
110 
116 size_t eeprom_erase(void);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
size_t eeprom_clear(uint32_t pos, size_t len)
Clear len bytes from the given position pos.
uint8_t eeprom_read_byte(uint32_t pos)
Read a byte at the given position in eeprom.
void eeprom_write_byte(uint32_t pos, uint8_t data)
Write a byte at the given position.
size_t eeprom_read(uint32_t pos, void *data, size_t len)
Read len bytes from the given position.
size_t eeprom_erase(void)
Erase the whole EEPROM content.
size_t eeprom_write(uint32_t pos, const void *data, size_t len)
Write len bytes at the given position.
size_t eeprom_set(uint32_t pos, uint8_t val, size_t len)
Set len bytes from the given position pos with value val.