Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
eeprom.h
Go to the documentation of this file.
1 #pragma once
3 #include <stdint.h>
4 #include <stddef.h>
5 
6 namespace hal {
7 
9 namespace eeprom {
10 
11 class EEPROM {
12 public:
13 #ifdef UNITTEST
14  using addr_t = size_t;
15 #else
16  using addr_t = uint16_t;
17 #endif
18 
19  static void WriteByte(addr_t addr, uint8_t value);
20  static void UpdateByte(addr_t addr, uint8_t value);
21  static uint8_t ReadByte(addr_t addr);
22 
26  static uint8_t ReadByte(addr_t addr, uint8_t defaultValue);
27 
28  static void WriteWord(addr_t addr, uint16_t value);
29  static void UpdateWord(addr_t addr, uint16_t value);
30  static uint16_t ReadWord(addr_t addr);
31 
34  constexpr static addr_t End() { return 2048; }
35 };
36 
37 extern EEPROM eeprom;
38 
39 } // namespace EEPROM
40 } // namespace hal
Definition: eeprom.h:11
constexpr static addr_t End()
Definition: eeprom.h:34