Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit bb0dd71

Browse files
authored
Update README.md and use allman astyle
1 parent b6523d3 commit bb0dd71

File tree

21 files changed

+470
-316
lines changed

21 files changed

+470
-316
lines changed

CONTRIBUTING.md

+24-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1515
Please ensure to specify the following:
1616

1717
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18-
* Board Core Version (e.g. Arduino STM32 core v2.2.0, etc.)
18+
* Board Core Version (e.g. Arduino STM32 core v2.3.0, etc.)
1919
* Contextual information (e.g. what you were trying to achieve)
2020
* Simplest possible steps to reproduce
2121
* Anything that might be relevant in your opinion, such as:
@@ -27,12 +27,12 @@ Please ensure to specify the following:
2727

2828
```
2929
Arduino IDE version: 1.8.19
30-
Arduino STM32 core v2.2.0
30+
Arduino STM32 core v2.3.0
3131
OS: Ubuntu 20.04 LTS
32-
Linux Inspiron-3593 5.4.0-96-generic #109-Ubuntu SMP Wed Jan 12 16:49:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
32+
Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3333
3434
Context:
35-
The board couldn't autoreconnect to Local Blynk Server after router power recycling.
35+
I encountered a crash while using this library
3636
3737
Steps to reproduce:
3838
1. ...
@@ -41,13 +41,33 @@ Steps to reproduce:
4141
4. ...
4242
```
4343

44+
---
4445

4546
### Sending Feature Requests
4647

4748
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
4849

4950
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/FlashStorage_STM32/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
5051

52+
---
53+
5154
### Sending Pull Requests
5255

5356
Pull Requests with changes and fixes are also welcome!
57+
58+
Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
59+
60+
1. Change directory to the library GitHub
61+
62+
```
63+
xy@xy-Inspiron-3593:~$ cd Arduino/xy/FlashStorage_STM32_GitHub/
64+
xy@xy-Inspiron-3593:~/Arduino/xy/FlashStorage_STM32_GitHub$
65+
```
66+
67+
2. Issue astyle command
68+
69+
```
70+
xy@xy-Inspiron-3593:~/Arduino/xy/FlashStorage_STM32_GitHub$ bash utils/restyle.sh
71+
```
72+
73+

