#ifndef ENCODER_H #define ENCODER_H #include class Encoder{ public: /** * @brief Construct a new Encoder object with the given pins * * @param pinSW encoder switch pin * @param pinDT encoder DT pin * @param pinCLK encoder CLK pin */ Encoder(int pinSW, int pinDT, int pinCLK); /** * @brief returns the instance of the encoder */ static Encoder* getInstance(); private: /** * @brief pinSW is the pin number of the switch */ int pinSW; /** * @brief pinDT is the pin number of the DT pin */ int pinDT; /** * @brief pinCLK is the pin number of the CLK pin */ int pinCLK; /** * @brief swEvent is the event called when the switch is pressed */ IRAM_ATTR static void swEvent(); /** * @brief dtEvent is the event called when the encoder is turned */ IRAM_ATTR static void dtEvent(); /** * @brief number is the current number of the encoder */ int number; /** * @brief instance is the instance of the encoder */ static Encoder* instance; }; #endif