File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
1
#include " Storage.h"
2
2
#include " TWI.h"
3
3
#include " Driver/AT24CXX.h"
4
- #include " Driver/EEPROM.h"
5
4
6
5
// Configure: TWI bus manager
7
6
#define USE_SOFTWARE_TWI
8
- // #define USE_HARDWARE_TWI
9
7
10
8
// Configure: Hardware TWI bus clock frequency
11
- // #define FREQ 800000UL
12
- #define FREQ 400000UL
9
+ #define FREQ 800000UL
10
+ // #define FREQ 400000UL
13
11
// #define FREQ 100000UL
14
12
15
13
#if defined(USE_SOFTWARE_TWI)
16
14
#include " GPIO.h"
17
15
#include " Software/TWI.h"
18
16
Software::TWI<BOARD::D18, BOARD::D19> twi;
19
- #elif defined(USE_HARDWARE_TWI)
17
+ #else
20
18
#include " Hardware/TWI.h"
21
19
Hardware::TWI twi (FREQ);
22
20
#endif
23
21
24
- // Configure: EEPROM storage
25
- AT24C32 eeprom (twi);
26
- // EEPROM eeprom;
22
+ AT24C32 eeprom (twi, 7 );
23
+ // AT24C32 eeprom(twi);
27
24
28
25
const uint32_t BLOCK_MAX = 16 *eeprom.PAGE_MAX;
29
26
Storage::Block block (eeprom, BLOCK_MAX);
@@ -33,6 +30,12 @@ void setup()
33
30
Serial.begin (57600 );
34
31
while (!Serial);
35
32
33
+ // Check that the eeprom is ready
34
+ while (!eeprom.is_ready ()) {
35
+ Serial.println (F (" eeprom:error: check sub-address and wiring" ));
36
+ delay (5000 );
37
+ }
38
+
36
39
// Initiate eeprom; fill block with zero
37
40
uint8_t page[eeprom.PAGE_MAX ];
38
41
memset (page, 0 , sizeof (page));
You can’t perform that action at this time.
0 commit comments