diff --git a/libraries/FastShiftOut/.github/workflows/arduino-lint.yml b/libraries/FastShiftOut/.github/workflows/arduino-lint.yml index b2ca058c..8a26f14a 100644 --- a/libraries/FastShiftOut/.github/workflows/arduino-lint.yml +++ b/libraries/FastShiftOut/.github/workflows/arduino-lint.yml @@ -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 diff --git a/libraries/FastShiftOut/.github/workflows/arduino_test_runner.yml b/libraries/FastShiftOut/.github/workflows/arduino_test_runner.yml index 096b975b..fadfa904 100644 --- a/libraries/FastShiftOut/.github/workflows/arduino_test_runner.yml +++ b/libraries/FastShiftOut/.github/workflows/arduino_test_runner.yml @@ -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 diff --git a/libraries/FastShiftOut/.github/workflows/jsoncheck.yml b/libraries/FastShiftOut/.github/workflows/jsoncheck.yml index 04603d08..37a11298 100644 --- a/libraries/FastShiftOut/.github/workflows/jsoncheck.yml +++ b/libraries/FastShiftOut/.github/workflows/jsoncheck.yml @@ -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: diff --git a/libraries/FastShiftOut/CHANGELOG.md b/libraries/FastShiftOut/CHANGELOG.md index ac74973f..fe6973b7 100644 --- a/libraries/FastShiftOut/CHANGELOG.md +++ b/libraries/FastShiftOut/CHANGELOG.md @@ -6,16 +6,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.1] - 2023-02-20 +- update readme.md +- update GitHub actions +- update license 2023 +- minor edits + + ## [0.3.0] - 2022-11-05 - major refactor +---- ## [0.2.5] - 2022-11-05 - add changelog.md - add rp2040 to build-CI - update readme.md - ## [0.2.4] - 2021-12-17 - license diff --git a/libraries/FastShiftOut/Examples/FastShiftOut_demo/performance_0.3.1.txt b/libraries/FastShiftOut/Examples/FastShiftOut_demo/performance_0.3.1.txt new file mode 100644 index 00000000..0eb25827 --- /dev/null +++ b/libraries/FastShiftOut/Examples/FastShiftOut_demo/performance_0.3.1.txt @@ -0,0 +1,30 @@ +IDE: 1.8.19 +Board: UNO + +example fastShiftOut: 0.3.1 + +Performance - time in us + write: 23.41 + write: 45.89 + Delta: 22.48 + +writeLSBFIRST: 22.51 +writeLSBFIRST: 45.88 + Delta: 23.37 + +writeMSBFIRST: 23.02 +writeMSBFIRST: 44.88 + Delta: 21.86 + +Standard shiftOut1: 89.85 +Standard shiftOut2: 179.59 + Delta: 89.74 + + +Test print interface +println("Hello world"): 328.92 +println(1357): 313.56 +println(3.14159265, 4): 717.36 + +done ... + diff --git a/libraries/FastShiftOut/FastShiftOut.cpp b/libraries/FastShiftOut/FastShiftOut.cpp index 1d2698aa..3ef80102 100644 --- a/libraries/FastShiftOut/FastShiftOut.cpp +++ b/libraries/FastShiftOut/FastShiftOut.cpp @@ -1,12 +1,10 @@ // // FILE: FastShiftOut.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.2.5 +// VERSION: 0.3.1 // PURPOSE: ShiftOut that implements the Print interface // DATE: 2013-08-22 // URL: https://github.com/RobTillaart/FastShiftOut -// -// HISTORY: see changelog.md #include "FastShiftOut.h" @@ -33,7 +31,7 @@ FastShiftOut::FastShiftOut(uint8_t dataOut, uint8_t clockPin, uint8_t bitOrder) #else // reference implementation _dataPinOut = dataOut; - _clockPin = clockPin; + _clockPin = clockPin; #endif } @@ -41,7 +39,6 @@ FastShiftOut::FastShiftOut(uint8_t dataOut, uint8_t clockPin, uint8_t bitOrder) size_t FastShiftOut::write(uint8_t data) { - _value = data; if (_bitOrder == LSBFIRST) { return writeLSBFIRST(data); @@ -50,11 +47,35 @@ size_t FastShiftOut::write(uint8_t data) } +/* experimental +size_t write(const uint8_t \*buffer, size_t size) +{ + size_t n = 0; + if (_bitOrder == LSBFIRST) + { + for (size_t i = size; i > 0; ) // from end to begin ???? + { + i--; + n += writeLSBFIRST(buffer[i]); + } + } + else + { + for (size_t i = 0; i < size; i++) // from begin to end.. + { + n += writeMSBFIRST(buffer[i]); + } + } + return n; +} +*/ + + size_t FastShiftOut::writeLSBFIRST(uint8_t data) { uint8_t value = data; - _value = value; - + _lastValue = value; + #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) uint8_t cbmask1 = _clockBit; @@ -86,8 +107,8 @@ size_t FastShiftOut::writeLSBFIRST(uint8_t data) size_t FastShiftOut::writeMSBFIRST(uint8_t data) { uint8_t value = data; - _value = value; - + _lastValue = value; + #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) uint8_t cbmask1 = _clockBit; @@ -113,14 +134,13 @@ size_t FastShiftOut::writeMSBFIRST(uint8_t data) #endif return 1; - } uint8_t FastShiftOut::lastWritten(void) { - return _value; -}; + return _lastValue; +} bool FastShiftOut::setBitOrder(const uint8_t bitOrder) @@ -137,8 +157,8 @@ bool FastShiftOut::setBitOrder(const uint8_t bitOrder) uint8_t FastShiftOut::getBitOrder(void) { return _bitOrder; -}; +} -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/FastShiftOut/FastShiftOut.h b/libraries/FastShiftOut/FastShiftOut.h index 5fbc70e5..226ed683 100644 --- a/libraries/FastShiftOut/FastShiftOut.h +++ b/libraries/FastShiftOut/FastShiftOut.h @@ -2,7 +2,7 @@ // // FILE: FastShiftOut.h // AUTHOR: Rob Tillaart -// VERSION: 0.3.0 +// VERSION: 0.3.1 // PURPOSE: shiftOut class that implements the Print interface // DATE: 2013-08-22 // URL: https://github.com/RobTillaart/FastShiftOut @@ -11,7 +11,7 @@ #include "Arduino.h" #include "Print.h" -#define FASTSHIFTOUT_LIB_VERSION (F("0.3.0")) +#define FASTSHIFTOUT_LIB_VERSION (F("0.3.1")) class FastShiftOut : public Print @@ -21,6 +21,8 @@ public: FastShiftOut(uint8_t dataOut, uint8_t clockPin, uint8_t bitOrder = LSBFIRST); size_t write(uint8_t data); + // experimental + // size_t write(const uint8_t \*buffer, size_t size); uint8_t lastWritten(void); bool setBitOrder(uint8_t bitOrder); @@ -32,7 +34,7 @@ public: private: uint8_t _bitOrder; - int _value; + int _lastValue; #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) diff --git a/libraries/FastShiftOut/LICENSE b/libraries/FastShiftOut/LICENSE index c9bd779a..d77cf66c 100644 --- a/libraries/FastShiftOut/LICENSE +++ b/libraries/FastShiftOut/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2013-2022 Rob Tillaart +Copyright (c) 2013-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 diff --git a/libraries/FastShiftOut/README.md b/libraries/FastShiftOut/README.md index d2d21e1f..4dd4c022 100644 --- a/libraries/FastShiftOut/README.md +++ b/libraries/FastShiftOut/README.md @@ -35,20 +35,28 @@ The performance of **write()** is substantially faster than the default Arduino Exact how big the performance gain is can be seen with the example sketch. It does a comparison and shows how the class is to be used. -test 0.2.4 Arduino UNO +Time in microseconds, Arduino UNO -| function | time (us) | -|:----------------------|----------:| -| write() | 21.66 | -| writeLSBFIRST() | 22.94 | -| writeMSBFIRST() | 20.30 | -| reference shiftOut() | 89.74 | +| function | 0.2.4 | 0.3.1 | +|:-------------------------|--------:|---------:| +| write() | 21.66 | 22.48 | +| writeLSBFIRST() | 22.94 | 23.37 | +| writeMSBFIRST() | 20.30 | 21.86 | +| reference shiftOut() | 89.74 | 89.74 | +| println("Hello world") | | 328.92 | +| println(1357) | | 313.56 | +| println(3.14159265, 4) | | 717.36 | ## Interface -The interface exists of the following functions: +```cpp +#include "FastShiftOut.h" +``` +#### Functions + +- **FastShiftOut(uint8_t dataOut, uint8_t clockPin, uint8_t bitOrder = LSBFIRST)** Constructor. - **size_t write(const uint8_t data)** send a byte, also the workhorse of the **Print** interface. - **uint8_t lastWritten()** returns last byte written. - **bool setBitOrder(uint8_t bitOrder)** set LSBFIRST or MSBFIRST. Returns false for other values. @@ -56,7 +64,9 @@ The interface exists of the following functions: - **size_t writeLSBFIRST(const uint8_t data);** most optimized. - **size_t writeMSBFIRST(const uint8_t data);** most optimized. + As a FastShiftOut object implements the Print interface, one can also call + - **FSO.print(any type);** or - **FSO.println(any type);** @@ -72,15 +82,21 @@ Note: **FSO.print()** returns the number of characters printed, including an opt pull up resistors, especially if wires are exceeding 10 cm (4"). -## Operation - -See examples - - ## Future + +#### Must + +#### Should + +- extend unit tests + +#### Could + - performance ESP32 - check optimized ESP32 - add **size_t write(const uint8_t \*buffer, size_t size)** - example schema +#### Wont + diff --git a/libraries/FastShiftOut/keywords.txt b/libraries/FastShiftOut/keywords.txt index adf43830..f77937af 100644 --- a/libraries/FastShiftOut/keywords.txt +++ b/libraries/FastShiftOut/keywords.txt @@ -6,9 +6,12 @@ FastShiftOut KEYWORD1 # Methods and Functions (KEYWORD2) write KEYWORD2 + lastWritten KEYWORD2 + setBitOrder KEYWORD2 getBitOrder KEYWORD2 + writeLSBFIRST KEYWORD2 writeMSBFIRST KEYWORD2 diff --git a/libraries/FastShiftOut/library.json b/libraries/FastShiftOut/library.json index a397af04..7423a888 100644 --- a/libraries/FastShiftOut/library.json +++ b/libraries/FastShiftOut/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/FastShiftOut.git" }, - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/libraries/FastShiftOut/library.properties b/libraries/FastShiftOut/library.properties index 3052aec7..3ccd7bdd 100644 --- a/libraries/FastShiftOut/library.properties +++ b/libraries/FastShiftOut/library.properties @@ -1,5 +1,5 @@ name=FastShiftOut -version=0.3.0 +version=0.3.1 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for (AVR) optimized shiftOut - e.g. 74HC595 diff --git a/libraries/FastShiftOut/test/unit_test_001.cpp b/libraries/FastShiftOut/test/unit_test_001.cpp index dd14c5b0..09214ed0 100644 --- a/libraries/FastShiftOut/test/unit_test_001.cpp +++ b/libraries/FastShiftOut/test/unit_test_001.cpp @@ -3,7 +3,7 @@ // AUTHOR: Rob Tillaart // DATE: 2020-12-03 // PURPOSE: unit tests for the FastShiftIn library -// https://github.com/RobTillaart/FastShiftIn +// https://github.com/RobTillaart/FastShiftOut // https://github.com/Arduino-CI/arduino_ci/blob/master/REFERENCE.md // @@ -94,4 +94,6 @@ unittest(test_print) unittest_main() -// -------- + +// -- END OF FILE -- +