Skip to content

Commit 3c3fe12

Browse files
committed
Cleanup
1 parent 79102bc commit 3c3fe12

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

examples/Block/Block.ino

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
#include "Storage.h"
22
#include "TWI.h"
33
#include "Driver/AT24CXX.h"
4-
#include "Driver/EEPROM.h"
54

65
// Configure: TWI bus manager
76
#define USE_SOFTWARE_TWI
8-
// #define USE_HARDWARE_TWI
97

108
// Configure: Hardware TWI bus clock frequency
11-
// #define FREQ 800000UL
12-
#define FREQ 400000UL
9+
#define FREQ 800000UL
10+
// #define FREQ 400000UL
1311
// #define FREQ 100000UL
1412

1513
#if defined(USE_SOFTWARE_TWI)
1614
#include "GPIO.h"
1715
#include "Software/TWI.h"
1816
Software::TWI<BOARD::D18, BOARD::D19> twi;
19-
#elif defined(USE_HARDWARE_TWI)
17+
#else
2018
#include "Hardware/TWI.h"
2119
Hardware::TWI twi(FREQ);
2220
#endif
2321

24-
// Configure: EEPROM storage
25-
AT24C32 eeprom(twi);
26-
// EEPROM eeprom;
22+
AT24C32 eeprom(twi, 7);
23+
// AT24C32 eeprom(twi);
2724

2825
const uint32_t BLOCK_MAX = 16*eeprom.PAGE_MAX;
2926
Storage::Block block(eeprom, BLOCK_MAX);
@@ -33,6 +30,12 @@ void setup()
3330
Serial.begin(57600);
3431
while (!Serial);
3532

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+
3639
// Initiate eeprom; fill block with zero
3740
uint8_t page[eeprom.PAGE_MAX];
3841
memset(page, 0, sizeof(page));

0 commit comments

Comments
 (0)