Archive STM32 firmware to legacy/stm32/: - src/, include/, lib/USB_CDC/, platformio.ini, test stubs, flash_firmware.py - test/test_battery_adc.c, test_hw_button.c, test_pid_schedule.c, test_vesc_can.c, test_can_watchdog.c - USB_CDC_BUG.md Rename: stm32_protocol → esp32_protocol, mamba_protocol → balance_protocol, stm32_cmd_node → esp32_cmd_node, stm32_cmd_params → esp32_cmd_params, stm32_cmd.launch.py → esp32_cmd.launch.py, test_stm32_protocol → test_esp32_protocol, test_stm32_cmd_node → test_esp32_cmd_node Content cleanup across all files: - Mamba F722S → ESP32-S3 BALANCE - BlackPill → ESP32-S3 IO - STM32F722/F7xx → ESP32-S3 - stm32Mode/Version/Port → esp32Mode/Version/Port - STM32 State/Mode labels → ESP32 State/Mode - Jetson Nano → Jetson Orin Nano Super - /dev/stm32 → /dev/esp32 - stm32_bridge → esp32_bridge - STM32 HAL → ESP-IDF docs/SALTYLAB.md: - Update "Drone FC Details" to describe ESP32-S3 BALANCE board (Waveshare ESP32-S3 Touch LCD 1.28) - Replace verbose "Self-Balancing Control" STM32 section with brief note pointing to SAUL-TEE-SYSTEM-REFERENCE.md TEAM.md: Update Embedded Firmware Engineer role to ESP32-S3 / ESP-IDF No new functionality — cleanup only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
71 lines
2.1 KiB
C
71 lines
2.1 KiB
C
#include "esc_backend.h"
|
|
|
|
/*
|
|
* VESC ESC Backend Stub
|
|
*
|
|
* Placeholder implementation for FSESC 4.20 Plus (VESC-based dual ESC).
|
|
* UART: ttyTHS1 (Jetson Orin) → FC USART6 @ 921600 baud
|
|
* Protocol: pyvesc with CRC16-XModem checksum
|
|
*
|
|
* Issue #383: VESC integration (fills in this stub)
|
|
* Issue #388: ESC abstraction layer (provides this interface)
|
|
*
|
|
* TODO (Issue #383):
|
|
* - Implement vesc_init() with UART/GPIO config
|
|
* - Implement vesc_send() with pyvesc packet encoding (duty/RPM control)
|
|
* - Implement vesc_estop() to disable motor controller
|
|
* - Implement vesc_get_telemetry() to parse VESC state messages
|
|
* - Add balance mode configuration if using VESC balance app
|
|
*/
|
|
|
|
static const esc_backend_t vesc_backend;
|
|
|
|
/* Stub implementations — no-op until #383 fills them in */
|
|
|
|
static void vesc_backend_init(void) {
|
|
/* TODO (Issue #383): Initialize UART6, configure VESC balance mode */
|
|
}
|
|
|
|
static void vesc_backend_send(int16_t speed, int16_t steer) {
|
|
/* TODO (Issue #383): Encode speed/steer to pyvesc packet and send via UART6 */
|
|
(void)speed;
|
|
(void)steer;
|
|
}
|
|
|
|
static void vesc_backend_estop(void) {
|
|
/* TODO (Issue #383): Send VESC shutdown command to disable motors */
|
|
}
|
|
|
|
static void vesc_backend_resume(void) {
|
|
/* TODO (Issue #383): Resume from estop if needed */
|
|
}
|
|
|
|
static void vesc_backend_get_telemetry(esc_telemetry_t *out) {
|
|
/* TODO (Issue #383): Poll/parse VESC telemetry (voltage, current, RPM, temp, fault) */
|
|
if (out) {
|
|
out->speed = 0;
|
|
out->steer = 0;
|
|
out->voltage_mv = 0;
|
|
out->current_ma = 0;
|
|
out->temperature_c = 0;
|
|
out->fault = 0;
|
|
}
|
|
}
|
|
|
|
/* VESC backend vtable */
|
|
static const esc_backend_t vesc_backend = {
|
|
.init = vesc_backend_init,
|
|
.send = vesc_backend_send,
|
|
.estop = vesc_backend_estop,
|
|
.resume = vesc_backend_resume,
|
|
.get_telemetry = vesc_backend_get_telemetry,
|
|
};
|
|
|
|
/*
|
|
* Public function to register VESC backend.
|
|
* Called from main.c when configured with ESC_BACKEND=VESC.
|
|
*/
|
|
void vesc_backend_register_impl(void) {
|
|
esc_backend_register(&vesc_backend);
|
|
}
|