Skip to content

Commit dc6bf65

Browse files
Update libraries
1 parent d8750dd commit dc6bf65

File tree

21 files changed

+847
-146
lines changed

21 files changed

+847
-146
lines changed
5.25 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
\\.git/
2+
.pioenvs/
3+
.sconsign.dblite

source_MCU_boards/lib/DvG_SerialCommand-master/DvG_SerialCommand.cpp renamed to source_MCU_boards/lib/DvG_SerialCommand-2.0/DvG_SerialCommand.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Dennis van Gils, 14-08-2018
2+
Dennis van Gils, 11-03-2020
33
*/
44

55
#include "DvG_SerialCommand.h"
@@ -53,7 +53,7 @@ char* DvG_SerialCommand::getCmd() {
5353
_iPos = 0; // Reset incoming serial command char array
5454
return (char*) _strIn;
5555
} else {
56-
return '\0';
56+
return (char*) _empty;
5757
}
5858
}
5959

source_MCU_boards/lib/DvG_SerialCommand-master/DvG_SerialCommand.h renamed to source_MCU_boards/lib/DvG_SerialCommand-2.0/DvG_SerialCommand.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
/*
2-
Listen to the serial port for commands.
3-
4-
This library uses a C-string (null-terminated character array) to store incoming
5-
characters received over a serial port. Carriage return ('\r', ASCII 13)
2+
This library allows listening to a serial port for incoming commands and act
3+
upon them. To keep the memory usage low, it uses a C-string (null-terminated
4+
character array) to store incoming characters received over the serial port,
5+
instead of using a memory hungry C++ string. Carriage return ('\r', ASCII 13)
66
characters are ignored. Once a linefeed ('\n', ASCII 10) character is received,
7-
or whenever the incoming message length has exceeded the buffer of size STR_LEN,
8-
we speak of a received 'command'.
7+
or whenever the incoming message length has exceeded the buffer of size
8+
STR_LEN (defined in DvG_SerialCommand.h), we speak of a received 'command'.
9+
It doesn't matter if the command is ASCII or binary encoded.
910
1011
'available()' should be called periodically to poll for incoming characters. It
1112
will return true when a new command is ready to be processed. Subsequently, the
1213
command string can be retrieved by calling 'getCmd()'.
1314
14-
A C-string is used to reduce memory overhead and prevent possible memory
15-
fragmentation that otherwise could happen when using a C++ string instead.
16-
17-
Dennis van Gils, 14-08-2018
15+
Dennis van Gils, 11-03-2020
1816
*/
1917

2018
#ifndef H_DvG_SerialCommand
@@ -43,6 +41,8 @@ class DvG_SerialCommand {
4341
char _strIn[STR_LEN]; // Incoming serial command string
4442
bool _fTerminated; // Incoming serial command is/got terminated?
4543
uint8_t _iPos; // Index within _strIn to insert new char
44+
const char* _empty = "\0"; // Reply when trying to retrieve command when not
45+
// yet terminated
4646
};
4747

4848
/*------------------------------------------------------------------------------

source_MCU_boards/lib/DvG_SerialCommand-master/README.md renamed to source_MCU_boards/lib/DvG_SerialCommand-2.0/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# Serial command listener
22

3-
This library allows listening to a serial port for incoming commands and act upon them. It uses a C-string (null-terminated character array) to store incoming characters received over the serial port. Carriage return ('\r', ASCII 13) characters are ignored. Once a linefeed ('\n', ASCII 10) character is received, or whenever the incoming message length has exceeded the buffer of size STR_LEN (defined in DvG_SerialCommand.h), we speak of a received 'command'. It doesn't matter if the command is ASCII or binary encoded.
3+
This library allows listening to a serial port for incoming commands and act upon them. To keep the memory usage low, it uses a C-string (null-terminated character array) to store incoming characters received over the serial port, instead of using a memory hungry C++ string. Carriage return ('\r', ASCII 13) characters are ignored. Once a linefeed ('\n', ASCII 10) character is received, or whenever the incoming message length has exceeded the buffer of size STR_LEN (defined in DvG_SerialCommand.h), we speak of a received 'command'. It doesn't matter if the command is ASCII or binary encoded.
44

55
``available()`` should be called periodically to poll for incoming characters. It will return true when a new command is ready to be processed. Subsequently, the command string can be retrieved by calling ``getCmd()``.
66

7-
The library makes use of a C-string in order to reduce memory overhead and prevent possible memory fragmentation that otherwise could happen when using a C++ string instead.
8-
97
Example usage on an Arduino:
108
```C
119
#include <Arduino.h>
@@ -15,7 +13,7 @@ Example usage on an Arduino:
1513
DvG_SerialCommand sc(Ser);
1614

1715
void setup() {
18-
Ser.begin(9600); // Open port
16+
Ser.begin(115200); // Open port
1917
}
2018

2119
void loop() {
@@ -26,7 +24,7 @@ void loop() {
2624

2725
// Your command string comparison routines and actions here
2826
if (strcmp(strCmd, "id?") == 0) {
29-
Ser.println("My Arduino");
27+
Ser.println("Arduino, Blinker");
3028
}
3129
}
3230
}

source_MCU_boards/lib/DvG_SerialCommand-master/library.properties renamed to source_MCU_boards/lib/DvG_SerialCommand-2.0/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=DvG_SerialCommand
2-
version=1.0.0
2+
version=2.0.0
33
author=Dennis van Gils <[email protected]>
44
maintainer=Dennis van Gils <[email protected]>
55
sentence=Listen to the serial port for commands
10.4 KB
Binary file not shown.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
*.obj
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Compiled Dynamic libraries
12+
*.so
13+
*.dylib
14+
*.dll
15+
16+
# Fortran module files
17+
*.mod
18+
19+
# Compiled Static libraries
20+
*.lai
21+
*.la
22+
*.a
23+
*.lib
24+
25+
# Executables
26+
*.exe
27+
*.out
28+
*.app
29+
30+
.DS_Store
31+
/.idea
32+
/build
33+
/bin
34+
/lib
35+
/sftp-config.json
36+
.tags
37+
.tags_sorted_by_file
38+
39+
# for platformio on vscode
40+
platformio.ini
41+
main.cpp
42+
/.pio
43+
/.vscode
44+
45+
46+
47+

0 commit comments

Comments
 (0)