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

Commit cb76b66

Browse files
authored
Update README.md and use allman astyle
1 parent 0ec6ef5 commit cb76b66

20 files changed

+222
-78
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
* Board and Configuration
2020
* Contextual information (e.g. what you were trying to achieve)
2121
* Simplest possible steps to reproduce
@@ -28,13 +28,13 @@ Please ensure to specify the following:
2828

2929
```
3030
Arduino IDE version: 1.8.19
31-
Arduino STM32 core v2.2.0
31+
Arduino STM32 core v2.3.0
3232
Board: STM32F103C8T6, 64KB Flash
3333
OS: Ubuntu 20.04 LTS
34-
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
34+
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
3535
3636
Context:
37-
The board couldn't autoreconnect to Local Blynk Server after router power recycling.
37+
I encountered a crash while using this library
3838
3939
Steps to reproduce:
4040
1. ...
@@ -43,12 +43,32 @@ Steps to reproduce:
4343
4. ...
4444
```
4545

46+
---
47+
4648
### Sending Feature Requests
4749

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

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

54+
---
55+
5256
### Sending Pull Requests
5357

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

changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
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_STM32F1.svg)](http://github.com/khoih-prog/FlashStorage_STM32F1/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_STM32F1/count.svg" title="FlashStorage_STM32F1 Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-FlashStorage_STM32F1/count.svg" style="height: 30px;width: 200px;"></a>
14+
915
---
1016
---
1117

examples/EEPROM_CRC/EEPROM_CRC.ino

+5-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
4242
#include <FlashStorage_STM32F1.h>
4343

44-
unsigned long eeprom_crc()
44+
unsigned long eeprom_crc()
4545
{
4646
const unsigned long crc_table[16] =
4747
{
@@ -66,11 +66,13 @@ unsigned long eeprom_crc()
6666
void setup()
6767
{
6868
Serial.begin(115200);
69+
6970
while (!Serial);
7071

7172
delay(200);
7273

73-
Serial.print(F("\nStart EEPROM_CRC on ")); Serial.println(BOARD_NAME);
74+
Serial.print(F("\nStart EEPROM_CRC on "));
75+
Serial.println(BOARD_NAME);
7476
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
7577

7678
//Print length of data to run CRC on.
@@ -85,7 +87,7 @@ void setup()
8587
Serial.print("Done!");
8688
}
8789

88-
void loop()
90+
void loop()
8991
{
9092
/* Empty loop */
9193
}

examples/EEPROM_Clear/EEPROM_Clear.ino

+10-7
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@
3333
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
3434
#include <FlashStorage_STM32F1.h>
3535

36-
void setup()
36+
void setup()
3737
{
3838
Serial.begin(115200);
39+
3940
while (!Serial);
4041

4142
delay(200);
4243

43-
Serial.print(F("\nStart EEPROM_Clear on ")); Serial.println(BOARD_NAME);
44+
Serial.print(F("\nStart EEPROM_Clear on "));
45+
Serial.println(BOARD_NAME);
4446
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
45-
47+
4648
// initialize the LED pin as an output.
4749
pinMode(LED_BUILTIN, OUTPUT);
4850
digitalWrite(LED_BUILTIN, LOW);
@@ -53,8 +55,8 @@ void setup()
5355
EEPROM.init();
5456

5557
unsigned long startMillis = millis();
56-
57-
for (int i = 0 ; i < EEPROM.length() ; i++)
58+
59+
for (int i = 0 ; i < EEPROM.length() ; i++)
5860
{
5961
EEPROM.write(i, 0);
6062
}
@@ -63,13 +65,14 @@ void setup()
6365

6466
// The time spent can be very short (5-25ms) if the EEPROM is not dirty.
6567
// For Seeed XIAO, the time is around 22 / 42 ms for 2048 / 4096 bytes of emulated-EEPROM
66-
Serial.print("Done clearing emulated EEPROM. Time spent (ms) = "); Serial.println(millis() - startMillis);
68+
Serial.print("Done clearing emulated EEPROM. Time spent (ms) = ");
69+
Serial.println(millis() - startMillis);
6770

6871
// turn the LED on when we're done
6972
digitalWrite(LED_BUILTIN, HIGH);
7073
}
7174

72-
void loop()
75+
void loop()
7376
{
7477
/** Empty loop. **/
7578
}

examples/EEPROM_get/EEPROM_get.ino

+11-5
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,19 @@ struct MyObject
6060
void printMyObject(MyObject &customVar)
6161
{
6262
Serial.println("===============");
63-
Serial.print("Field1: "); Serial.println(customVar.field1, 5);
64-
Serial.print("Field2: "); Serial.println(customVar.field2);
65-
Serial.print("Name: "); Serial.println(customVar.name);
63+
Serial.print("Field1: ");
64+
Serial.println(customVar.field1, 5);
65+
Serial.print("Field2: ");
66+
Serial.println(customVar.field2);
67+
Serial.print("Name: ");
68+
Serial.println(customVar.name);
6669
Serial.println("===============");
6770
}
6871

6972
void secondTest()
7073
{
71-
int eeAddress = START_ADDRESS + sizeof(WRITTEN_SIGNATURE) + sizeof(float); //Move address to the next byte after float 'f'.
74+
int eeAddress = START_ADDRESS + sizeof(WRITTEN_SIGNATURE) + sizeof(
75+
float); //Move address to the next byte after float 'f'.
7276

7377
MyObject customVar; //Variable to store custom object read from EEPROM.
7478
EEPROM.get(eeAddress, customVar);
@@ -80,11 +84,13 @@ void secondTest()
8084
void setup()
8185
{
8286
Serial.begin(115200);
87+
8388
while (!Serial);
8489

8590
delay(200);
8691

87-
Serial.print(F("\nStart EEPROM_get on ")); Serial.println(BOARD_NAME);
92+
Serial.print(F("\nStart EEPROM_get on "));
93+
Serial.println(BOARD_NAME);
8894
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
8995

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

examples/EEPROM_iteration/EEPROM_iteration.ino

+7-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@
4646
void setup()
4747
{
4848
Serial.begin(115200);
49+
4950
while (!Serial);
5051

5152
delay(200);
5253

53-
Serial.print(F("\nStart EEPROM_iteration on ")); Serial.println(BOARD_NAME);
54+
Serial.print(F("\nStart EEPROM_iteration on "));
55+
Serial.println(BOARD_NAME);
5456
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
5557

5658
Serial.print("EEPROM length: ");
@@ -62,7 +64,7 @@ void setup()
6264
Iterate the EEPROM using a for loop.
6365
***/
6466

65-
for (int index = 0 ; index < EEPROM.length() ; index++)
67+
for (int index = 0 ; index < EEPROM.length() ; index++)
6668
{
6769
// Add one to each cell in the EEPROM
6870
EEPROM.write(index, EEPROM.read(index) + 1);
@@ -78,7 +80,7 @@ void setup()
7880

7981
int index = 0;
8082

81-
while (index < EEPROM.length())
83+
while (index < EEPROM.length())
8284
{
8385
// Add one to each cell in the EEPROM
8486
EEPROM.write(index, EEPROM.read(index) + 1);
@@ -95,7 +97,7 @@ void setup()
9597

9698
int idx = 0; //Used 'idx' to avoid name conflict with 'index' above.
9799

98-
do
100+
do
99101
{
100102
// Add one to each cell in the EEPROM
101103
EEPROM.write(index, EEPROM.read(index) + 1);
@@ -105,7 +107,7 @@ void setup()
105107
EEPROM.commit();
106108

107109
Serial.println("Done do-while loop");
108-
110+
109111
} //End of setup function.
110112

111113
void loop() {}

examples/EEPROM_put/EEPROM_put.ino

+9-4
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,25 @@ struct MyObject
5858
void printMyObject(MyObject &customVar)
5959
{
6060
Serial.println("===============");
61-
Serial.print("Field1: "); Serial.println(customVar.field1, 5);
62-
Serial.print("Field2: "); Serial.println(customVar.field2);
63-
Serial.print("Name: "); Serial.println(customVar.name);
61+
Serial.print("Field1: ");
62+
Serial.println(customVar.field1, 5);
63+
Serial.print("Field2: ");
64+
Serial.println(customVar.field2);
65+
Serial.print("Name: ");
66+
Serial.println(customVar.name);
6467
Serial.println("===============");
6568
}
6669

6770
void setup()
6871
{
6972
Serial.begin(115200);
73+
7074
while (!Serial);
7175

7276
delay(200);
7377

74-
Serial.print(F("\nStart EEPROM_put on ")); Serial.println(BOARD_NAME);
78+
Serial.print(F("\nStart EEPROM_put on "));
79+
Serial.println(BOARD_NAME);
7580
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
7681

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

examples/EEPROM_read/EEPROM_read.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ byte value;
4646
void setup()
4747
{
4848
Serial.begin(115200);
49+
4950
while (!Serial);
5051

5152
delay(200);
5253

53-
Serial.print(F("\nStart EEPROM_read on ")); Serial.println(BOARD_NAME);
54+
Serial.print(F("\nStart EEPROM_read on "));
55+
Serial.println(BOARD_NAME);
5456
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
5557

5658
Serial.print("EEPROM length: ");
@@ -59,7 +61,7 @@ void setup()
5961
EEPROM.init();
6062
}
6163

62-
void loop()
64+
void loop()
6365
{
6466
// read a byte from the current address of the EEPROM
6567
value = EEPROM.read(address);
@@ -68,8 +70,8 @@ void loop()
6870
Serial.print("\t");
6971
Serial.print(value, DEC);
7072
Serial.println();
71-
72-
if (++address == EEPROM.length())
73+
74+
if (++address == EEPROM.length())
7375
{
7476
address = 0;
7577
}

examples/EEPROM_update/EEPROM_update.ino

+9-6
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ int address = 0;
5151
void setup()
5252
{
5353
Serial.begin(115200);
54+
5455
while (!Serial);
5556

5657
delay(200);
5758

58-
Serial.print(F("\nStart EEPROM_read on ")); Serial.println(BOARD_NAME);
59+
Serial.print(F("\nStart EEPROM_read on "));
60+
Serial.println(BOARD_NAME);
5961
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
6062

6163
Serial.print("EEPROM length: ");
@@ -67,23 +69,24 @@ void setup()
6769
void loop()
6870
{
6971
unsigned long startMillis = millis();
70-
71-
for (int i = 0 ; i < EEPROM.length() ; i++)
72+
73+
for (int i = 0 ; i < EEPROM.length() ; i++)
7274
{
7375
/***
7476
The function EEPROM.update(address, val) is equivalent to the following:
75-
77+
7678
if( EEPROM.read(address) != val )
7779
{
7880
EEPROM.write(address, val);
7981
}
8082
***/
8183
EEPROM.update(i, (uint8_t) analogRead(0));
8284
}
83-
85+
8486
EEPROM.commit();
8587

86-
Serial.print("Done updating emulated EEPROM. Time spent (ms) = "); Serial.println(millis() - startMillis);
88+
Serial.print("Done updating emulated EEPROM. Time spent (ms) = ");
89+
Serial.println(millis() - startMillis);
8790

8891
delay(60000);
8992
}

examples/EEPROM_write/EEPROM_write.ino

+5-2
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ int address = 0;
4545
void setup()
4646
{
4747
Serial.begin(115200);
48+
4849
while (!Serial);
4950

5051
delay(200);
5152

52-
Serial.print(F("\nStart EEPROM_write on ")); Serial.println(BOARD_NAME);
53+
Serial.print(F("\nStart EEPROM_write on "));
54+
Serial.println(BOARD_NAME);
5355
Serial.println(FLASH_STORAGE_STM32F1_VERSION);
5456

5557
Serial.print("EEPROM length: ");
@@ -79,7 +81,8 @@ void loop()
7981

8082
EEPROM.commit();
8183

82-
Serial.print("Done writing emulated EEPROM. Time spent (ms) = "); Serial.println(millis() - startMillis);
84+
Serial.print("Done writing emulated EEPROM. Time spent (ms) = ");
85+
Serial.println(millis() - startMillis);
8386

8487
delay(60000);
8588
}

0 commit comments

Comments
 (0)