-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f13d003
commit 7c712b7
Showing
10 changed files
with
255 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
libraries/FRAM_I2C/examples/FRAM_ATTINY85_COMPILE_TEST/.arduino-ci.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
platforms: | ||
rpipico: | ||
board: rp2040:rp2040:rpipico | ||
package: rp2040:rp2040 | ||
gcc: | ||
features: | ||
defines: | ||
- ARDUINO_ARCH_RP2040 | ||
warnings: | ||
flags: | ||
|
||
packages: | ||
rp2040:rp2040: | ||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json | ||
|
||
compile: | ||
# Choosing to run compilation tests on 2 different Arduino platforms | ||
platforms: | ||
# - uno | ||
# - due | ||
# - zero | ||
# - leonardo | ||
# - m4 | ||
# - esp32 | ||
# - esp8266 | ||
# - mega2560 | ||
# - rpipico | ||
# - nano_every | ||
|
176 changes: 176 additions & 0 deletions
176
libraries/FRAM_I2C/examples/FRAM_ATTINY85_COMPILE_TEST/FRAM_ATTINY85_COMPILE_TEST.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
// | ||
// FILE: FRAM_ATTINY85_COMPILE_TEST.ino | ||
// AUTHOR: Rob Tillaart | ||
// PURPOSE: compile test for FRAM library with ATTINY85 | ||
// URL: https://github.com/RobTillaart/FRAM_I2C | ||
// | ||
// | ||
// WARNING: not tested with hardware, only compilation. | ||
// this example is for checking if there are compile errors. | ||
// TESTED: IDE: 1.8.19 ATTINY85 | ||
// | ||
|
||
|
||
#include "TinyWireM.h" | ||
#include "FRAM.h" | ||
|
||
|
||
FRAM fram; | ||
|
||
uint32_t start; | ||
uint32_t stop; | ||
|
||
|
||
void setup() | ||
{ | ||
TinyWireM.begin(); | ||
|
||
fram.begin(0x50); | ||
|
||
testID(); | ||
testFRAMmemory(); | ||
testReadWriteSmall(); | ||
testReadWriteLarge(); | ||
// testWriteText(); | ||
// testReadText1(); | ||
// testReadText2(); | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
} | ||
|
||
|
||
void testID() | ||
{ | ||
int x = fram.getManufacturerID(); | ||
int y = fram.getProductID(); | ||
int s = fram.getSize(); | ||
} | ||
|
||
void testFRAMmemory() | ||
{ | ||
|
||
start = millis(); | ||
uint8_t val = 0x55; | ||
for (uint16_t addr = 0; addr < 32768; addr++) | ||
{ | ||
fram.write8(addr, val); | ||
if (fram.read8(addr) != 0x55) | ||
{ | ||
} | ||
if (addr % 1000 == 0) | ||
{ | ||
} | ||
} | ||
stop = millis(); | ||
} | ||
|
||
|
||
void testReadWriteSmall() | ||
{ | ||
uint8_t t8 = 0xFE; | ||
fram.write8(1000, t8); | ||
if (fram.read8(1000) != 0xFE) | ||
{ | ||
} | ||
else | ||
{ | ||
} | ||
|
||
|
||
uint16_t t16 = 0xFADE; | ||
fram.write16(1000, t16); | ||
if (fram.read16(1000) != 0xFADE) | ||
{ | ||
|
||
} | ||
else | ||
{ | ||
|
||
} | ||
|
||
|
||
uint32_t t32 = 0xFADEFACE; | ||
fram.write32(1000, t32); | ||
if (fram.read32(1000) != 0xFADEFACE) | ||
{ | ||
|
||
} | ||
else | ||
{ | ||
} | ||
|
||
} | ||
|
||
|
||
void testReadWriteLarge() | ||
{ | ||
uint8_t ar[20]; | ||
for (int i = 0; i < 20; i++) ar[i] = i; | ||
|
||
start = millis(); | ||
fram.write(1000, ar, 20); | ||
stop = millis(); | ||
|
||
for (int i = 0; i < 20; i++) ar[i] = 0; | ||
|
||
start = millis(); | ||
fram.read(1000, ar, 20); | ||
stop = millis(); | ||
|
||
for (int i = 0; i < 20; i++) | ||
{ | ||
if (ar[i] != i) | ||
{ | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
void testWriteText() | ||
{ | ||
char str[5][16] = | ||
{ | ||
"Hello world 0", | ||
"Hello world 1", | ||
"Hello world 2", | ||
"Hello world 3", | ||
"Hello world 4", | ||
}; | ||
|
||
start = millis(); | ||
fram.write(2000, (uint8_t *)str, 80); | ||
stop = millis(); | ||
} | ||
|
||
|
||
void testReadText1() | ||
{ | ||
char str[5][16]; | ||
|
||
start = millis(); | ||
fram.read(2000, (uint8_t *)str, 80); | ||
stop = millis(); | ||
|
||
for (int i = 0; i < 5; i++) | ||
{ | ||
} | ||
} | ||
|
||
|
||
void testReadText2() | ||
{ | ||
char str[16]; | ||
|
||
for (int i = 0; i < 5; i++) | ||
{ | ||
fram.read(2000 + 16 * i, (uint8_t *)str, 16); | ||
} | ||
} | ||
|
||
|
||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=FRAM_I2C | ||
version=0.8.1 | ||
version=0.8.2 | ||
author=Rob Tillaart <[email protected]> | ||
maintainer=Rob Tillaart <[email protected]> | ||
sentence=Arduino library for I2C FRAM for persistent storage. | ||
|