Heljarinnar breytingar til þess að laga nokkra hluti í part 1.

This commit is contained in:
2026-10-15 12:15:50 +00:00
parent 782feb2d04
commit 6d384265eb
32 changed files with 188 additions and 696 deletions
+13 -4
View File
@@ -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