-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFRAM_Test.ino
executable file
·40 lines (32 loc) · 1.05 KB
/
FRAM_Test.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "Adafruit_FRAM_I2C.h"
/* Example code for the Adafruit I2C FRAM breakout */
Adafruit_FRAM_I2C fram = Adafruit_FRAM_I2C();
uint16_t framAddr = 0;
void setup(void) {
Serial.begin(9600);
if (fram.begin()) { // you can stick the new i2c addr in here, e.g. begin(0x51);
Serial.println("Found I2C FRAM");
} else {
Serial.println("I2C FRAM not identified ... check your connections?\r\n");
Serial.println("Will continue in case this processor doesn't support repeated start\r\n");
}
// Read the first byte
uint8_t test = fram.read8(0x0);
Serial.print("Restarted "); Serial.print(test); Serial.println(" times");
// Test write ++
fram.write8(0x0, test+1);
// dump the entire 32K of memory!
uint8_t value;
for (uint16_t a = 0; a < 32768; a++) {
value = fram.read8(a);
if ((a % 32) == 0) {
Serial.print("\n 0x"); Serial.print(a, HEX); Serial.print(": ");
}
Serial.print("0x");
if (value < 0x1)
Serial.print('0');
Serial.print(value, HEX); Serial.print(" ");
}
}
void loop(void) {
}