Skip to content

Commit

Permalink
Update libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis-van-Gils committed Jul 1, 2021
1 parent d8750dd commit dc6bf65
Show file tree
Hide file tree
Showing 21 changed files with 847 additions and 146 deletions.
Binary file added source_MCU_boards/lib/DvG_SerialCommand-2.0.zip
Binary file not shown.
3 changes: 3 additions & 0 deletions source_MCU_boards/lib/DvG_SerialCommand-2.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
\\.git/
.pioenvs/
.sconsign.dblite
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Dennis van Gils, 14-08-2018
Dennis van Gils, 11-03-2020
*/

#include "DvG_SerialCommand.h"
Expand Down Expand Up @@ -53,7 +53,7 @@ char* DvG_SerialCommand::getCmd() {
_iPos = 0; // Reset incoming serial command char array
return (char*) _strIn;
} else {
return '\0';
return (char*) _empty;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*
Listen to the serial port for commands.
This library uses a C-string (null-terminated character array) to store incoming
characters received over a serial port. Carriage return ('\r', ASCII 13)
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,
we speak of a received 'command'.
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.
'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()'.
A C-string is used to reduce memory overhead and prevent possible memory
fragmentation that otherwise could happen when using a C++ string instead.
Dennis van Gils, 14-08-2018
Dennis van Gils, 11-03-2020
*/

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

/*------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Serial command listener

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.
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.

``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()``.

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.

Example usage on an Arduino:
```C
#include <Arduino.h>
Expand All @@ -15,7 +13,7 @@ Example usage on an Arduino:
DvG_SerialCommand sc(Ser);

void setup() {
Ser.begin(9600); // Open port
Ser.begin(115200); // Open port
}

void loop() {
Expand All @@ -26,7 +24,7 @@ void loop() {

// Your command string comparison routines and actions here
if (strcmp(strCmd, "id?") == 0) {
Ser.println("My Arduino");
Ser.println("Arduino, Blinker");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=DvG_SerialCommand
version=1.0.0
version=2.0.0
author=Dennis van Gils <[email protected]>
maintainer=Dennis van Gils <[email protected]>
sentence=Listen to the serial port for commands
Expand Down
Binary file added source_MCU_boards/lib/Streaming-6.0.9.zip
Binary file not shown.
47 changes: 47 additions & 0 deletions source_MCU_boards/lib/Streaming-6.0.9/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

.DS_Store
/.idea
/build
/bin
/lib
/sftp-config.json
.tags
.tags_sorted_by_file

# for platformio on vscode
platformio.ini
main.cpp
/.pio
/.vscode




18 changes: 18 additions & 0 deletions source_MCU_boards/lib/Streaming-6.0.9/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Streaming.h - Arduino library for supporting the << streaming operator
Copyright (c) 2010-2012 Mikal Hart. All rights reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
22 changes: 22 additions & 0 deletions source_MCU_boards/lib/Streaming-6.0.9/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#+TITLE: Streaming
#+AUTHOR: Mikal Hart
#+EMAIL: [email protected]

* Library Information
- Name :: Streaming
- Version :: 6.0.9
- License :: GNU LGPL
- URL :: https://github.com/janelia-arduino/Streaming
- Author :: Mikal Hart
- Maintainer :: Peter Polidoro
- Email :: [email protected]

** Description

Streaming C++-style Output with Operator <<. Supports _DEC, _BIN, _HEX, _OCT,
_FLOAT, _PAD, _WIDTH, _WIDTHZ and _FMT stream helpers. See example code for
usage details.

* Source

[[http://arduiniana.org/libraries/streaming/]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <Streaming.h>


const long BAUD = 115200;

const int lettera = 'A';
const int month = 4, day = 17, year = 2009;
const int hour = 8, minute = 20, second = 3;

const long LOOP_DELAY = 1000;

void setup()
{
Serial.begin(BAUD);
}

void loop()
{
Serial << "This is an example of the new streaming" << endl;
Serial << "library. This allows you to print variables" << endl;
Serial << "and strings without having to type line after" << endl;
Serial << "line of Serial.print() calls. Examples: " << endl;

Serial << "A is " << lettera << "." << endl;
Serial << "The current date is " << day << "-" << month << "-" << year << "." << endl;

Serial << "You can use modifiers too, for example:" << endl;
Serial << _BYTE(lettera) << " is " << _HEX(lettera) << " in hex. " << endl;
Serial << endl;

Serial << "In library v6, you also get" << endl;
Serial << "Padding [" << _PAD(10, '*') << "]" << endl;
Serial << "Width specification [" << _WIDTH(10, 5) << "]" << endl;
Serial << "Leading zeros [" << _WIDTHZ(month,2) << "]" << endl;
Serial << _FMT("Format strings for stuff like dates and times %/%/% %:%:%",
_WIDTHZ(day, 2), _WIDTHZ(month, 2), year,
_WIDTHZ(hour,2), _WIDTHZ(minute, 2), _WIDTHZ(second,2)) << endl;
Serial << _FMT(F("To reduce your % size, these % can be in %"), F("sketch"), F("constants"), F("PROGMEM")) << endl;
Serial << endl;

delay(LOOP_DELAY);
}
Loading

0 comments on commit dc6bf65

Please sign in to comment.