Files
radar_system/python_app/docs/hardware_layer.md
T
2026-03-05 14:42:33 +03:00

36 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Hardware layer
## 1. LibreVNA
- `hardware_full/librevna_service.py`: orchestration facade.
- `hardware_full/librevna_backends.py`:
- `NativeLibreVnaBackend`
- `MockLibreVnaBackend`
- `hardware_full/librevna_driver/*`: низкоуровневый USB/protocol stack.
### Native flow
1. `LibreVnaService.open()`
2. `configure(RadarSweepModel)`
3. `acquire_s21()`
4. `close()`
### Device limits
- `read_device_limits()` возвращает min/max frequency, IFBW, power и max points.
- GUI применяет лимиты для clamp/labels и live B-scan frequency bounds.
## 2. Switches
- `switch_service.py`: выбор mock/native драйвера по конфигурации.
- `switch_drivers/*`:
- `MockSwitchDriver`
- `H7992Driver`
- `HMC349ADriver`
- `gpio_uapi.py` (Linux GPIO v2 wrapper)
### Инварианты
- Позиции валидируются на уровне драйвера.
- Драйверы требуют `open()` перед `switch_to()`.
- Для native GPIO ошибки ОС конвертируются в Python `RuntimeError` с контекстом.
## 3. Расширение hardware слоя
- Новый радар: добавить backend с тем же контрактом, подключить в service.
- Новый switch: реализовать `SwitchDriverProtocol` и добавить ветку в `SwitchService._build_driver()`.