/** * \file cimditrotary.cpp * \brief implementiton of the CimditRotary class * \author GrumpyDeveloper (Sascha Nitsch) * \copyright 2022 Sascha Nitsch * Licensed under MIT license * */ #include "Arduino.h" // own includes #include "cimditrotary.h" CimditRotary::CimditRotary() { m_a = false; m_delta = 0; } bool CimditRotary::update(bool a, bool b) { if (a == m_a) return false; // no change if (a && !m_a) { // rising bit a if (b) { ++m_delta; } else { --m_delta; } } m_a = a; return a; } int8_t CimditRotary::getDelta() { int8_t ret = m_delta; m_delta = 0; return ret; }