File tree 3 files changed +15
-7
lines changed
SampleProjects/TestSomething/test
3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
8
8
## [ Unreleased]
9
9
### Added
10
- - Support for mock EEPROM (but only if board supports it; added mega2560 to TestSomething config )
10
+ - Support for mock EEPROM (but only if board supports it)
11
11
12
12
### Changed
13
13
- Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci
Original file line number Diff line number Diff line change 1
1
#include < ArduinoUnitTests.h>
2
2
#include < Arduino.h>
3
- #include < EEPROM.h>
4
3
5
- #ifdef EEPROM_SIZE
4
+ // Only run EEPROM tests if there is hardware support!
5
+ #if defined(EEPROM_SIZE) || (defined(E2END) && E2END)
6
+ #include < EEPROM.h>
6
7
7
8
unittest (length)
8
9
{
Original file line number Diff line number Diff line change 4
4
New version by Christopher Andrews 2015.
5
5
6
6
Copy of https://github.com/arduino/ArduinoCore-megaavr/blob/c8a1dd996c783777ec46167cfd8ad3fd2e6df185/libraries/EEPROM/src/EEPROM.h
7
- modified by James Foster 2020 to work with Arduino CI.
7
+ modified by James Foster in 2020 to work with Arduino CI.
8
8
9
9
This library is free software; you can redistribute it and/or
10
10
modify it under the terms of the GNU Lesser General Public
27
27
#include < inttypes.h>
28
28
#include < avr/io.h>
29
29
30
+ // different EEPROM implementations have different macros that leak out
30
31
#if !defined(EEPROM_SIZE) && defined(E2END) && (E2END)
31
32
#define EEPROM_SIZE (E2END + 1 )
32
33
#endif
33
- #ifdef EEPROM_SIZE
34
34
35
- // Is this all the custom code required?
35
+ // Does the current board have EEPROM?
36
+ #ifndef EEPROM_SIZE
37
+ // In lieu of an "EEPROM.h not found" error for unsupported boards
38
+ #error "EEPROM library not available for your board"
39
+ #endif
40
+
41
+ // On a real device this would be in hardware, but we have a mock board!
36
42
static uint8_t eeprom[EEPROM_SIZE];
37
43
inline uint8_t eeprom_read_byte ( uint8_t * index ) { return eeprom[(unsigned long ) index % EEPROM_SIZE]; }
38
44
inline void eeprom_write_byte ( uint8_t * index, uint8_t value ) { eeprom[(unsigned long ) index % EEPROM_SIZE] = value; }
39
45
46
+ // Everything following is from the original (referenced above)
47
+
40
48
/* **
41
49
EERef class.
42
50
@@ -156,4 +164,3 @@ struct EEPROMClass{
156
164
157
165
static EEPROMClass EEPROM;
158
166
#endif
159
- #endif
You can’t perform that action at this time.
0 commit comments