mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.2.6 Multiplex
This commit is contained in:
parent
353b00ec0e
commit
55a0732cff
@ -6,7 +6,7 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: arduino/arduino-lint-action@v1
|
- uses: arduino/arduino-lint-action@v1
|
||||||
with:
|
with:
|
||||||
library-manager: update
|
library-manager: update
|
||||||
|
@ -8,7 +8,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.6
|
ruby-version: 2.6
|
||||||
|
@ -10,7 +10,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: json-syntax-check
|
- name: json-syntax-check
|
||||||
uses: limitusus/json-syntax-check@v1
|
uses: limitusus/json-syntax-check@v1
|
||||||
with:
|
with:
|
||||||
|
48
libraries/Multiplex/CHANGELOG.md
Normal file
48
libraries/Multiplex/CHANGELOG.md
Normal 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
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
//
|
//
|
||||||
// FILE: Multiplex.cpp
|
// FILE: Multiplex.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.5
|
// VERSION: 0.2.6
|
||||||
// PURPOSE: Arduino library to multiplex streams
|
// PURPOSE: Arduino library to multiplex streams
|
||||||
// DATE: 2021-01-09
|
// DATE: 2021-01-09
|
||||||
// URL: https://github.com/RobTillaart/Multiplex
|
// URL: https://github.com/RobTillaart/Multiplex
|
||||||
//
|
|
||||||
// HISTORY: see changelog.md
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "Multiplex.h"
|
#include "Multiplex.h"
|
||||||
@ -105,14 +102,14 @@ 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++)
|
for (uint8_t i = 0; i < _count; i++)
|
||||||
{
|
{
|
||||||
if (_enabled[i])
|
if (_enabled[i])
|
||||||
{
|
{
|
||||||
_stream[i]->flush();
|
_stream[i]->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,5 +185,5 @@ bool Multiplex::isEnabledStream(Print *stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: Multiplex.h
|
// FILE: Multiplex.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.5
|
// VERSION: 0.2.6
|
||||||
// PURPOSE: Arduino library to multiplex streams
|
// PURPOSE: Arduino library to multiplex streams
|
||||||
// DATE: 2021-01-09
|
// DATE: 2021-01-09
|
||||||
// URL: https://github.com/RobTillaart/Multiplex
|
// URL: https://github.com/RobTillaart/Multiplex
|
||||||
@ -11,10 +11,10 @@
|
|||||||
#include "Arduino.h"
|
#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
|
#ifndef MAX_MULTIPLEX
|
||||||
#define MAX_MULTIPLEX 4
|
#define MAX_MULTIPLEX 4
|
||||||
#endif
|
#endif
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
bool remove(Print * stream);
|
bool remove(Print * stream);
|
||||||
bool remove(uint8_t index);
|
bool remove(uint8_t index);
|
||||||
|
|
||||||
// see issue 13
|
// see issue #13
|
||||||
virtual void flush() override;
|
virtual void flush() override;
|
||||||
|
|
||||||
// CONTROL
|
// CONTROL
|
||||||
@ -78,5 +78,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -153,7 +153,10 @@ See examples
|
|||||||
|
|
||||||
## Future
|
## Future
|
||||||
|
|
||||||
#### 0.3.0
|
#### Must
|
||||||
|
|
||||||
|
|
||||||
|
#### Should
|
||||||
|
|
||||||
- set size in constructor
|
- set size in constructor
|
||||||
- dynamic memory for all internal arrays
|
- dynamic memory for all internal arrays
|
||||||
@ -163,7 +166,8 @@ See examples
|
|||||||
- breaking change ==> 0.3.0
|
- breaking change ==> 0.3.0
|
||||||
- add **removeAll()** ==> reset()
|
- add **removeAll()** ==> reset()
|
||||||
|
|
||||||
#### should
|
|
||||||
|
#### Could
|
||||||
|
|
||||||
- error handling
|
- error handling
|
||||||
- add an error flag if one of the streams does not **write()**
|
- 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
|
- KB / second
|
||||||
- move all code to .cpp
|
- move all code to .cpp
|
||||||
|
|
||||||
#### wont
|
#### Wont
|
||||||
|
|
||||||
- pack enabled flag in one or more bytes.
|
- pack enabled flag in one or more bytes.
|
||||||
(not much faster + need to encode/decode)
|
(not much faster + need to encode/decode)
|
||||||
|
@ -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:
|
compile:
|
||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
# - uno
|
# - uno
|
||||||
# - due
|
# - due
|
||||||
@ -9,4 +24,5 @@ compile:
|
|||||||
# - esp32
|
# - esp32
|
||||||
# - esp8266
|
# - esp8266
|
||||||
- mega2560
|
- mega2560
|
||||||
|
# - rpipico
|
||||||
|
|
||||||
|
@ -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:
|
compile:
|
||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
- uno
|
- uno
|
||||||
# - due
|
# - due // has no SoftwareSerial
|
||||||
# - zero
|
# - zero // has no SoftwareSerial
|
||||||
- leonardo
|
- leonardo
|
||||||
# - m4
|
# - m4 // has no SoftwareSerial
|
||||||
# - esp32
|
# - esp32 // has no SoftwareSerial
|
||||||
# - esp8266
|
- esp8266
|
||||||
- mega2560
|
- mega2560
|
||||||
|
- rpipico
|
||||||
|
# external libraries
|
||||||
libraries:
|
libraries:
|
||||||
# - SoftwareSerial # werkt niet..
|
# - "SoftwareSerial" does not work as it is build in.
|
||||||
|
|
||||||
|
@ -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:
|
compile:
|
||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
- uno
|
- uno
|
||||||
# - due
|
# - due // has no SoftwareSerial
|
||||||
# - zero
|
# - zero // has no SoftwareSerial
|
||||||
- leonardo
|
- leonardo
|
||||||
# - m4
|
# - m4 // has no SoftwareSerial
|
||||||
# - esp32
|
# - esp32 // has no SoftwareSerial
|
||||||
# - esp8266
|
- esp8266
|
||||||
- mega2560
|
- mega2560
|
||||||
|
- rpipico
|
||||||
|
# external libraries
|
||||||
libraries:
|
libraries:
|
||||||
# - SoftwareSerial # werkt niet..
|
# - "SoftwareSerial" does not work as it is build in.
|
||||||
- "SD"
|
- "SD"
|
||||||
|
@ -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:
|
compile:
|
||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
- uno
|
- uno
|
||||||
# - due
|
# - due // has no SoftwareSerial
|
||||||
# - zero
|
# - zero // has no SoftwareSerial
|
||||||
- leonardo
|
- leonardo
|
||||||
# - m4
|
# - m4 // has no SoftwareSerial
|
||||||
# - esp32
|
# - esp32 // has no SoftwareSerial
|
||||||
# - esp8266
|
- esp8266
|
||||||
- mega2560
|
- mega2560
|
||||||
|
- rpipico
|
||||||
|
# external libraries
|
||||||
libraries:
|
libraries:
|
||||||
# - SoftwareSerial # werkt niet..
|
# - "SoftwareSerial" does not work as it is build in.
|
||||||
|
|
||||||
|
@ -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:
|
compile:
|
||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
- uno
|
- uno
|
||||||
# - due
|
# - due // has no SoftwareSerial
|
||||||
# - zero
|
# - zero // has no SoftwareSerial
|
||||||
- leonardo
|
- leonardo
|
||||||
# - m4
|
# - m4 // has no SoftwareSerial
|
||||||
# - esp32
|
# - esp32 // has no SoftwareSerial
|
||||||
# - esp8266
|
- esp8266
|
||||||
- mega2560
|
- mega2560
|
||||||
|
- rpipico
|
||||||
|
# external libraries
|
||||||
libraries:
|
libraries:
|
||||||
# - SoftwareSerial # werkt niet..
|
# - "SoftwareSerial" does not work as it is build in.
|
||||||
|
|
||||||
|
@ -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:
|
compile:
|
||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
- uno
|
- uno
|
||||||
# - due
|
# - due // has no SoftwareSerial
|
||||||
# - zero
|
# - zero // has no SoftwareSerial
|
||||||
- leonardo
|
- leonardo
|
||||||
# - m4
|
# - m4 // has no SoftwareSerial
|
||||||
# - esp32
|
# - esp32 // has no SoftwareSerial
|
||||||
# - esp8266
|
- esp8266
|
||||||
- mega2560
|
- mega2560
|
||||||
|
- rpipico
|
||||||
|
# external libraries
|
||||||
libraries:
|
libraries:
|
||||||
# - SoftwareSerial # werkt niet..
|
# - "SoftwareSerial" does not work as it is build in.
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/Multiplex"
|
"url": "https://github.com/RobTillaart/Multiplex"
|
||||||
},
|
},
|
||||||
"version": "0.2.5",
|
"version": "0.2.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=Multiplex
|
name=Multiplex
|
||||||
version=0.2.5
|
version=0.2.6
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino Library implementing a stream multiplexer
|
sentence=Arduino Library implementing a stream multiplexer
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
//
|
//
|
||||||
// FILE: unit_test_001.cpp
|
// FILE: unit_test_001.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// DATE: 2021-01-01
|
// DATE: 2021-01-09
|
||||||
// PURPOSE: unit tests for the XXXXXX
|
// PURPOSE: unit tests for the Multiplex
|
||||||
// https://github.com/RobTillaart/
|
// https://github.com/RobTillaart/Multiplex
|
||||||
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
|
// https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -35,9 +35,10 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "Multiplex.h"
|
#include "Multiplex.h"
|
||||||
|
|
||||||
// A simple implementation of Print that outputs
|
|
||||||
// to Serial, prefixing each call to write(buffer, size)
|
// A simple implementation of Print that outputs
|
||||||
// with an id.
|
// to Serial, prefixing each call to write(buffer, size)
|
||||||
|
// with an id.
|
||||||
class FakeStream : public Print
|
class FakeStream : public Print
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -129,4 +130,4 @@ unittest(test_enable)
|
|||||||
unittest_main()
|
unittest_main()
|
||||||
|
|
||||||
|
|
||||||
// --------
|
// -- END OF FILE --
|
||||||
|
Loading…
Reference in New Issue
Block a user