0.2.6 Multiplex

This commit is contained in:
rob tillaart 2023-01-19 19:18:30 +01:00
parent 353b00ec0e
commit 55a0732cff
17 changed files with 220 additions and 65 deletions

View File

@ -6,7 +6,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: arduino/arduino-lint-action@v1
with:
library-manager: update

View File

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6

View File

@ -10,7 +10,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: json-syntax-check
uses: limitusus/json-syntax-check@v1
with:

View File

@ -0,0 +1,48 @@
# Change Log multiPlex
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.6] - 2023-01-19
- fix SoftwareSerial build
- update GitHub actions
- update license
- minor edit unit tests
- add changelog.md again :)
## [0.2.5] - 2022-10-23
- Add flush()
- add changelog.md
- add RP2040 support to build-CI
## [0.2.4] - 2022-06-12
- add isEnabledAny() to see if writes makes sense.
- keep the streams in adding order when removing a stream.
- add getOutputCount() and resetOutputCount() to keep track of bytes multiplexed.
## [0.2.3] - 2021-12-22
- update library.json, readme.md, license, minor edits
## [0.2.2] - 2021-09-12
- add remove(Stream)
- add remove(index)
## [0.2.1] - 2021-09-12
- made index(Stream) public
- added stream(index)
- enable() / disable() return true on success
- added free() function
- minor refactor.
## [0.2.0] - 2021-08-09
- See issues #2 and #3
----
## [0.1.0] - 2021-01-09
- initial version

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Rob Tillaart
Copyright (c) 2021-2023 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,13 +1,10 @@
//
// FILE: Multiplex.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.2.5
// VERSION: 0.2.6
// PURPOSE: Arduino library to multiplex streams
// DATE: 2021-01-09
// URL: https://github.com/RobTillaart/Multiplex
//
// HISTORY: see changelog.md
#include "Multiplex.h"
@ -105,7 +102,7 @@ size_t Multiplex::write(const uint8_t *buffer, size_t size)
}
void Multiplex::flush() // see issue 13
void Multiplex::flush() // see issue #13
{
for (uint8_t i = 0; i < _count; i++)
{
@ -188,5 +185,5 @@ bool Multiplex::isEnabledStream(Print *stream)
}
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,7 +2,7 @@
//
// FILE: Multiplex.h
// AUTHOR: Rob Tillaart
// VERSION: 0.2.5
// VERSION: 0.2.6
// PURPOSE: Arduino library to multiplex streams
// DATE: 2021-01-09
// URL: https://github.com/RobTillaart/Multiplex
@ -11,10 +11,10 @@
#include "Arduino.h"
#define MULTIPLEX_LIB_VERSION (F("0.2.5"))
#define MULTIPLEX_LIB_VERSION (F("0.2.6"))
// MAX 254 (in theory) as 0xFF is a special value
// MAX 254 (in theory) as 0xFF is a special value
#ifndef MAX_MULTIPLEX
#define MAX_MULTIPLEX 4
#endif
@ -39,7 +39,7 @@ public:
bool remove(Print * stream);
bool remove(uint8_t index);
// see issue 13
// see issue #13
virtual void flush() override;
// CONTROL
@ -78,5 +78,5 @@ private:
};
// -- END OF FILE --
// -- END OF FILE --

View File

@ -153,7 +153,10 @@ See examples
## Future
#### 0.3.0
#### Must
#### Should
- set size in constructor
- dynamic memory for all internal arrays
@ -163,7 +166,8 @@ See examples
- breaking change ==> 0.3.0
- add **removeAll()** ==> reset()
#### should
#### Could
- error handling
- add an error flag if one of the streams does not **write()**
@ -173,7 +177,7 @@ correctly and returns 0 or less than it should.
- KB / second
- move all code to .cpp
#### wont
#### Wont
- pack enabled flag in one or more bytes.
(not much faster + need to encode/decode)

View File

@ -1,5 +1,20 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
# - uno
# - due
@ -9,4 +24,5 @@ compile:
# - esp32
# - esp8266
- mega2560
# - rpipico

View File

@ -1,13 +1,31 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
# - due
# - zero
# - due // has no SoftwareSerial
# - zero // has no SoftwareSerial
- leonardo
# - m4
# - esp32
# - esp8266
# - m4 // has no SoftwareSerial
# - esp32 // has no SoftwareSerial
- esp8266
- mega2560
- rpipico
# external libraries
libraries:
# - SoftwareSerial # werkt niet..
# - "SoftwareSerial" does not work as it is build in.

View File

@ -1,14 +1,31 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
# - due
# - zero
# - due // has no SoftwareSerial
# - zero // has no SoftwareSerial
- leonardo
# - m4
# - esp32
# - esp8266
# - m4 // has no SoftwareSerial
# - esp32 // has no SoftwareSerial
- esp8266
- mega2560
- rpipico
# external libraries
libraries:
# - SoftwareSerial # werkt niet..
# - "SoftwareSerial" does not work as it is build in.
- "SD"

View File

@ -1,13 +1,31 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
# - due
# - zero
# - due // has no SoftwareSerial
# - zero // has no SoftwareSerial
- leonardo
# - m4
# - esp32
# - esp8266
# - m4 // has no SoftwareSerial
# - esp32 // has no SoftwareSerial
- esp8266
- mega2560
- rpipico
# external libraries
libraries:
# - SoftwareSerial # werkt niet..
# - "SoftwareSerial" does not work as it is build in.

View File

@ -1,13 +1,31 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
# - due
# - zero
# - due // has no SoftwareSerial
# - zero // has no SoftwareSerial
- leonardo
# - m4
# - esp32
# - esp8266
# - m4 // has no SoftwareSerial
# - esp32 // has no SoftwareSerial
- esp8266
- mega2560
- rpipico
# external libraries
libraries:
# - SoftwareSerial # werkt niet..
# - "SoftwareSerial" does not work as it is build in.

View File

@ -1,13 +1,31 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
# - due
# - zero
# - due // has no SoftwareSerial
# - zero // has no SoftwareSerial
- leonardo
# - m4
# - esp32
# - esp8266
# - m4 // has no SoftwareSerial
# - esp32 // has no SoftwareSerial
- esp8266
- mega2560
- rpipico
# external libraries
libraries:
# - SoftwareSerial # werkt niet..
# - "SoftwareSerial" does not work as it is build in.

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/Multiplex"
},
"version": "0.2.5",
"version": "0.2.6",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=Multiplex
version=0.2.5
version=0.2.6
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino Library implementing a stream multiplexer

View File

@ -1,9 +1,9 @@
//
// FILE: unit_test_001.cpp
// AUTHOR: Rob Tillaart
// DATE: 2021-01-01
// PURPOSE: unit tests for the XXXXXX
// https://github.com/RobTillaart/
// DATE: 2021-01-09
// PURPOSE: unit tests for the Multiplex
// https://github.com/RobTillaart/Multiplex
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
//
@ -35,9 +35,10 @@
#include "Arduino.h"
#include "Multiplex.h"
// A simple implementation of Print that outputs
// to Serial, prefixing each call to write(buffer, size)
// with an id.
// A simple implementation of Print that outputs
// to Serial, prefixing each call to write(buffer, size)
// with an id.
class FakeStream : public Print
{
public:
@ -129,4 +130,4 @@ unittest(test_enable)
unittest_main()
// --------
// -- END OF FILE --