Merge branch 'Isak_part1' of ssh://gitea.cs.ru.is:2222/helgie22/ESP_Project4_H26 into Isak_part1

This commit is contained in:
2026-10-15 12:18:35 +00:00
3 changed files with 31 additions and 2 deletions
+14
View File
@@ -125,6 +125,20 @@ void MotorDriver::set(double pwm)
}
// bool MotorDriver::fault_active()
// {
// //return !(PIND & (1 << PIND4));
// if (!initialized) {
// return true; // Fail safe if the driver did not initialize.
// }
// // The overlay marks FLT as active low. gpio_pin_get_dt() returns
// // the logical active state, so 1 means a fault is active.
// const int fault = gpio_pin_get_dt(&motor_flt);
// return fault < 0 || fault != 0;
// }
bool MotorDriver::fault_active()
{
if (!initialized) {
+8 -1
View File
@@ -3,6 +3,13 @@
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
//#define ISR_PROBE_NODE DT_PATH(zephyr_user)
static const struct gpio_dt_spec isr_probe =
GPIO_DT_SPEC_GET(DT_ALIAS(encoder_isr_probe), gpios);
RotaryEncoderDriver::RotaryEncoderDriver()
: count(0),
@@ -35,8 +42,8 @@ int RotaryEncoderDriver::begin()
timer.set_callback(timer_expired, this);
timer.init(SAMPLE_PERIOD_US);
reset_speed_measurement();
return 0;
}