Skip to content

Commit 130f41a

Browse files
author
Nathan Seidle
committed
Remove F() from ex 1. Change output on ex5 to "Buffer Write Test" to avoid String support (none) confusion.
1 parent ca96177 commit 130f41a

File tree

2 files changed

+45
-31
lines changed

2 files changed

+45
-31
lines changed

examples/Example1_BasicReadWrite/Example1_BasicReadWrite.ino

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,27 @@ ExternalEEPROM myMem;
2727
void setup()
2828
{
2929
Serial.begin(115200);
30-
delay(10);
31-
Serial.println(F("Qwiic EEPROM example"));
30+
Serial.println("Qwiic EEPROM example");
3231

3332
Wire.begin();
3433

3534
if (myMem.begin() == false)
3635
{
37-
Serial.println(F("No memory detected. Freezing."));
38-
while (1);
36+
Serial.println("No memory detected. Freezing.");
37+
while (1)
38+
;
3939
}
40-
Serial.println(F("Memory detected!"));
40+
Serial.println("Memory detected!");
4141

42-
Serial.print(F("Mem size in bytes: "));
42+
Serial.print("Mem size in bytes: ");
4343
Serial.println(myMem.length());
4444

4545
//Yes you can read and write bytes, but you shouldn't!
4646
byte myValue1 = 200;
4747
myMem.write(0, myValue1); //(location, data)
4848

4949
byte myRead1 = myMem.read(0);
50-
Serial.print(F("I read: "));
50+
Serial.print("I read: ");
5151
Serial.println(myRead1);
5252

5353
//You should use gets and puts. This will automatically and correctly arrange
@@ -56,18 +56,17 @@ void setup()
5656
myMem.put(10, myValue2); //(location, data)
5757
int myRead2;
5858
myMem.get(10, myRead2); //location to read, thing to put data into
59-
Serial.print(F("I read: "));
59+
Serial.print("I read: ");
6060
Serial.println(myRead2);
61-
61+
6262
float myValue3 = -7.35;
6363
myMem.put(20, myValue3); //(location, data)
6464
float myRead3;
6565
myMem.get(20, myRead3); //location to read, thing to put data into
66-
Serial.print(F("I read: "));
66+
Serial.print("I read: ");
6767
Serial.println(myRead3);
6868
}
6969

7070
void loop()
7171
{
72-
7372
}

examples/Example5_InterfaceTest/Example5_InterfaceTest.ino

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ void setup()
4343
if (myMem.begin() == false)
4444
{
4545
Serial.println("No memory detected. Freezing.");
46-
while (1);
46+
while (1)
47+
;
4748
}
4849
Serial.println("Memory detected!");
4950

@@ -93,8 +94,10 @@ void setup()
9394
byte response2 = myMem.read(randomLocation + 1);
9495
Serial.println("Location " + (String)randomLocation + " should be " + (String)myValue1 + ": " + (String)response1);
9596
Serial.println("Location " + (String)(randomLocation + 1) + " should be " + (String)myValue2 + ": " + (String)response2);
96-
if (myValue1 != response1) allTestsPassed = false;
97-
if (myValue2 != response2) allTestsPassed = false;
97+
if (myValue1 != response1)
98+
allTestsPassed = false;
99+
if (myValue2 != response2)
100+
allTestsPassed = false;
98101
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
99102

100103
Serial.println("");
@@ -124,8 +127,10 @@ void setup()
124127
myMem.get(randomLocation + 2, response4);
125128
Serial.println("Location " + (String)randomLocation + " should be " + (String)myValue3 + ": " + (String)response3);
126129
Serial.println("Location " + (String)(randomLocation + 2) + " should be " + (String)myValue4 + ": " + (String)response4);
127-
if (myValue3 != response3) allTestsPassed = false;
128-
if (myValue4 != response4) allTestsPassed = false;
130+
if (myValue3 != response3)
131+
allTestsPassed = false;
132+
if (myValue4 != response4)
133+
allTestsPassed = false;
129134
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
130135

