Heljarinnar breytingar til þess að laga nokkra hluti í part 1.
This commit is contained in:
+13
-4
@@ -4,19 +4,28 @@
|
||||
#include <stdint.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
|
||||
struct Digital_in {
|
||||
class Digital_in {
|
||||
public:
|
||||
enum : uint8_t {
|
||||
ENCODER_C1 = 0,
|
||||
ENCODER_C2 = 1
|
||||
};
|
||||
|
||||
const struct gpio_dt_spec *gpio;
|
||||
|
||||
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
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user