-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from J-Rios/development
Version v1.2.0 (command setup and callbacks)
- Loading branch information
Showing
123 changed files
with
7,781 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,7 @@ | |
**/*.hex | ||
**/memory_ram.txt | ||
**/memory_program.txt | ||
|
||
build/ | ||
src/main.cpp | ||
src/main.c |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.rulers": [ 79 ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
[platformio] | ||
default_envs = arduino_esp32 ; Build ESP32 with Arduino Framework | ||
;default_envs = arduino_esp32_c3 ; Build ESP32-C3 with Arduino Framework | ||
;default_envs = arduino_esp8266 ; Build ESP8266 with Arduino Framework | ||
;default_envs = arduino_uno_atmega328 ; Build Arduino Uno with Arduino Framework | ||
;default_envs = arduino_mega_atmega2560 ; Build Arduino Mega with Arduino Framework | ||
|
@@ -19,51 +20,58 @@ default_envs = arduino_esp32 ; Build ESP32 with Arduino Framework | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
|
||
[env] | ||
lib_deps = minbasecli@1.1.1 | ||
lib_deps = minbasecli | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
|
||
; Arduino Build Configs | ||
|
||
; ESP32 Arduino | ||
[env:arduino_esp32] | ||
platform = espressif32@3.5.0 | ||
platform = espressif32@5.0.0 | ||
board = esp32dev | ||
framework = arduino | ||
|
||
; ESP32-C3 Arduino | ||
[env:arduino_esp32_c3] | ||
platform = [email protected] | ||
board = esp32-c3-devkitm-1 | ||
framework = arduino | ||
board_build.mcu = esp32c3 | ||
|
||
; ESP8266 Arduino | ||
[env:arduino_esp8266] | ||
platform = espressif8266@3.2.0 | ||
platform = espressif8266@4.0.1 | ||
board = esp12e | ||
framework = arduino | ||
|
||
; Arduino Uno (atmega328) | ||
[env:arduino_uno_atmega328] | ||
platform = atmelavr@3.3.0 | ||
platform = atmelavr@4.0.0 | ||
board = uno | ||
framework = arduino | ||
|
||
; Arduino Mega (atmega2560) | ||
[env:arduino_mega_atmega2560] | ||
platform = atmelavr@3.3.0 | ||
platform = atmelavr@4.0.0 | ||
board = megaatmega2560 | ||
framework = arduino | ||
|
||
; Arduino Nano (atmega168) | ||
[env:arduino_nano_atmega168] | ||
platform = atmelavr@3.3.0 | ||
platform = atmelavr@4.0.0 | ||
board = nanoatmega168 | ||
framework = arduino | ||
|
||
; Arduino Nano (atmega328) | ||
[env:arduino_nano_atmega328] | ||
platform = atmelavr@3.3.0 | ||
platform = atmelavr@4.0.0 | ||
board = nanoatmega328 | ||
framework = arduino | ||
|
||
; Arduino Pro Micro (atmega32u4) | ||
[env:arduino_micro_atmega32u4] | ||
platform = atmelavr@3.3.0 | ||
platform = atmelavr@4.0.0 | ||
board = micro | ||
framework = arduino | ||
;build_flags = -DUSBCON=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/** | ||
* @file examples/arduino/basic_usage/basic_usage.ino | ||
* @file examples/arduino/basic_usage/src/main.cpp | ||
* @author Jose Miguel Rios Rubio <[email protected]> | ||
* @date 02-04-2022 | ||
* @version 1.0.1 | ||
* @date 05-03-2023 | ||
* @version 1.0.3 | ||
* | ||
* @section DESCRIPTION | ||
* | ||
|
@@ -75,7 +75,7 @@ void setup() | |
Serial.begin(SERIAL_BAUDS); | ||
|
||
// CLI init to use Serial as interface | ||
Cli.setup(&Serial); | ||
Cli.setup(&Serial, SERIAL_BAUDS); | ||
Cli.printf("\nCommand Line Interface is ready\n\n"); | ||
} | ||
|
||
|
@@ -84,58 +84,58 @@ void loop() | |
t_cli_result cli_read; | ||
|
||
// If any command was received | ||
if(Cli.manage(&cli_read)) | ||
if (Cli.manage(&cli_read)) | ||
{ | ||
// Show read result element | ||
Cli.printf("Command received: %s\n", cli_read.cmd); | ||
Cli.printf("Number of arguments: %d\n", (int)(cli_read.argc)); | ||
for(int i = 0; i < cli_read.argc; i++) | ||
Cli.printf(" Argument %d: %s", i, cli_read.argv[i]); | ||
Cli.printf("Number of arguments: %d\n"), (int)(cli_read.argc); | ||
for (int i = 0; i < cli_read.argc; i++) | ||
{ Cli.printf(" Argument %d: %s", i, cli_read.argv[i]); } | ||
Cli.printf("\n"); | ||
|
||
// Handle Commands | ||
if(strcmp(cli_read.cmd, "help") == 0) | ||
if (strcmp(cli_read.cmd, "help") == 0) | ||
{ | ||
Cli.printf("Available Commands:\n"); | ||
Cli.printf(" help - Current info.\n"); | ||
Cli.printf(" led [on/off] - Turn LED ON or OFF\n"); | ||
Cli.printf(" version - Shows current firmware version\n"); | ||
Cli.printf(" led [on/off] - Turn LED ON or OFF.\n"); | ||
Cli.printf(" version - Shows current firmware version.\n"); | ||
} | ||
else if(strcmp(cli_read.cmd, "led") == 0) | ||
else if (strcmp(cli_read.cmd, "led") == 0) | ||
{ | ||
bool invalid_argv = false; | ||
char* led_mode = NULL; | ||
|
||
// Check for argument | ||
if(cli_read.argc == 0) | ||
invalid_argv = true; | ||
if (cli_read.argc == 0) | ||
{ invalid_argv = true; } | ||
else | ||
{ | ||
led_mode = cli_read.argv[0]; | ||
if(strcmp(led_mode, "on") == 0) | ||
if (strcmp(led_mode, "on") == 0) | ||
{ | ||
Cli.printf("Turning LED ON.\n"); | ||
digitalWrite(COMMAND_LED, HIGH); | ||
} | ||
else if(strcmp(led_mode, "off") == 0) | ||
else if (strcmp(led_mode, "off") == 0) | ||
{ | ||
Cli.printf("Turning LED OFF.\n"); | ||
digitalWrite(COMMAND_LED, LOW); | ||
} | ||
else | ||
invalid_argv = true; | ||
{ invalid_argv = true; } | ||
} | ||
|
||
if(invalid_argv) | ||
Cli.printf("led command needs \"on\" or \"off\" arg.\n"); | ||
if (invalid_argv) | ||
{ Cli.printf("led command needs \"on\" or \"off\" arg.\n"); } | ||
} | ||
else if(strcmp(cli_read.cmd, "version") == 0) | ||
else if (strcmp(cli_read.cmd, "version") == 0) | ||
{ | ||
Cli.printf("FW App Version: %s\n", FW_APP_VERSION); | ||
} | ||
// ... | ||
else | ||
Cli.printf("Unkown command.\n"); | ||
{ Cli.printf("Unkown command.\n"); } | ||
Cli.printf("\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.pio | ||
.vscode/.browse.c_cpp.db* | ||
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.vscode/ipch |
Oops, something went wrong.