131136
Serial.println("");
@@ -155,8 +160,10 @@ void setup()
155160
myMem.get(randomLocation + 4, response6);
156161
Serial.println("Location " + (String)randomLocation + " should be " + (String)myValue5 + ": " + (String)response5);
157162
Serial.println("Location " + (String)(randomLocation + 4) + " should be " + (String)myValue6 + ": " + (String)response6);
158-
if (myValue5 != response5) allTestsPassed = false;
159-
if (myValue6 != response6) allTestsPassed = false;
163+
if (myValue5 != response5)
164+
allTestsPassed = false;
165+
if (myValue6 != response6)
166+
allTestsPassed = false;
160167
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
161168

162169
//int32_t and uint32_t sequential test
@@ -179,8 +186,10 @@ void setup()
179186
myMem.get(randomLocation + 4, response8);
180187
Serial.println("Location " + (String)randomLocation + " should be " + (String)myValue7 + ": " + (String)response7);
181188
Serial.println("Location " + (String)(randomLocation + 4) + " should be " + (String)myValue8 + ": " + (String)response8);
182-
if (myValue7 != response7) allTestsPassed = false;
183-
if (myValue8 != response8) allTestsPassed = false;
189+
if (myValue7 != response7)
190+
allTestsPassed = false;
191+
if (myValue8 != response8)
192+
allTestsPassed = false;
184193
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
185194

186195
//float (32) sequential test
@@ -204,8 +213,10 @@ void setup()
204213
myMem.get(randomLocation + 4, response10);
205214
Serial.println("Location " + (String)randomLocation + " should be " + (String)myValue9 + ": " + (String)response9);
206215
Serial.println("Location " + (String)(randomLocation + 4) + " should be " + (String)myValue10 + ": " + (String)response10);
207-
if (myValue9 != response9) allTestsPassed = false;
208-
if (myValue10 != response10) allTestsPassed = false;
216+
if (myValue9 != response9)
217+
allTestsPassed = false;
218+
if (myValue10 != response10)
219+
allTestsPassed = false;
209220
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
210221

211222
Serial.println("");
@@ -215,7 +226,7 @@ void setup()
215226
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
216227
Serial.println("Size of double: " + (String)sizeof(double));
217228
double myValue11 = -290.3485723409857;
218-
double myValue12 = 384.957;//34987;
229+
double myValue12 = 384.957; //34987;
219230
double myValue13 = 917.14159;
220231
double myValue14 = 254.8877;
221232
randomLocation = random(0, myMem.length());
@@ -249,14 +260,18 @@ void setup()
249260
Serial.print("Rewrite of ");
250261
Serial.print(myMem.length() - sizeof(myValue14));
251262
Serial.println(" should be " + (String)myValue14 + ": " + (String)response14);
252-
if (myValue11 != response11) allTestsPassed = false;
253-
if (myValue12 != response12) allTestsPassed = false;
254-
if (myValue13 != response13) allTestsPassed = false;
255-
if (myValue14 != response14) allTestsPassed = false;
263+
if (myValue11 != response11)
264+
allTestsPassed = false;
265+
if (myValue12 != response12)
266+
allTestsPassed = false;
267+
if (myValue13 != response13)
268+
allTestsPassed = false;
269+
if (myValue14 != response14)
270+
allTestsPassed = false;
256271
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
257272

258273
Serial.println("");
259-
Serial.println("String test");
274+
Serial.println("Buffer Write Test");
260275

261276
//Buffer write test
262277
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@@ -292,12 +307,13 @@ void setup()
292307

293308
Serial.println();
294309
Serial.print("Memory Contents:");
295-
for (uint16_t x = 0; x < 32 * 4; x ++)
310+
for (uint16_t x = 0; x < 32 * 4; x++)
296311
{
297312
if (x % 16 == 0)
298313
Serial.println();
299314
Serial.print(" 0x");
300-
if(myMem.read(x) < 0x10) Serial.print("0");
315+
if (myMem.read(x) < 0x10)
316+
Serial.print("0");
301317
Serial.print(myMem.read(x), HEX);
302318
}
303319
Serial.println();
@@ -310,5 +326,4 @@ void setup()
310326

311327
void loop()
312328
{
313-
314329
}

0 commit comments

Comments
 (0)