sl-firmware 291dd689f8 feat: remove all STM32/Mamba/BlackPill references — ESP32-S3 only
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>
2026-04-04 08:41:26 -04:00

117 lines
3.5 KiB
C
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.

/*
* face_lcd.h — STM32 LCD Display Driver for Face Animations
*
* Low-level abstraction for driving a small LCD/OLED display via SPI or I2C.
* Supports pixel/line drawing primitives and full framebuffer operations.
*
* HOW IT WORKS:
* - Initializes display (SPI/I2C, resolution, rotation)
* - Provides framebuffer (in RAM or on-device)
* - Exposes primitives: draw_pixel, draw_line, draw_circle, fill_rect
* - Implements vsync-driven 30Hz refresh from systick
* - Non-blocking DMA transfers for rapid display updates
*
* HARDWARE ASSUMPTIONS:
* - SPI2 or I2C (configurable via #define LCD_INTERFACE)
* - Typical sizes: 128×64, 240×135, 320×240
* - Pixel depth: 1-bit (monochrome) or 16-bit (RGB565)
* - Controller: SSD1306, ILI9341, ST7789, etc.
*
* API:
* - face_lcd_init(width, height, bpp) — Initialize display
* - face_lcd_clear() — Clear framebuffer
* - face_lcd_pixel(x, y, color) — Set pixel
* - face_lcd_line(x0, y0, x1, y1, color) — Draw line (Bresenham)
* - face_lcd_circle(cx, cy, r, color) — Draw circle
* - face_lcd_fill_rect(x, y, w, h, color) — Filled rectangle
* - face_lcd_flush() — Push framebuffer to display (async via DMA)
* - face_lcd_is_busy() — Check if transfer in progress
* - face_lcd_tick() — Called by systick ISR for 30Hz vsync
*/
#ifndef FACE_LCD_H
#define FACE_LCD_H
#include <stdint.h>
#include <stdbool.h>
/* === Configuration === */
#define LCD_INTERFACE SPI /* SPI or I2C */
#define LCD_WIDTH 128 /* pixels */
#define LCD_HEIGHT 64 /* pixels */
#define LCD_BPP 1 /* bits per pixel (1=mono, 16=RGB565) */
#define LCD_REFRESH_HZ 30 /* target refresh rate */
#if LCD_BPP == 1
typedef uint8_t lcd_color_t;
#define LCD_BLACK 0x00
#define LCD_WHITE 0x01
#define LCD_FBSIZE (LCD_WIDTH * LCD_HEIGHT / 8) /* 1024 bytes */
#else /* RGB565 */
typedef uint16_t lcd_color_t;
#define LCD_BLACK 0x0000
#define LCD_WHITE 0xFFFF
#define LCD_FBSIZE (LCD_WIDTH * LCD_HEIGHT * 2) /* 16384 bytes */
#endif
/* === Public API === */
/**
* Initialize LCD display and framebuffer.
* Called once at startup.
*/
void face_lcd_init(void);
/**
* Clear entire framebuffer to black.
*/
void face_lcd_clear(void);
/**
* Set a single pixel in the framebuffer.
* (Does NOT push to display immediately.)
*/
void face_lcd_pixel(uint16_t x, uint16_t y, lcd_color_t color);
/**
* Draw a line from (x0,y0) to (x1,y1) using Bresenham algorithm.
*/
void face_lcd_line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1,
lcd_color_t color);
/**
* Draw a circle with center (cx, cy) and radius r.
*/
void face_lcd_circle(uint16_t cx, uint16_t cy, uint16_t r, lcd_color_t color);
/**
* Fill a rectangle at (x, y) with width w and height h.
*/
void face_lcd_fill_rect(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
lcd_color_t color);
/**
* Push framebuffer to display (async via DMA if available).
* Returns immediately; transfer happens in background.
*/
void face_lcd_flush(void);
/**
* Check if a display transfer is currently in progress.
* Returns true if DMA/SPI is busy, false if idle.
*/
bool face_lcd_is_busy(void);
/**
* Called by systick ISR (~30Hz) to drive vsync and maintain refresh.
* Updates frame counter and triggers flush if a new frame is needed.
*/
void face_lcd_tick(void);
/**
* Get framebuffer address (for direct access if needed).
*/
uint8_t *face_lcd_get_fb(void);
#endif // FACE_LCD_H