Serial Wombat Arduino Library
serialWombatPulseTimer.h
Go to the documentation of this file.
1 #pragma once
2 #include <stdint.h>
3 #include "SerialWombat.h"
4 
5 class SerialWombat;
6 
9 typedef enum
10 {
14 
53 {
54 public:
57  SerialWombatPulseTimer(SerialWombat& serialWombat);
58 
63  void begin(uint8_t pin);
64 
70  void begin(uint8_t pin, SerialWombatPulseTimerUnits units, bool pullUpEnabled);
71 
75  void refresh();
76 
82 
88 
92  uint16_t readHighCounts();
93 
94 
98  uint16_t readLowCounts();
99 
106  uint16_t readPulses();
107 
111  uint16_t HighCounts = 0;
115  uint16_t LowCounts = 0;
116 
120  uint16_t Pulses = 0;
122 
123 private:
124  SerialWombat& _sw;
125  uint8_t _pin = 255;
126 };
127 
128 
SerialWombatPulseTimer::readPulses
uint16_t readPulses()
Retreives the number of pulses.
Definition: serialWombatPulseTimer.cpp:65
SerialWombatPulseTimer::SerialWombatPulseTimer
SerialWombatPulseTimer(SerialWombat &serialWombat)
Class constructor for SerialWombatPulseTimer.
Definition: serialWombatPulseTimer.cpp:3
SerialWombatPulseTimer::HighCounts
uint16_t HighCounts
Count in selected units of last retreived high pulse.
Definition: serialWombatPulseTimer.h:111
SerialWombatPulseTimer::MeasurementOverflowOccurred
bool MeasurementOverflowOccurred
Definition: serialWombatPulseTimer.h:121
SW_PULSETIMER_uS
@ SW_PULSETIMER_uS
Definition: serialWombatPulseTimer.h:11
SerialWombatPulseTimer::begin
void begin(uint8_t pin)
Simple initialization.
Definition: serialWombatPulseTimer.cpp:9
SerialWombatPulseTimer::readLowCounts
uint16_t readLowCounts()
Retreives the most recent Counts in the configured units for the most recent low pulse.
Definition: serialWombatPulseTimer.cpp:59
SerialWombatPulseTimer::readHighCounts
uint16_t readHighCounts()
Retreives the most recent Counts in the configured units for the most recent high pulse.
Definition: serialWombatPulseTimer.cpp:53
SerialWombat.h
SerialWombatPulseTimer
A Class which uses a Serial Wombat pin to measure the length of a pulse high and low time.
Definition: serialWombatPulseTimer.h:52
SerialWombatPulseTimerUnits
SerialWombatPulseTimerUnits
Definition: serialWombatPulseTimer.h:9
SerialWombatPulseTimer::LowCounts
uint16_t LowCounts
Count in selected units of last retreived low pulse.
Definition: serialWombatPulseTimer.h:115
SerialWombatPulseTimer::refreshHighCountsPulses
void refreshHighCountsPulses()
Retreive the High counts and number of pulses Serial Wombat in a single transaction.
Definition: serialWombatPulseTimer.cpp:43
SerialWombatPulseTimer::refresh
void refresh()
Retreive the latest values for HighCounts, LowCounts, Pulses, and MeasurementOverflowOccured.
Definition: serialWombatPulseTimer.cpp:22
SerialWombat
Definition: SerialWombat.h:72
SerialWombatPulseTimer::refreshHighCountsLowCounts
void refreshHighCountsLowCounts()
Retreive the High and Low counts from the Serial Wombat in a single transaction.
Definition: serialWombatPulseTimer.cpp:34
SW_PULSETIMER_mS
@ SW_PULSETIMER_mS
Definition: serialWombatPulseTimer.h:12
SerialWombatPulseTimer::Pulses
uint16_t Pulses
Count of last retreived pulses.
Definition: serialWombatPulseTimer.h:120