mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.3.3 HeartBeat
This commit is contained in:
parent
c915bc56c7
commit
c69967e1f4
@ -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()
|
||||
|
@ -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 --
|
||||
|
||||
|
@ -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 --
|
||||
|
||||
|
@ -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,
|
||||
|
||||
|
@ -19,6 +19,7 @@ disable KEYWORD2
|
||||
beat KEYWORD2
|
||||
getState KEYWORD2
|
||||
|
||||
# Methods from derived class
|
||||
code KEYWORD2
|
||||
codeOff KEYWORD2
|
||||
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=HeartBeat
|
||||
version=0.3.2
|
||||
version=0.3.3
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
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=
|
||||
|
Loading…
Reference in New Issue
Block a user