Skip to content

Commit 0cc3f9c

Browse files
authored
Merge pull request #6 from J-Rios/callbacks
CLI Support Handle Commands by Callbacks
2 parents 41c24b6 + 6125c8c commit 0cc3f9c

104 files changed

Lines changed: 6882 additions & 63 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_avr.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ jobs:
2929
cd examples/avr/basic_usage/build
3030
make clean
3131
make build DEVICE=atmega328p F_CPU=16000000L
32+
cd examples/avr/basic_usage_callbacks/build
33+
make clean
34+
make build DEVICE=atmega328p F_CPU=16000000L

.github/workflows/build_linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ jobs:
2929
cd examples/linux/basic_usage/build
3030
make clean
3131
make build
32+
cd examples/linux/basic_usage_callbacks/build
33+
make clean
34+
make build

.github/workflows/build_pio_arduino.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
example: [examples/arduino/basic_usage/src/main.cpp]
14+
example: [
15+
examples/arduino/basic_usage/src/main.cpp,
16+
examples/arduino/basic_usage_callbacks/src/main.cpp
17+
]
1518

1619
steps:
1720
- uses: actions/checkout@v2
@@ -33,6 +36,6 @@ jobs:
3336
python -m pip install --upgrade pip
3437
pip install --upgrade platformio
3538
- name: Run PlatformIO
36-
run: pio ci --project-conf="examples/arduino/basic_usage/platformio.ini"
39+
run: pio ci --project-conf="examples/arduino/platformio.ini"
3740
env:
3841
PLATFORMIO_CI_SRC: ${{ matrix.example }}

.github/workflows/build_pio_espidf.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
example: [examples/espidf/basic_usage/src/main.cpp]
14+
example: [
15+
examples/espidf/basic_usage/src/main.cpp,
16+
examples/espidf/basic_usage_callbacks/src/main.cpp
17+
]
1518

1619
steps:
1720
- uses: actions/checkout@v2

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/arduino/basic_usage/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ default_envs = arduino_esp32 ; Build ESP32 with Arduino Framework
1919
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2020

2121
[env]
22-
lib_deps = minbasecli@1.1.1
22+
lib_deps = minbasecli@1.2.0
2323

2424
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2525

examples/arduino/basic_usage/src/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file examples/arduino/basic_usage/basic_usage.ino
2+
* @file examples/arduino/basic_usage/src/basic_usage.ino
33
* @author Jose Miguel Rios Rubio <jrios.github@gmail.com>
44
* @date 02-04-2022
55
* @version 1.0.1
@@ -98,8 +98,8 @@ void loop()
9898
{
9999
Cli.printf("Available Commands:\n");
100100
Cli.printf(" help - Current info.\n");
101-
Cli.printf(" led [on/off] - Turn LED ON or OFF\n");
102-
Cli.printf(" version - Shows current firmware version\n");
101+
Cli.printf(" led [on/off] - Turn LED ON or OFF.\n");
102+
Cli.printf(" version - Shows current firmware version.\n");
103103
}
104104
else if(strcmp(cli_read.cmd, "led") == 0)
105105
{
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
This directory is intended for project header files.
3+
4+
A header file is a file containing C declarations and macro definitions
5+
to be shared between several project source files. You request the use of a
6+
header file in your project source file (C, C++, etc) located in `src` folder
7+
by including it, with the C preprocessing directive `#include'.
8+
9+
```src/main.c
10+
11+
#include "header.h"
12+
13+
int main (void)
14+
{
15+
...
16+
}
17+
```
18+
19+
Including a header file produces the same results as copying the header file
20+
into each source file that needs it. Such copying would be time-consuming
21+
and error-prone. With a header file, the related declarations appear
22+
in only one place. If they need to be changed, they can be changed in one
23+
place, and programs that include the header file will automatically use the
24+
new version when next recompiled. The header file eliminates the labor of
25+
finding and changing all the copies as well as the risk that a failure to
26+
find one copy will result in inconsistencies within a program.
27+
28+
In C, the usual convention is to give header files names that end with `.h'.
29+
It is most portable to use only letters, digits, dashes, and underscores in
30+
header file names, and at most one dot.
31+
32+
Read more about using header files in official GCC documentation:
33+
34+
* Include Syntax
35+
* Include Operation
36+
* Once-Only Headers
37+
* Computed Includes
38+
39+
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
This directory is intended for project specific (private) libraries.
3+
PlatformIO will compile them to static libraries and link into executable file.
4+
5+
The source code of each library should be placed in a an own separate directory
6+
("lib/your_library_name/[here are source files]").
7+
8+
For example, see a structure of the following two libraries `Foo` and `Bar`:
9+
10+
|--lib
11+
| |
12+
| |--Bar
13+
| | |--docs
14+
| | |--examples
15+
| | |--src
16+
| | |- Bar.c
17+
| | |- Bar.h
18+
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
19+
| |
20+
| |--Foo
21+
| | |- Foo.c
22+
| | |- Foo.h
23+
| |
24+
| |- README --> THIS FILE
25+
|
26+
|- platformio.ini
27+
|--src
28+
|- main.c
29+
30+
and a contents of `src/main.c`:
31+
```
32+
#include <Foo.h>
33+
#include <Bar.h>
34+
35+
int main (void)
36+
{
37+
...
38+
}
39+
40+
```
41+
42+
PlatformIO Library Dependency Finder will find automatically dependent
43+
libraries scanning project source files.
44+
45+
More information about PlatformIO Library Dependency Finder
46+
- https://docs.platformio.org/page/librarymanager/ldf.html

0 commit comments

Comments
 (0)