diff --git a/util/edge_detector.hh b/util/edge_detector.hh index 141fd36..70a1253 100644 --- a/util/edge_detector.hh +++ b/util/edge_detector.hh @@ -38,3 +38,14 @@ struct EdgeStateDetector { last_state_ = false; } }; + +class RisingEdgeDetector { + bool last_state_ = false; + +public: + bool update(bool state) { + const auto out = state && last_state_ != state; + last_state_ = state; + return out; + } +};