From c69967e1f49e8a9b015b70b85ddd02224e9a753d Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Thu, 2 Nov 2023 16:06:11 +0100 Subject: [PATCH] 0.3.3 HeartBeat --- libraries/HeartBeat/CHANGELOG.md | 7 +++- libraries/HeartBeat/HeartBeat.cpp | 44 ++++++++++++-------------- libraries/HeartBeat/HeartBeat.h | 10 +++--- libraries/HeartBeat/README.md | 23 ++++++++++++-- libraries/HeartBeat/keywords.txt | 1 + libraries/HeartBeat/library.json | 4 +-- libraries/HeartBeat/library.properties | 4 +-- 7 files changed, 57 insertions(+), 36 deletions(-) diff --git a/libraries/HeartBeat/CHANGELOG.md b/libraries/HeartBeat/CHANGELOG.md index 2b083764..4b5f5083 100644 --- a/libraries/HeartBeat/CHANGELOG.md +++ b/libraries/HeartBeat/CHANGELOG.md @@ -6,12 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.3] - 2022-11-09 +- update readme.md +- fix version in .cpp +- update keywords.txt + + ## [0.3.2] - 2022-11-09 - add changelog.md - add rp2040 to build-CI - update readme.md - ## [0.3.1] - 2022-07-26 - move all code to .cpp - add isEnabled() diff --git a/libraries/HeartBeat/HeartBeat.cpp b/libraries/HeartBeat/HeartBeat.cpp index c6f7de5e..af4e8106 100644 --- a/libraries/HeartBeat/HeartBeat.cpp +++ b/libraries/HeartBeat/HeartBeat.cpp @@ -1,12 +1,10 @@ // // FILE: HeartBeat.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.3.1 +// VERSION: 0.3.3 // PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle // DATE: 2019-06-12 // URL: https://github.com/RobTillaart/HeartBeat -// -// HISTORY: see changelog #include "HeartBeat.h" @@ -57,19 +55,19 @@ float HeartBeat::getDutyCycle() }; -void HeartBeat::enable() -{ - _running = true; +void HeartBeat::enable() +{ + _running = true; }; -void HeartBeat::disable() -{ - _running = false; +void HeartBeat::disable() +{ + _running = false; }; -bool HeartBeat::isEnabled() +bool HeartBeat::isEnabled() { return _running; }; @@ -95,7 +93,7 @@ void HeartBeat::beat() uint8_t HeartBeat::getState() { - return _state; + return _state; }; @@ -113,7 +111,7 @@ void HeartBeat::_setFreqDuty() ///////////////////////////////////////////////////////////////////////////// // -// HEARTBEATDIAG +// HEARTBEATDIAG // HeartBeatDiag::HeartBeatDiag():HeartBeat() { @@ -122,7 +120,7 @@ HeartBeatDiag::HeartBeatDiag():HeartBeat() void HeartBeatDiag::beat() { - // normal mode + // normal mode if (_codeMask == 0) { _codeStart = 0; @@ -139,7 +137,7 @@ void HeartBeatDiag::beat() } else { - uint32_t period = (_dutyCycleLow + _dutyCycleHigh)/2; + uint32_t period = (_dutyCycleLow + _dutyCycleHigh) / 2; uint32_t now = micros(); if ((now - _lastHeartBeat) < period) return; _lastHeartBeat = now; @@ -169,7 +167,7 @@ void HeartBeatDiag::beat() bool HeartBeatDiag::code(uint32_t pattern) { - // already running an errorCode? + // already running an errorCode? if (_code > 0) return false; // pattern too long if (pattern > 999999999) return false; @@ -188,9 +186,9 @@ void HeartBeatDiag::codeOff() ///////////////////////////////////////////////////////////////////////////// // -// HEARTBEATSL +// HEARTBEATSL // -// string LS version is simpler and somewhat smaller footprint, +// string LS version is simpler and somewhat smaller footprint, // #define HEARTBEATSL_SHORT 1 @@ -204,7 +202,7 @@ HeartBeatSL::HeartBeatSL():HeartBeat() void HeartBeatSL::beat() { - // normal mode + // normal mode if (_codeMask == 0) { _codeStart = 0; @@ -221,14 +219,14 @@ void HeartBeatSL::beat() } else { - uint32_t period = (_dutyCycleLow + _dutyCycleHigh)/2; + uint32_t period = (_dutyCycleLow + _dutyCycleHigh) / 2; uint32_t now = micros(); if ((now - _lastHeartBeat) < period) return; _lastHeartBeat = now; if (_state == LOW) { _pulseLength = HEARTBEATSL_SHORT; - if (_code & _codeMask) // 1 ==> LONG + if (_code & _codeMask) // 1 ==> LONG { _pulseLength = HEARTBEATSL_LONG; } @@ -250,9 +248,9 @@ void HeartBeatSL::beat() bool HeartBeatSL::code(const char * str) { - // already running an errorCode? + // already running an errorCode? if (_codeMask > 0) return false; - // pattern too long + // pattern too long uint8_t len = strlen(str); if (len > 7) return false; @@ -273,5 +271,5 @@ void HeartBeatSL::codeOff() } -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/HeartBeat/HeartBeat.h b/libraries/HeartBeat/HeartBeat.h index 6ef6c96c..df88600b 100644 --- a/libraries/HeartBeat/HeartBeat.h +++ b/libraries/HeartBeat/HeartBeat.h @@ -2,7 +2,7 @@ // // FILE: HeartBeat.h // AUTHOR: Rob Tillaart -// VERSION: 0.3.2 +// VERSION: 0.3.3 // PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle // DATE: 2019-06-12 // URL: https://github.com/RobTillaart/HeartBeat @@ -10,7 +10,7 @@ #include "Arduino.h" -#define HEARTBEAT_LIB_VERSION (F("0.3.2")) +#define HEARTBEAT_LIB_VERSION (F("0.3.3")) class HeartBeat @@ -56,7 +56,7 @@ protected: ///////////////////////////////////////////////////////////////////////////// // -// HEARTBEATDIAG +// HEARTBEATDIAG // class HeartBeatDiag : public HeartBeat { @@ -85,7 +85,7 @@ protected: ///////////////////////////////////////////////////////////////////////////// // -// HEARTBEATSL (simpler, has a smaller footprint as HeartBeatDiag +// HEARTBEATSL (simpler, has a smaller footprint as HeartBeatDiag // class HeartBeatSL : public HeartBeat { @@ -111,5 +111,5 @@ protected: }; -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/HeartBeat/README.md b/libraries/HeartBeat/README.md index 683cd772..5d626cae 100644 --- a/libraries/HeartBeat/README.md +++ b/libraries/HeartBeat/README.md @@ -2,8 +2,11 @@ [![Arduino CI](https://github.com/RobTillaart/HeartBeat/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) [![Arduino-lint](https://github.com/RobTillaart/HeartBeat/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/HeartBeat/actions/workflows/arduino-lint.yml) [![JSON check](https://github.com/RobTillaart/HeartBeat/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/HeartBeat/actions/workflows/jsoncheck.yml) +[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/HeartBeat.svg)](https://github.com/RobTillaart/HeartBeat/issues) + [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/HeartBeat/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/RobTillaart/HeartBeat.svg?maxAge=3600)](https://github.com/RobTillaart/HeartBeat/releases) +[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/HeartBeat.svg)](https://registry.platformio.org/libraries/robtillaart/HeartBeat) # HeartBeat @@ -225,15 +228,29 @@ See examples ## Future -#### must +#### Must + - test HeartBeatDiag version in more detail. -#### should +#### Should + - add examples - ACS712 current sensor - buffer % filled (e.g. stream) -#### could +#### Could + - investigate a pattern recognizer (fun) - e.g. with an LDR or lux sensor. +#### Wont + + +## Support + +If you appreciate my libraries, you can support the development and maintenance. +Improve the quality of the libraries by providing issues and Pull Requests, or +donate through PayPal or GitHub sponsors. + +Thank you, + diff --git a/libraries/HeartBeat/keywords.txt b/libraries/HeartBeat/keywords.txt index 963f55a8..33b84899 100644 --- a/libraries/HeartBeat/keywords.txt +++ b/libraries/HeartBeat/keywords.txt @@ -19,6 +19,7 @@ disable KEYWORD2 beat KEYWORD2 getState KEYWORD2 +# Methods from derived class code KEYWORD2 codeOff KEYWORD2 diff --git a/libraries/HeartBeat/library.json b/libraries/HeartBeat/library.json index 891bef4f..ab3e61f3 100644 --- a/libraries/HeartBeat/library.json +++ b/libraries/HeartBeat/library.json @@ -15,9 +15,9 @@ "type": "git", "url": "https://github.com/RobTillaart/HeartBeat.git" }, - "version": "0.3.2", + "version": "0.3.3", "license": "MIT", - "frameworks": "arduino", + "frameworks": "*", "platforms": "*", "headers": "HeartBeat.h" } diff --git a/libraries/HeartBeat/library.properties b/libraries/HeartBeat/library.properties index 299a92b8..4f6219d6 100644 --- a/libraries/HeartBeat/library.properties +++ b/libraries/HeartBeat/library.properties @@ -1,5 +1,5 @@ name=HeartBeat -version=0.3.2 +version=0.3.3 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for HeartBeat with frequency and duty cycle. @@ -7,5 +7,5 @@ paragraph=blinking led by frequent polling. category=Other url=https://github.com/RobTillaart/HeartBeat architectures=* -includes=HeartBeat.h +includes=HeartBeat.h depends=