Silence unused-variable warning (#2872)
[ExpressLRS.git] / src / lib / PFD / PFD.h
blob2affa1adf1b46f7a7279afd9afc9d8bffe819c73
1 #pragma once
2 #include <Arduino.h>
3 #include <stdio.h>
4 #include "../../src/include/targets.h"
6 class PFD
8 private:
9 uint32_t intEventTime = 0;
10 uint32_t extEventTime = 0;
11 bool gotExtEvent;
12 bool gotIntEvent;
14 public:
15 inline void extEvent(uint32_t time) // reference (external osc)
17 extEventTime = time;
18 gotExtEvent = true;
21 inline void intEvent(uint32_t time) // internal osc event
23 intEventTime = time;
24 gotIntEvent = true;
27 inline void reset()
29 gotExtEvent = false;
30 gotIntEvent = false;
33 int32_t calcResult() const
35 // Assumes caller has verified hasResult()
36 return (int32_t)(extEventTime - intEventTime);
39 bool hasResult() const
41 return gotExtEvent && gotIntEvent;
44 volatile uint32_t getIntEventTime() const { return intEventTime; }
45 volatile uint32_t getExtEventTime() const { return extEventTime; }