mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.4 HeartBeat
This commit is contained in:
parent
f4b74b6d23
commit
a29a63ec8b
@ -6,12 +6,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.3.4] - 2024-09-09
|
||||
- Fix #12, add **bool codeCompleted()** to HeartBeatDiag and HeartBeatSL
|
||||
- update readme.md
|
||||
- update keywords.txt
|
||||
|
||||
## [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
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: HeartBeat.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.3.3
|
||||
// VERSION: 0.3.4
|
||||
// PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle
|
||||
// DATE: 2019-06-12
|
||||
// URL: https://github.com/RobTillaart/HeartBeat
|
||||
@ -184,6 +184,13 @@ void HeartBeatDiag::codeOff()
|
||||
}
|
||||
|
||||
|
||||
bool HeartBeatDiag::codeCompleted()
|
||||
{
|
||||
if (_codeMask > 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HEARTBEATSL
|
||||
@ -271,5 +278,12 @@ void HeartBeatSL::codeOff()
|
||||
}
|
||||
|
||||
|
||||
bool HeartBeatSL::codeCompleted()
|
||||
{
|
||||
if (_codeMask > 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: HeartBeat.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.3.3
|
||||
// VERSION: 0.3.4
|
||||
// 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.3"))
|
||||
#define HEARTBEAT_LIB_VERSION (F("0.3.4"))
|
||||
|
||||
|
||||
class HeartBeat
|
||||
@ -72,7 +72,7 @@ public:
|
||||
// of the error or diagnostic code
|
||||
bool code(uint32_t pattern); // executes ONE time
|
||||
void codeOff(); // explicit stop.
|
||||
|
||||
bool codeCompleted(); // pattern has been executed.
|
||||
|
||||
protected:
|
||||
uint32_t _code = 0; // up to 9 digits
|
||||
@ -101,7 +101,7 @@ public:
|
||||
// L is a pulse of 3 units, S is a pulse of 1 unit.
|
||||
bool code(const char * str); // executes ONE time
|
||||
void codeOff(); // explicit stop.
|
||||
|
||||
bool codeCompleted(); // pattern has been executed.
|
||||
|
||||
protected:
|
||||
uint8_t _code = 0; // up to 7 bits
|
||||
|
@ -78,6 +78,11 @@ HeartBeatDiag uses more RAM and PROGMEM than HeartBeatSL.
|
||||
For more complex patterns, please check my pulsePattern library.
|
||||
|
||||
|
||||
### Related
|
||||
|
||||
- https://github.com/RobTillaart/pulsePattern
|
||||
|
||||
|
||||
## Interface
|
||||
|
||||
```cpp
|
||||
@ -123,8 +128,9 @@ The interface of **HeartBeatSL** adds of the following functions to **HeartBeat*
|
||||
- **HeartBeatSL()** constructor.
|
||||
- **bool code(const char \* str)** executes the pattern ONE time.
|
||||
Repeating the pattern means repeating the call.
|
||||
The max supported string length is **7**.
|
||||
The max supported string length is **7** as pattern is stored in a byte.
|
||||
- **void codeOff()** explicitly stops the pattern. Forced stop.
|
||||
- **bool codeCompleted()** returns true if pattern is executed completely.
|
||||
|
||||
|
||||
Minimal example
|
||||
@ -171,6 +177,7 @@ The interface of **HeartBeatDiag** adds of the following functions:
|
||||
Repeating the pattern means repeating the call.
|
||||
The max supported pattern length is **9**.
|
||||
- **void codeOff()** explicitly stops the pattern. Forced stop.
|
||||
- **bool codeCompleted()** returns true if pattern is executed completely.
|
||||
|
||||
|
||||
Minimal example
|
||||
@ -242,6 +249,8 @@ See examples
|
||||
|
||||
- investigate a pattern recognizer (fun)
|
||||
- e.g. with an LDR or lux sensor.
|
||||
- HeartBeatSL
|
||||
- extend code length to 16 (bit)?
|
||||
|
||||
#### Wont
|
||||
|
||||
|
@ -39,6 +39,8 @@ void loop()
|
||||
if (millis() > 3000) HB.code(1369631);
|
||||
if (millis() > 20000) HB.codeOff();
|
||||
if (millis() > 30000) HB.enable();
|
||||
Serial.println(HB.codeCompleted());
|
||||
delay(200);
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ getState KEYWORD2
|
||||
# Methods from derived class
|
||||
code KEYWORD2
|
||||
codeOff KEYWORD2
|
||||
|
||||
codeCompleted KEYWORD2
|
||||
|
||||
# Constants (LITERAL1)
|
||||
HEARTBEAT_LIB_VERSION LITERAL1
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/HeartBeat.git"
|
||||
},
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=HeartBeat
|
||||
version=0.3.3
|
||||
version=0.3.4
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for HeartBeat with frequency and duty cycle.
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
unittest_setup()
|
||||
{
|
||||
fprintf(stderr, "VERSION: %s\n", (char *) HEARTBEAT_LIB_VERSION );
|
||||
fprintf(stderr, "HEARTBEAT_LIB_VERSION: %s\n", (char *) HEARTBEAT_LIB_VERSION );
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +105,28 @@ unittest(test_dutycycle)
|
||||
}
|
||||
|
||||
|
||||
unittest(test_HBDIAG)
|
||||
{
|
||||
HeartBeatDiag HBD;
|
||||
HBD.begin(13, 1);
|
||||
|
||||
// verify default value
|
||||
assertTrue(HBD.codeCompleted());
|
||||
}
|
||||
|
||||
|
||||
unittest(test_HBSL)
|
||||
{
|
||||
HeartBeatSL HBD;
|
||||
HBD.begin(13, 1);
|
||||
|
||||
// verify default value
|
||||
assertTrue(HBD.codeCompleted());
|
||||
}
|
||||
|
||||
|
||||
unittest_main()
|
||||
|
||||
// --------
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user