From f2bf989d846df94f96aa533b5992cf1a0ccc8cb4 Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Wed, 23 Nov 2022 15:19:55 +0100 Subject: [PATCH] 0.1.3 rotaryDecoder --- libraries/rotaryDecoder/.arduino-ci.yml | 26 ++++++++++++++++--- libraries/rotaryDecoder/CHANGELOG.md | 29 ++++++++++++++++++++++ libraries/rotaryDecoder/README.md | 9 ++++++- libraries/rotaryDecoder/library.json | 2 +- libraries/rotaryDecoder/library.properties | 2 +- libraries/rotaryDecoder/rotaryDecoder.cpp | 20 +++++++-------- libraries/rotaryDecoder/rotaryDecoder.h | 22 ++++++++-------- 7 files changed, 81 insertions(+), 29 deletions(-) create mode 100644 libraries/rotaryDecoder/CHANGELOG.md diff --git a/libraries/rotaryDecoder/.arduino-ci.yml b/libraries/rotaryDecoder/.arduino-ci.yml index 3e496624..1f989667 100644 --- a/libraries/rotaryDecoder/.arduino-ci.yml +++ b/libraries/rotaryDecoder/.arduino-ci.yml @@ -1,11 +1,29 @@ +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 + # selected only those that work platforms: - uno - - due - - zero - - leonardo + # - due + # - zero + # - leonardo - m4 - esp32 - esp8266 - - mega2560 + # - mega2560 + - rpipico + diff --git a/libraries/rotaryDecoder/CHANGELOG.md b/libraries/rotaryDecoder/CHANGELOG.md new file mode 100644 index 00000000..6e8d9d54 --- /dev/null +++ b/libraries/rotaryDecoder/CHANGELOG.md @@ -0,0 +1,29 @@ +# Change Log rotaryDecoder + +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.1.3] - 2022-11-23 +- add changelog.md +- add RP2040 to build-CI +- fix version number .cpp +- minor edits + + +## [0.1.2] - 2021-12-27 +- update library.json +- update readme.md +- update license +- minor edits + +## [0.1.1] - 2021-11-15 +- update build-CI, readme.md +- improve readability of code + +## [0.1.0] - 2021-05-08 +- initial version + + diff --git a/libraries/rotaryDecoder/README.md b/libraries/rotaryDecoder/README.md index b09e17cc..80616b88 100644 --- a/libraries/rotaryDecoder/README.md +++ b/libraries/rotaryDecoder/README.md @@ -95,7 +95,14 @@ See examples.. ## Future -- test with a high speed drill like a Dremel-tool. +#### must - update documentation - picture how to connect e.g 2 RE's which pins to used +#### should +- test with a high speed drill like a Dremel-tool. + +#### could +- invert flag to adjust to RE that give their pulse just the other way around? + - setInvert(bool); getInvert(); + - per channel / all? \ No newline at end of file diff --git a/libraries/rotaryDecoder/library.json b/libraries/rotaryDecoder/library.json index 60226541..1965089a 100644 --- a/libraries/rotaryDecoder/library.json +++ b/libraries/rotaryDecoder/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/rotaryDecoder.git" }, - "version": "0.1.2", + "version": "0.1.3", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/libraries/rotaryDecoder/library.properties b/libraries/rotaryDecoder/library.properties index a243456f..748240ab 100644 --- a/libraries/rotaryDecoder/library.properties +++ b/libraries/rotaryDecoder/library.properties @@ -1,5 +1,5 @@ name=rotaryDecoder -version=0.1.2 +version=0.1.3 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library to rotary decoder with a PCF8574 diff --git a/libraries/rotaryDecoder/rotaryDecoder.cpp b/libraries/rotaryDecoder/rotaryDecoder.cpp index 8f0fbcf1..65a2c5cb 100644 --- a/libraries/rotaryDecoder/rotaryDecoder.cpp +++ b/libraries/rotaryDecoder/rotaryDecoder.cpp @@ -1,16 +1,10 @@ // // FILE: rotaryDecoder.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.1.1 +// VERSION: 0.1.3 // DATE: 2021-05-08 // PURPOSE: rotary decoder library for Arduino // URL: https://github.com/RobTillaart/rotaryDecoder -// -// HISTORY: -// 0.1.0 2021-05-08 initial version -// 0.1.1 2021-11-15 update build-CI, readme.md -// improve readability of code -// 0.1.2 2021-12-27 update library.json, license, minor edits #include "rotaryDecoder.h" @@ -18,7 +12,7 @@ ///////////////////////////////////////////////////// // -// CONSTRUCTORS +// CONSTRUCTORS // rotaryDecoder::rotaryDecoder(const int8_t address, TwoWire *wire) { @@ -91,7 +85,7 @@ bool rotaryDecoder::update() uint8_t change = (_lastPos[i] << 2) | currentpos; switch (change) { - case 0b0001: // fall through.. + case 0b0001: // fall through.. case 0b0111: case 0b1110: case 0b1000: @@ -125,7 +119,7 @@ bool rotaryDecoder::updateSingle() uint8_t change = (_lastPos[i] << 2) | currentpos; switch (change) { - case 0b0001: // fall through.. + case 0b0001: // fall through.. case 0b0111: case 0b1110: case 0b1000: @@ -150,6 +144,10 @@ bool rotaryDecoder::updateSingle() } +///////////////////////////////////////////////////// +// +// PRIVATE +// uint8_t rotaryDecoder::_read8() { _wire->requestFrom(_address, (uint8_t)1); @@ -157,5 +155,5 @@ uint8_t rotaryDecoder::_read8() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/rotaryDecoder/rotaryDecoder.h b/libraries/rotaryDecoder/rotaryDecoder.h index 62a4527d..476e1453 100644 --- a/libraries/rotaryDecoder/rotaryDecoder.h +++ b/libraries/rotaryDecoder/rotaryDecoder.h @@ -2,7 +2,7 @@ // // FILE: rotaryDecoder.h // AUTHOR: Rob Tillaart -// VERSION: 0.1.2 +// VERSION: 0.1.3 // DATE: 2021-05-08 // PURPOSE: rotary decoder library for Arduino // URL: https://github.com/RobTillaart/rotaryDecoder @@ -11,7 +11,7 @@ #include "Arduino.h" #include "Wire.h" -#define ROTARY_DECODER_LIB_VERSION (F("0.1.2")) +#define ROTARY_DECODER_LIB_VERSION (F("0.1.3")) class rotaryDecoder @@ -28,20 +28,20 @@ public: void readInitialState(); - // for polling version, - // checkChange is bit faster than a call to update - // so useful if there are only a few updates + // for polling version, + // checkChange is bit faster than a call to update + // so useful if there are only a few updates bool checkChange(); - // read and update the counters - bool update(); // assumes two directions => +1 and -1 - bool updateSingle(); // assumes single direction => + ++ +++ + // read and update the counters + bool update(); // assumes two directions => +1 and -1 + bool updateSingle(); // assumes single direction => + ++ +++ - // re = rotary encoder + // re = rotary encoder int32_t getValue(uint8_t re) { return _encoder[re]; }; void setValue(uint8_t re, int32_t value = 0) { _encoder[re] = value; }; - // DEBUG + // DEBUG uint8_t getLastPosition(uint8_t re) { return _lastPos[re]; }; @@ -57,5 +57,5 @@ private: }; -// -- END OF FILE -- +// -- END OF FILE --