GY-63_MS5611/libraries/HeartBeat/HeartBeat.h

45 lines
929 B
C
Raw Normal View History

2021-01-29 06:31:58 -05:00
#pragma once
//
// FILE: HeartBeat.h
// AUTHOR: Rob Tillaart
2021-05-28 07:30:27 -04:00
// VERSION: 0.1.3
2021-01-29 06:31:58 -05:00
// PURPOSE: Arduino library for HeartBeat with frequency and dutyCycle
// DATE: 2019-06-12
// URL: https://github.com/RobTillaart/HeartBeat
#include "Arduino.h"
2021-05-28 07:30:27 -04:00
#define HEARTBEAT_LIB_VERSION (F("0.1.3"))
2021-01-29 06:31:58 -05:00
class HeartBeat
{
public:
HeartBeat();
void begin(const uint8_t pin, float frequency = 1.0);
void setFrequency(float frequency = 1.0);
void setDutyCycle(float dutyCycle = 50);
inline void enable() { _running = true; };
inline void disable() { _running = false; };
void beat();
// OBSOLETE in next release
void set(float frequency = 1.0) { setFrequency(frequency); };
protected:
void _setFreqDuty();
float _frequency;
float _dutyCycle;
uint32_t _lastHeartBeat;
uint32_t _dutyCycleHigh;
uint32_t _dutyCycleLow;
bool _running;
uint8_t _pin;
};
2021-05-28 07:30:27 -04:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --