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

Commit 102e13e

Browse files
authored
Update README.md and use allman astyle
1 parent c4a16bb commit 102e13e

File tree

24 files changed

+354
-190
lines changed

24 files changed

+354
-190
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 4 deletions
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-
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.12, Adafruit SAMD core v1.7.7, Seeed Studio SAMD v1.8.2)
18+
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.13, Adafruit SAMD core v1.7.11, Seeed Studio SAMD v1.8.3)
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 SAMD Core Version 1.8.12
30+
Arduino SAMD Core Version 1.8.13
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-
I encountered a crash while trying to use the Timer Interrupt.
35+
I encountered a crash while using this library
3636
3737
Steps to reproduce:
3838
1. ...
@@ -41,12 +41,33 @@ Steps to reproduce:
4141
4. ...
4242
```
4343

44+
---
45+
4446
### Sending Feature Requests
4547

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

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

52+
---
53+
5054
### Sending Pull Requests
5155

5256
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_SAMD_GitHub/
64+
xy@xy-Inspiron-3593:~/Arduino/xy/FlashStorage_SAMD_GitHub$
65+
```
66+
67+
2. Issue astyle command
68+
69+
```
70+
xy@xy-Inspiron-3593:~/Arduino/xy/FlashStorage_SAMD_GitHub$ bash utils/restyle.sh
71+
```
72+
73+

changelog.md

