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

Commit

Permalink
Update README.md and use allman astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
khoih-prog committed Nov 25, 2022
1 parent c29cc94 commit 088cf4b
Show file tree
Hide file tree
Showing 10 changed files with 347 additions and 203 deletions.
29 changes: 25 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* `Arduino mbed_rp2040` Core Version (e.g. Arduino mbed_rp2040 core v2.6.1)
* `Arduino mbed_rp2040` Core Version (e.g. Arduino mbed_rp2040 core v3.4.1)
* `RP2040` Board type (e.g. Nano_RP2040_Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc.)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
Expand All @@ -28,13 +28,13 @@ Please ensure to specify the following:

```
Arduino IDE version: 1.8.19
Arduino mbed_rp2040 core v2.6.1
Arduino mbed_rp2040 core v3.4.1
RASPBERRY_PI_PICO board
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
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
Context:
I encountered a crash while using TimerInterrupt.
I encountered a crash while using this library
Steps to reproduce:
1. ...
Expand All @@ -43,12 +43,33 @@ Steps to reproduce:
4. ...
```

---

### Sending Feature Requests

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

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

---

### Sending Pull Requests

Pull Requests with changes and fixes are also welcome!

Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)

1. Change directory to the library GitHub

```
xy@xy-Inspiron-3593:~$ cd Arduino/xy/LittleFS_Mbed_RP2040_GitHub/
xy@xy-Inspiron-3593:~/Arduino/xy/LittleFS_Mbed_RP2040_GitHub$
```

2. Issue astyle command

```
xy@xy-Inspiron-3593:~/Arduino/xy/LittleFS_Mbed_RP2040_GitHub$ bash utils/restyle.sh
```


