Rework radar system

This commit is contained in:
Ayzen
2026-10-06 12:32:26 +03:00
parent 552cdc688a
commit 5bb86b7165
299 changed files with 13537 additions and 27763 deletions
@@ -0,0 +1,50 @@
#pragma once
#include <cstdint>
#include <string>
#include "run_config.hpp"
namespace radar::drivers {
/**
* @brief Runtime settings for the H7992 GPIO switch driver.
*/
struct H7992MinimalDriverSettings {
std::string name{};
config::DriverMode mode = config::DriverMode::Native;
std::uint32_t positions = 4;
std::uint32_t default_position = 0;
std::string gpio_chip = "/dev/gpiochip0";
std::int32_t pin_a = 17;
std::int32_t pin_b = 27;
};
/**
* @brief Minimal H7992 implementation for fast position switching.
*
* Native mode uses Linux GPIO character-device API (uAPI v2).
* Mock mode keeps state in memory without touching hardware.
*/
class H7992MinimalDriver {
public:
explicit H7992MinimalDriver(H7992MinimalDriverSettings settings);
~H7992MinimalDriver(); // Leaves RF path safe even if close() was skipped.
void open();
void close();
void switch_to(std::uint32_t position);
private:
void open_native();
void close_native();
void switch_native(std::uint32_t position);
H7992MinimalDriverSettings settings_{};
bool is_open_ = false;
std::uint32_t current_position_ = 0;
int chip_fd_ = -1;
int line_fd_ = -1;
};
} // namespace radar::drivers