Speeduino
Loading...
Searching...
No Matches
board_eeprom_adapter.hpp
Go to the documentation of this file.
1
12#pragma once
13#include "storage_api.h"
14
15namespace EEPROMApi {
16
17 static inline byte read(uint16_t address)
18 {
19 return EEPROM.read(address);
20 }
21 static inline void write(uint16_t address, byte val)
22 {
23 (void)EEPROM.write(address, val);
24 }
25 static inline uint16_t length(void)
26 {
27 return EEPROM.length();
28 }
29}
30
32storage_api_t getEEPROMStorageApi(uint16_t (*getMaxWriteBlockSize)(const statuses &))
33{
34 return {
36 .write = EEPROMApi::write,
37 .length = EEPROMApi::length,
38 .getMaxWriteBlockSize = getMaxWriteBlockSize,
39 };
40}
storage_api_t getEEPROMStorageApi(uint16_t(*getMaxWriteBlockSize)(const statuses &))
Get the EEPROM storage API for the board.
Definition board_eeprom_adapter.hpp:32
Definition board_eeprom_adapter.hpp:15
static void write(uint16_t address, byte val)
Definition board_eeprom_adapter.hpp:21
static byte read(uint16_t address)
Definition board_eeprom_adapter.hpp:17
static uint16_t length(void)
Definition board_eeprom_adapter.hpp:25
Defines the required external storage API plus some convenience functions built around that API.
The status struct with current values for all 'live' variables.
Definition statuses.h:36
The external storage API. This must be supported by any storage system. E.g. EEPROM,...
Definition storage_api.h:18
byte(* read)(uint16_t address)
Function to read a single byte from storage.
Definition storage_api.h:20