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
+10 -28
View File
@@ -3,8 +3,9 @@
#include <stdint.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
//#include "digital_in.h"
#include "digital_in.h"
#include "timer_usec.h"
class RotaryEncoderDriver {
@@ -25,6 +26,10 @@ public:
bool new_speed_available();
void reset_speed_measurement();
// Blocks until the next speed sample, or until the timeout expires.
// Lets the main loop run in step with the 4 ms sampling.
void wait_for_sample(k_timeout_t timeout);
private:
static const uint8_t HIST_LEN = 4; // 4 x Ts = 16 ms gluggi fyrir rpm-utreikning
@@ -35,12 +40,11 @@ private:
volatile int32_t history[HIST_LEN];
volatile uint8_t hist_idx;
//Digital_in eA;
//Digital_in eB;
Digital_in eA;
Digital_in eB;
struct gpio_callback encoder_c1_callback;
struct k_sem sample_sem;
Timer_usec timer;
static void gpio_edge_handler(
@@ -49,28 +53,6 @@ private:
uint32_t pins);
static void timer_expired(void *context);
// public:
// RotaryEncoderDriver();
// void begin();
// void update();
// int32_t position();
// void update_delta();
// float count_per_sec();
// float rpm();
// bool new_speed_available();
// void reset_speed_measurement();
};
#endif