#ifndef DIGITAL_IN_H #define DIGITAL_IN_H #include #include class Digital_in { public: enum : uint8_t { ENCODER_C1 = 0, ENCODER_C2 = 1 }; explicit Digital_in(uint8_t pin_id); void init(); bool is_hi(); bool is_lo(); // Calls handler on every rising edge of the pin. The caller owns the // gpio_callback struct so it can find its own object with CONTAINER_OF. // Returns 0 on success, or a negative Zephyr error code. int enable_rising_edge_interrupt( struct gpio_callback *callback, gpio_callback_handler_t handler); private: const struct gpio_dt_spec *gpio; }; #endif