Lines changed: 7 additions & 0 deletions
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_SAMD.svg)](http://github.com/khoih-prog/FlashStorage_SAMD/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_SAMD/count.svg" title="FlashStorage_SAMD Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-FlashStorage_SAMD/count.svg" style="height: 30px;width: 200px;"></a>
14+
15+
916
---
1017
---
1118

examples/EEPROM_CRC/EEPROM_CRC.ino

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
1010
Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_SAMD
1111
Licensed under LGPLv3 license
12-
12+
1313
Orginally written by A. Christian
14-
14+
1515
Copyright (c) 2015-2016 Arduino LLC. All right reserved.
1616
Copyright (c) 2020 Khoi Hoang.
17-
18-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
17+
18+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
1919
as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version.
2020
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
2121
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
22-
You should have received a copy of the GNU Lesser General Public License along with this library.
22+
You should have received a copy of the GNU Lesser General Public License along with this library.
2323
If not, see (https://www.gnu.org/licenses/)
2424
******************************************************************************************************************************************/
2525
/***
@@ -39,7 +39,7 @@
3939
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
4040
#include <FlashStorage_SAMD.h>
4141

42-
unsigned long eeprom_crc()
42+
unsigned long eeprom_crc()
4343
{
4444
const unsigned long crc_table[16] =
4545
{
@@ -64,11 +64,13 @@ unsigned long eeprom_crc()
6464
void setup()
6565
{
6666
Serial.begin(115200);
67+
6768
while (!Serial);
6869

6970
delay(200);
7071

71-
Serial.print(F("\nStart EEPROM_CRC on ")); Serial.println(BOARD_NAME);
72+
Serial.print(F("\nStart EEPROM_CRC on "));
73+
Serial.println(BOARD_NAME);
7274
Serial.println(FLASH_STORAGE_SAMD_VERSION);
7375

7476
//Print length of data to run CRC on.
@@ -81,7 +83,7 @@ void setup()
8183
Serial.print("Done!");
8284
}
8385

84-
void loop()
86+
void loop()
8587
{
8688
/* Empty loop */
8789
}

examples/EEPROM_Clear/EEPROM_Clear.ino

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
1010
Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_SAMD
1111
Licensed under LGPLv3 license
12-
12+
1313
Orginally written by A. Christian
14-
14+
1515
Copyright (c) 2015-2016 Arduino LLC. All right reserved.
1616
Copyright (c) 2020 Khoi Hoang.
17-
18-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
17+
18+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
1919
as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version.
2020
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
2121
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
22-
You should have received a copy of the GNU Lesser General Public License along with this library.
22+
You should have received a copy of the GNU Lesser General Public License along with this library.
2323
If not, see (https://www.gnu.org/licenses/)
2424
******************************************************************************************************************************************/
2525

@@ -31,25 +31,28 @@
3131
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
3232
#include <FlashStorage_SAMD.h>
3333

34-
void setup()
34+
void setup()
3535
{
3636
Serial.begin(115200);
37+
3738
while (!Serial);
3839

3940
delay(200);
4041

41-
Serial.print(F("\nStart EEPROM_Clear on ")); Serial.println(BOARD_NAME);
42+
Serial.print(F("\nStart EEPROM_Clear on "));
43+
Serial.println(BOARD_NAME);
4244
Serial.println(FLASH_STORAGE_SAMD_VERSION);
43-
45+
4446
// initialize the LED pin as an output.
4547
pinMode(LED_BUILTIN, OUTPUT);
4648
digitalWrite(LED_BUILTIN, LOW);
4749

48-
Serial.print("Emulated EEPROM length (bytes) = "); Serial.println(EEPROM.length());
50+
Serial.print("Emulated EEPROM length (bytes) = ");
51+
Serial.println(EEPROM.length());
4952

5053
unsigned long startMillis = millis();
51-
52-
for (int i = 0 ; i < EEPROM.length() ; i++)
54+
55+
for (int i = 0 ; i < EEPROM.length() ; i++)
5356
{
5457
EEPROM.write(i, 0);
5558
}
@@ -58,13 +61,14 @@ void setup()
5861

5962
// The time spent can be very short (5-25ms) if the EEPROM is not dirty.
6063
// For Seeed XIAO, the time is around 22 / 42 ms for 2048 / 4096 bytes of emulated-EEPROM
61-
Serial.print("Done clearing emulated EEPROM. Time spent (ms) = "); Serial.println(millis() - startMillis);
64+
Serial.print("Done clearing emulated EEPROM. Time spent (ms) = ");
65+
Serial.println(millis() - startMillis);
6266

6367
// turn the LED on when we're done
6468
digitalWrite(LED_BUILTIN, HIGH);
6569
}
6670

67-
void loop()
71+
void loop()
6872
{
6973
/** Empty loop. **/
7074
}

examples/EEPROM_get/EEPROM_get.ino

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ 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 secondTest()
6871
{
69-
int eeAddress = START_ADDRESS + sizeof(WRITTEN_SIGNATURE) + sizeof(float); //Move address to the next byte after float 'f'.
72+
int eeAddress = START_ADDRESS + sizeof(WRITTEN_SIGNATURE) + sizeof(
73+
float); //Move address to the next byte after float 'f'.
7074

7175
MyObject customVar; //Variable to store custom object read from EEPROM.
7276
EEPROM.get(eeAddress, customVar);
@@ -78,11 +82,13 @@ void secondTest()
7882
void setup()
7983
{
8084
Serial.begin(115200);
85+
8186
while (!Serial);
8287

8388
delay(200);
8489

85-
Serial.print(F("\nStart EEPROM_get on ")); Serial.println(BOARD_NAME);
90+
Serial.print(F("\nStart EEPROM_get on "));
91+
Serial.println(BOARD_NAME);
8692
Serial.println(FLASH_STORAGE_SAMD_VERSION);
8793

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

examples/EEPROM_iteration/EEPROM_iteration.ino

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
1010
Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_SAMD
1111
Licensed under LGPLv3 license
12-
12+
1313
Orginally written by A. Christian
14-
14+
1515
Copyright (c) 2015-2016 Arduino LLC. All right reserved.
1616
Copyright (c) 2020 Khoi Hoang.
17-
18-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
17+
18+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
1919
as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version.
2020
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
2121
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
22-
You should have received a copy of the GNU Lesser General Public License along with this library.
22+
You should have received a copy of the GNU Lesser General Public License along with this library.
2323
If not, see (https://www.gnu.org/licenses/)
2424
******************************************************************************************************************************************/
2525
/***
@@ -44,11 +44,13 @@
4444
void setup()
4545
{
4646
Serial.begin(115200);
47+
4748
while (!Serial);
4849

4950
delay(200);
5051

51-
Serial.print(F("\nStart EEPROM_iteration on ")); Serial.println(BOARD_NAME);
52+
Serial.print(F("\nStart EEPROM_iteration on "));
53+
Serial.println(BOARD_NAME);
5254
Serial.println(FLASH_STORAGE_SAMD_VERSION);
5355

5456
Serial.print("EEPROM length: ");
@@ -58,9 +60,9 @@ void setup()
5860
Iterate the EEPROM using a for loop.
5961
***/
6062

61-
for (int index = 0 ; index < EEPROM.length() ; index++)
63+
for (int index = 0 ; index < EEPROM.length() ; index++)
6264
{
63-
// Add one to each cell in the EEPROM
65+
// Add one to each cell in the EEPROM
6466
EEPROM.write(index, EEPROM.read(index) + 1);
6567
}
6668

@@ -74,9 +76,9 @@ void setup()
7476

7577
int index = 0;
7678

77-
while (index < EEPROM.length())
79+
while (index < EEPROM.length())
7880
{
79-
// Add one to each cell in the EEPROM
81+
// Add one to each cell in the EEPROM
8082
EEPROM.write(index, EEPROM.read(index) + 1);
8183
index++;
8284
}
@@ -101,7 +103,7 @@ void setup()
101103
EEPROM.commit();
102104

103105
Serial.println("Done do-while loop");
104-
106+
105107
} //End of setup function.
106108

107109
void loop() {}

examples/EEPROM_put/EEPROM_put.ino

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
1010
Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_SAMD
1111
Licensed under LGPLv3 license
12-
12+
1313
Orginally written by A. Christian
14-
14+
1515
Copyright (c) 2015-2016 Arduino LLC. All right reserved.
1616
Copyright (c) 2020 Khoi Hoang.
17-
18-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
17+
18+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
1919
as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version.
2020
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
2121
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
22-
You should have received a copy of the GNU Lesser General Public License along with this library.
22+
You should have received a copy of the GNU Lesser General Public License along with this library.
2323
If not, see (https://www.gnu.org/licenses/)
2424
******************************************************************************************************************************************/
2525
/***
@@ -56,20 +56,25 @@ struct MyObject
5656
void printMyObject(MyObject &customVar)
5757
{
5858
Serial.println("===============");
59-
Serial.print("Field1: "); Serial.println(customVar.field1, 5);
60-
Serial.print("Field2: "); Serial.println(customVar.field2);
61-
Serial.print("Name: "); Serial.println(customVar.name);
59+
Serial.print("Field1: ");
60+
Serial.println(customVar.field1, 5);
61+
Serial.print("Field2: ");
62+
Serial.println(customVar.field2);
63+
Serial.print("Name: ");
64+
Serial.println(customVar.name);
6265
Serial.println("===============");
6366
}
6467

6568
void setup()
6669
{
6770
Serial.begin(115200);
71+
6872
while (!Serial);
6973

7074
delay(200);
7175

72-
Serial.print(F("\nStart EEPROM_put on ")); Serial.println(BOARD_NAME);
76+
Serial.print(F("\nStart EEPROM_put on "));
77+
Serial.println(BOARD_NAME);
7378
Serial.println(FLASH_STORAGE_SAMD_VERSION);
7479

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

0 commit comments

Comments
 (0)