-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathMB85RC256V.ino
45 lines (36 loc) · 1.21 KB
/
MB85RC256V.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
41
42
43
44
45
#include "Adafruit_FRAM_I2C.h"
/* Example code for the Adafruit I2C FRAM breakout */
/* Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 5.0V DC
Connect GROUND to common ground */
Adafruit_FRAM_I2C fram = Adafruit_FRAM_I2C();
void setup(void) {
Serial.begin(115200);
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");
while (1);
}
// Read the first byte
uint8_t test = fram.read(0x0);
Serial.print("Restarted "); Serial.print(test); Serial.println(" times");
// Test write ++
fram.write(0x0, test+1);
// dump the entire 32K of memory!
uint8_t value;
for (uint16_t a = 0; a < 32768; a++) {
value = fram.read(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) {
}