11 namespace rotary_encoder {
70 this->store_.counter = value;
81 void setup()
override;
82 void dump_config()
override;
85 float get_setup_priority()
const override;
88 this->on_clockwise_callback_.add(std::move(callback));
92 this->on_anticlockwise_callback_.add(std::move(callback));
95 void register_listener(std::function<
void(uint32_t)> listener) { this->listeners_.add(std::move(listener)); }
117 void play(Ts...
x)
override { this->encoder_->set_value(this->value_.value(
x...)); }
RotaryEncoderResolution
All possible resolutions for the rotary encoder.
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
RotaryEncoderClockwiseTrigger(RotaryEncoderSensor *parent)
void register_listener(std::function< void(uint32_t)> listener)
RotaryEncoderSetValueAction(RotaryEncoderSensor *encoder)
increment counter by 2 with every A-B cycle
static void gpio_intr(RotaryEncoderSensorStore *arg)
RotaryEncoderRestoreMode
All possible restore modes for the rotary encoder.
std::array< int8_t, 8 > rotation_events
bool rotation_events_overflow
try to restore counter, otherwise set to zero
RotaryEncoderSensor * encoder_
TEMPLATABLE_VALUE(int, value) void play(Ts... x) override
RotaryEncoderResolution resolution
BedjetMode mode
BedJet operating mode.
void set_reset_pin(GPIOPin *pin_i)
void add_on_clockwise_callback(std::function< void()> callback)
increment counter by 1 with every A-B cycle, slow response but accurate
void set_pin_b(InternalGPIOPin *pin_b)
Implementation of SPI Controller mode.
bool publish_initial_value_
Index pin, if this is not nullptr, the counter will reset to 0 once this pin is HIGH.
void set_value(int value)
Manually set the value of the counter.
Base-class for all sensors.
void add_on_anticlockwise_callback(std::function< void()> callback)
void set_pin_a(InternalGPIOPin *pin_a)
void set_publish_initial_value(bool publish_initial_value)
RotaryEncoderAnticlockwiseTrigger(RotaryEncoderSensor *parent)