changelog.md

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
77
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/FlashStorage_STM32.svg)](http://github.com/khoih-prog/FlashStorage_STM32/issues)
88

9+
10+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
11+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
12+
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
13+
<a href="https://profile-counter.glitch.me/khoih-prog-FlashStorage_STM32/count.svg" title="FlashStorage_STM32 Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-FlashStorage_STM32/count.svg" style="height: 30px;width: 200px;"></a>
14+
15+
916
---
1017
---
1118

examples/EEPROM_CRC/EEPROM_CRC.ino

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
2424
#include <FlashStorage_STM32.h>
2525

26-
unsigned long eeprom_crc()
26+
unsigned long eeprom_crc()
2727
{
2828
const unsigned long crc_table[16] =
2929
{
@@ -48,11 +48,13 @@ unsigned long eeprom_crc()
4848
void setup()
4949
{
5050
Serial.begin(115200);
51+
5152
while (!Serial);
5253

5354
delay(200);
5455

55-
Serial.print(F("\nStart EEPROM_CRC on ")); Serial.println(BOARD_NAME);
56+
Serial.print(F("\nStart EEPROM_CRC on "));
57+
Serial.println(BOARD_NAME);
5658
Serial.println(FLASH_STORAGE_STM32_VERSION);
5759

5860
//Print length of data to run CRC on.
@@ -65,7 +67,7 @@ void setup()
6567
Serial.print("Done!");
6668
}
6769

68-
void loop()
70+
void loop()
6971
{
7072
/* Empty loop */
7173
}

examples/EEPROM_Clear/EEPROM_Clear.ino

+14-10
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
EEPROM_Clear.ino
33
For STM32 using Flash emulated-EEPROM
44
5-
The FlashStorage_STM32 library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory
6-
of STM32F/L/H/G/WB/MP1. It's using the buffered read and write to minimize the access to Flash.
5+
The FlashStorage_STM32 library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory
6+
of STM32F/L/H/G/WB/MP1. It's using the buffered read and write to minimize the access to Flash.
77
It now supports writing and reading the whole object, not just byte-and-byte.
88
99
Inspired by Cristian Maglie's FlashStorage (https://github.com/cmaglie/FlashStorage)
@@ -15,25 +15,28 @@
1515
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
1616
#include <FlashStorage_STM32.h>
1717

18-
void setup()
18+
void setup()
1919
{
2020
Serial.begin(115200);
21+
2122
while (!Serial);
2223

2324
delay(200);
2425

25-
Serial.print(F("\nStart EEPROM_Clear on ")); Serial.println(BOARD_NAME);
26+
Serial.print(F("\nStart EEPROM_Clear on "));
27+
Serial.println(BOARD_NAME);
2628
Serial.println(FLASH_STORAGE_STM32_VERSION);
27-
29+
2830
// initialize the LED pin as an output.
2931
pinMode(LED_BUILTIN, OUTPUT);
3032
digitalWrite(LED_BUILTIN, LOW);
3133

32-
Serial.print("Emulated EEPROM length (bytes) = "); Serial.println(EEPROM.length());
34+
Serial.print("Emulated EEPROM length (bytes) = ");
35+
Serial.println(EEPROM.length());
3336

3437
unsigned long startMillis = millis();
35-
36-
for (int i = 0 ; i < EEPROM.length() ; i++)
38+
39+
for (int i = 0 ; i < EEPROM.length() ; i++)
3740
{
3841
EEPROM.write(i, 0);
3942
}
@@ -42,13 +45,14 @@ void setup()
4245

4346
// The time spent can be very short (4-5ms) if the EEPROM is not dirty.
4447
// For F767ZI, the time is around 1.1s for 16384 bytes of emulated-EEPROM
45-
Serial.print("Done clearing emulated EEPROM. Time spent (ms) = "); Serial.println(millis() - startMillis);
48+
Serial.print("Done clearing emulated EEPROM. Time spent (ms) = ");
49+
Serial.println(millis() - startMillis);
4650

4751
// turn the LED on when we're done
4852
digitalWrite(LED_BUILTIN, HIGH);
4953
}
5054

51-
void loop()
55+
void loop()
5256
{
5357
/** Empty loop. **/
5458
}

examples/EEPROM_get/EEPROM_get.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ void secondTest()
5252
void setup()
5353
{
5454
Serial.begin(115200);
55+
5556
while (!Serial);
5657

5758
delay(200);
5859

59-
Serial.print(F("\nStart EEPROM_get on ")); Serial.println(BOARD_NAME);
60+
Serial.print(F("\nStart EEPROM_get on "));
61+
Serial.println(BOARD_NAME);
6062
Serial.println(FLASH_STORAGE_STM32_VERSION);
6163

6264
Serial.print("EEPROM length: ");

examples/EEPROM_iteration/EEPROM_iteration.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@
2828
void setup()
2929
{
3030
Serial.begin(115200);
31+
3132
while (!Serial);
3233

3334
delay(200);
3435

35-
Serial.print(F("\nStart EEPROM_iteration on ")); Serial.println(BOARD_NAME);
36+
Serial.print(F("\nStart EEPROM_iteration on "));
37+
Serial.println(BOARD_NAME);
3638
Serial.println(FLASH_STORAGE_STM32_VERSION);
3739

3840
Serial.print("EEPROM length: ");
@@ -42,7 +44,7 @@ void setup()
4244
Iterate the EEPROM using a for loop.
4345
***/
4446

45-
for (int index = 0 ; index < EEPROM.length() ; index++)
47+
for (int index = 0 ; index < EEPROM.length() ; index++)
4648
{
4749
// Add one to each cell in the EEPROM
4850
EEPROM.write(index, EEPROM.read(index) + 1);
@@ -58,7 +60,7 @@ void setup()
5860

5961
int index = 0;
6062

61-
while (index < EEPROM.length())
63+
while (index < EEPROM.length())
6264
{
6365
//Add one to each cell in the EEPROM
6466
// Add one to each cell in the EEPROM
@@ -86,7 +88,7 @@ void setup()
8688
EEPROM.commit();
8789

8890
Serial.println("Done do-while loop");
89-
91+
9092
} //End of setup function.
9193

9294
void loop() {}

examples/EEPROM_put/EEPROM_put.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ struct MyObject
3737
void setup()
3838
{
3939
Serial.begin(115200);
40+
4041
while (!Serial);
4142

4243
delay(200);
4344

44-
Serial.print(F("\nStart EEPROM_put on ")); Serial.println(BOARD_NAME);
45+
Serial.print(F("\nStart EEPROM_put on "));
46+
Serial.println(BOARD_NAME);
4547
Serial.println(FLASH_STORAGE_STM32_VERSION);
4648

4749
Serial.print("EEPROM length: ");

examples/EEPROM_read/EEPROM_read.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,20 @@ byte value;
2828
void setup()
2929
{
3030
Serial.begin(115200);
31+
3132
while (!Serial);
3233

3334
delay(200);
3435

35-
Serial.print(F("\nStart EEPROM_read on ")); Serial.println(BOARD_NAME);
36+
Serial.print(F("\nStart EEPROM_read on "));
37+
Serial.println(BOARD_NAME);
3638
Serial.println(FLASH_STORAGE_STM32_VERSION);
3739

3840
Serial.print("EEPROM length: ");
3941
Serial.println(EEPROM.length());
4042
}
4143

42-
void loop()
44+
void loop()
4345
{
4446
// read a byte from the current address of the EEPROM
4547
value = EEPROM.read(address);
@@ -48,8 +50,8 @@ void loop()
4850
Serial.print("\t");
4951
Serial.print(value, DEC);
5052
Serial.println();
51-
52-
if (++address == EEPROM.length())
53+
54+
if (++address == EEPROM.length())
5355
{
5456
address = 0;
5557
}

examples/EEPROM_update/EEPROM_update.ino

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ int address = 0;
3333
void setup()
3434
{
3535
Serial.begin(115200);
36+
3637
while (!Serial);
3738

3839
delay(200);
3940

40-
Serial.print(F("\nStart EEPROM_update on ")); Serial.println(BOARD_NAME);
41+
Serial.print(F("\nStart EEPROM_update on "));
42+
Serial.println(BOARD_NAME);
4143
Serial.println(FLASH_STORAGE_STM32_VERSION);
4244

4345
Serial.print("EEPROM length: ");
@@ -63,7 +65,8 @@ void loop()
6365

6466
EEPROM.commit();
6567

66-
Serial.print("Done updating emulated EEPROM. Time spent (ms) = "); Serial.println(millis() - startMillis);
68+
Serial.print("Done updating emulated EEPROM. Time spent (ms) = ");
69+
Serial.println(millis() - startMillis);
6770

6871
delay(60000);
6972
}

examples/EEPROM_write/EEPROM_write.ino

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/*
1515
EEPROM Write
1616
17-
Stores values read from analog input 0 into the EEPROM. These values will stay in the EEPROM
17+
Stores values read from analog input 0 into the EEPROM. These values will stay in the EEPROM
1818
when the board is turned off and may be retrieved later by another sketch.
1919
*/
2020

@@ -27,11 +27,13 @@ int address = 0;
2727
void setup()
2828
{
2929
Serial.begin(115200);
30+
3031
while (!Serial);
3132

3233
delay(200);
3334

34-
Serial.print(F("\nStart EEPROM_write on ")); Serial.println(BOARD_NAME);
35+
Serial.print(F("\nStart EEPROM_write on "));
36+
Serial.println(BOARD_NAME);
3537
Serial.println(FLASH_STORAGE_STM32_VERSION);
3638

3739
Serial.print("EEPROM length: ");
@@ -41,23 +43,24 @@ void setup()
4143
void loop()
4244
{
4345
unsigned long startMillis = millis();
44-
45-
for (int i = 0 ; i < EEPROM.length() ; i++)
46+
47+
for (int i = 0 ; i < EEPROM.length() ; i++)
4648
{
4749
/***
4850
The function EEPROM.update(address, val) is equivalent to the following:
49-
51+
5052
if( EEPROM.read(address) != val )
5153
{
5254
EEPROM.write(address, val);
5355
}
5456
***/
5557
EEPROM.write(i, (uint8_t) analogRead(0));
5658
}
57-
59+
5860
EEPROM.commit();
5961

60-
Serial.print("Done writing emulated EEPROM. Time spent (ms) = "); Serial.println(millis() - startMillis);
62+
Serial.print("Done writing emulated EEPROM. Time spent (ms) = ");
63+
Serial.println(millis() - startMillis);
6164

6265
delay(60000);
6366
}

examples/EmulateEEPROM/EmulateEEPROM.ino

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ const int WRITTEN_SIGNATURE = 0xBEEFDEED;
2222
void setup()
2323
{
2424
Serial.begin(115200);
25+
2526
while (!Serial);
2627

2728
delay(200);
2829

29-
Serial.print(F("\nStart EmulatedEEPROM on ")); Serial.println(BOARD_NAME);
30+
Serial.print(F("\nStart EmulatedEEPROM on "));
31+
Serial.println(BOARD_NAME);
3032
Serial.println(FLASH_STORAGE_STM32_VERSION);
3133

3234
Serial.print("EEPROM length: ");
@@ -67,7 +69,8 @@ void setup()
6769
{
6870
EEPROM.get(0, signature);
6971

70-
Serial.print("EEPROM has been written.Signature = 0x"); Serial.println(signature, HEX);
72+
Serial.print("EEPROM has been written.Signature = 0x");
73+
Serial.println(signature, HEX);
7174

7275
Serial.println("Here is the content of the next 16 bytes:");
7376

0 commit comments

Comments
 (0)