GY-63_MS5611/libraries/Multiplex
2021-08-10 22:25:19 +02:00
..
.github/workflows add arduino-lint 2021-05-28 13:17:38 +02:00
examples 0.2.0 Multiplex 2021-08-10 22:25:19 +02:00
test 0.2.0 Multiplex 2021-08-10 22:25:19 +02:00
.arduino-ci.yml 2021-01-29 2021-01-29 12:31:58 +01:00
keywords.txt 2021-01-29 2021-01-29 12:31:58 +01:00
library.json 0.2.0 Multiplex 2021-08-10 22:25:19 +02:00
library.properties 0.2.0 Multiplex 2021-08-10 22:25:19 +02:00
LICENSE 2021-01-29 2021-01-29 12:31:58 +01:00
Multiplex.cpp 0.2.0 Multiplex 2021-08-10 22:25:19 +02:00
Multiplex.h 0.2.0 Multiplex 2021-08-10 22:25:19 +02:00
README.md 0.2.0 Multiplex 2021-08-10 22:25:19 +02:00

Arduino CI License: MIT GitHub release

Multiplex

Arduino Library implementing a stream multiplexer.

Description

Multiplex is a library in which one can add multiple Print streams.

If one prints to the multiplexer it is sent to all the streams that were added.

The maximum nr of streams to add is 4.

It is possible to disable individual streams.

Streams can be enabled or disabled by calling enable()/disable() passing either an index (based on the order in whicbh add was called; 0 is first) or a pointer to the Print object that was passed to add(Print *);

Interface

Constructor

  • Multiplex() constructor
  • void reset() resets to zero streams in the multiplexer.

Core

  • size_t write(uint8_t c) workhorse of the print interface.
  • bool add(Print * stream) add another print stream. Returns false if no space left.

Control

  • uint8_t count() returns # streams, MAX 4 in initial release
  • uint8_t size() returns size which is 4 in the current release.
  • void enable(uint8_t index) enable the stream at index.
  • void enableStream(Stream * stream) enable the stream.
  • void disable(uint8_t index) disable the stream at index.
  • void disableStream(Stream * stream) disable the stream.
  • bool isEnabled(uint8_t index) checks if the stream at index is enabled.
  • bool isEnabledStream(Stream * stream) checks if the stream is enabled.

Future

  • set size in constructor
  • add names?
  • bool inMp(stream)
  • add returns int index? or 0xFF for fail
  • remove a stream from the multiplex ??? => complexer admin.
  • increase up to 8 streams. (pack enabled flag in one byte)

Operation

See examples