34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/LittleFS_Mbed_RP2040.svg)](http://github.com/khoih-prog/LittleFS_Mbed_RP2040/issues)

<a href="https://www.buymeacoffee.com/khoihprog6" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 50px !important;width: 181px !important;" ></a>

<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>
<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>
<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>
<a href="https://profile-counter.glitch.me/khoih-prog-LittleFS_Mbed_RP2040/count.svg" title="LittleFS_Mbed_RP2040 Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-LittleFS_Mbed_RP2040/count.svg" style="height: 30px;width: 200px;"></a>


---
Expand Down Expand Up @@ -46,11 +50,20 @@

### Important Notes

The LittleFS of the new **Nano_RP2040_Connect** board ( see [New board](pics/New_Board.png) ), using ISSI Flash chip, is currently not working with [`Arduino mbed_rp2040 core 2.4.1`](https://github.com/arduino/ArduinoCore-mbed/releases/tag/2.4.1). Please downgrade to [`Arduino mbed_rp2040 core 2.3.1`](https://github.com/arduino/ArduinoCore-mbed/releases/tag/2.3.1)
The LittleFS of the new **Nano_RP2040_Connect** board (see picture below), using `ISSI` Flash chip, is currently **not working** with [`Arduino mbed_rp2040 core 2.4.1+`](https://github.com/arduino/ArduinoCore-mbed/releases/tag/2.4.1). Please downgrade to [`Arduino mbed_rp2040 core 2.3.1`](https://github.com/arduino/ArduinoCore-mbed/releases/tag/2.3.1)

<p align="center">
<img src="https://github.com/khoih-prog/LittleFS_Mbed_RP2040/raw/main/pics/New_Board.png">
</p>

Check [**RP2040 Connect board has faulty components in newest purchase** #318](https://github.com/arduino/ArduinoCore-mbed/issues/318#) for more information of when and how the issue will be fixed.

The old board ( see [Old board](pics/Old_Board.png) ), using Adesto Flash chip, is currently working with [`Arduino mbed_rp2040 core 2.4.1`](https://github.com/arduino/ArduinoCore-mbed/releases/tag/2.4.1).
The old board (see picture below), using `Adesto` Flash chip, is currently working with [`Arduino mbed_rp2040 core 2.4.1+`](https://github.com/arduino/ArduinoCore-mbed/releases/tag/2.4.1).


<p align="center">
<img src="https://github.com/khoih-prog/LittleFS_Mbed_RP2040/raw/main/pics/Old_Board.png">
</p>

---
---
Expand Down Expand Up @@ -102,7 +115,7 @@ Another way to install is to:

1. Install [VS Code](https://code.visualstudio.com/)
2. Install [PlatformIO](https://platformio.org/platformio-ide)
3. Install [**LittleFS_Mbed_RP2040** library](https://platformio.org/lib/show/12420/LittleFS_Mbed_RP2040) by using [Library Manager](https://platformio.org/lib/show/12420/LittleFS_Mbed_RP2040/installation). Search for **LittleFS_Mbed_RP2040** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
3. Install [**LittleFS_Mbed_RP2040** library](https://registry.platformio.org/libraries/khoih-prog/LittleFS_Mbed_RP2040) by using [Library Manager](https://registry.platformio.org/libraries/khoih-prog/LittleFS_Mbed_RP2040/installation). Search for **LittleFS_Mbed_RP2040** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
4. Use included [platformio.ini](platformio/platformio.ini) file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at [Project Configuration File](https://docs.platformio.org/page/projectconf.html)


Expand All @@ -120,7 +133,7 @@ Another way to install is to:

### Example [Littlefs_Test](examples/Littlefs_Test)

```
```cpp
#define LFS_MBED_RP2040_VERSION_MIN_TARGET "LittleFS_Mbed_RP2040 v1.1.0"
#define LFS_MBED_RP2040_VERSION_MIN 1001000

Expand Down Expand Up @@ -455,6 +468,8 @@ void loop()
{
}
```
---
---
Expand All @@ -464,7 +479,7 @@ void loop()
The following is the sample terminal output when running example [LittleFS_Counting](examples/LittleFS_Counting) on MBED RaspberryPi Pico
```
```cpp
Start LittleFS_Counting on RaspberryPi Pico
LittleFS_Mbed_RP2040 v1.1.0
[LFS] LittleFS size (KB) = 256
Expand All @@ -490,12 +505,14 @@ Times have been run = 3
=> Open to write OK
```

---

### 2. LittleFS_Test on RaspberryPi Pico

The following is the sample terminal output when running example [LittleFS_Test](examples/LittleFS_Test) on MBED RaspberryPi Pico


```
```cpp
Start LittleFS_Test on RaspberryPi Pico
LittleFS_Mbed_RP2040 v1.1.0
[LFS] LittleFS size (KB) = 256
Expand Down Expand Up @@ -548,7 +565,6 @@ Deleting file: /littlefs/hello2.txt => OK
====================================================

Test complete
```
---
Expand Down Expand Up @@ -637,6 +653,6 @@ If you want to contribute to this project:

## Copyright

Copyright 2021- Khoi Hoang
Copyright (c) 2021- Khoi Hoang


6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/LittleFS_Mbed_RP2040.svg)](http://github.com/khoih-prog/LittleFS_Mbed_RP2040/issues)


<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>
<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>
<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>
<a href="https://profile-counter.glitch.me/khoih-prog-LittleFS_Mbed_RP2040/count.svg" title="LittleFS_Mbed_RP2040 Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-LittleFS_Mbed_RP2040/count.svg" style="height: 30px;width: 200px;"></a>

---
---

Expand Down
57 changes: 32 additions & 25 deletions examples/LittleFS_Counting/LittleFS_Counting.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/****************************************************************************************************************************
LittleFS_Counting.ino - Filesystem wrapper for LittleFS on the Mbed RP2040

For MBED RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040.
Written by Khoi Hoang

Expand All @@ -22,87 +22,94 @@

LittleFS_MBED *myFS;

void setup()
void setup()
{
Serial.begin(115200);

while (!Serial)

delay(1000);
delay(1000);

Serial.print("\nStart LittleFS_Counting on "); Serial.println(BOARD_NAME);
Serial.print("\nStart LittleFS_Counting on ");
Serial.println(BOARD_NAME);
Serial.println(LFS_MBED_RP2040_VERSION);

#if defined(LFS_MBED_RP2040_VERSION_MIN)

if (LFS_MBED_RP2040_VERSION_INT < LFS_MBED_RP2040_VERSION_MIN)
{
Serial.print("Warning. Must use this example on Version equal or later than : ");
Serial.println(LFS_MBED_RP2040_VERSION_MIN_TARGET);
}

#endif

myFS = new LittleFS_MBED();

if (!myFS->init())
if (!myFS->init())
{
Serial.println("LITTLEFS Mount Failed");

return;
}

char fileName[] = MBED_LITTLEFS_FILE_PREFIX "/counts.txt";

#define BUF_SIZE 32
#define BUF_SIZE 32

char buff[BUF_SIZE];
int count = 1;

#if START_COUNT_OVER
Serial.print("Deleting file: "); Serial.print(fileName);

if (remove(fileName) == 0)
Serial.print("Deleting file: ");
Serial.print(fileName);

if (remove(fileName) == 0)
{
Serial.println(" => OK");
}
else
{
Serial.println(" => Failed");
}

#endif

FILE *file = fopen(fileName, "r");
if (file)

if (file)
{
Serial.println(" => Open to read OK");

bzero(buff, BUF_SIZE);

uint32_t numRead = fread((uint8_t *) buff, BUF_SIZE - 1, 1, file);

if ( numRead )
{
sscanf(buff, "%d", &count);
//Serial.print("Times have been run = "); Serial.println(count);
}

fclose(file);
}

Serial.print("Times have been run = "); Serial.println(count);

Serial.print("Times have been run = ");
Serial.println(count);

sprintf(buff, "%d\n", ++count);

file = fopen(fileName, "w");
if (file)

if (file)
{
Serial.println(" => Open to write OK");

fwrite((uint8_t *) buff, 1, BUF_SIZE - 1, file) ;
fclose(file);
}
}

void loop()
void loop()
{
}
Loading

0 comments on commit 088cf4b

Please sign in to comment.