Files
eink-api/AGENTS.md
2026-01-09 10:48:27 -05:00

1.6 KiB

Agent Guidelines for eink_api

These instructions apply to the entire repository.

Code Style

  • Follow existing Pico SDK patterns in eink_api.c; prefer straightforward, readable C without unnecessary abstractions.
  • Match the project logging approach (printf for user feedback) and keep messages concise and informative.
  • When modifying command handlers, mimic the else if chain style that ensures only one command executes per input.
  • Avoid adding inline comments unless they clarify non-obvious logic.

Command Handling

  • Use fixed-length comparisons (strncmp) with explicit delimiter checks so longer commands do not trigger shorter prefixes (e.g., guard draw_circle vs. draw_circle_fill).
  • Validate command arguments with sscanf, checking return counts before acting.
  • Ensure screen-state guards (screen_on, editor_mode) remain intact around command logic.

Display Operations

  • Use the Waveshare Paint_* helpers already in use; do not introduce alternative drawing backends without a strong reason.
  • Prefer existing constants (BLACK, WHITE, DOT_PIXEL_1X1, fill enums) for clarity and consistency.

Build & Tooling

  • Keep the CMake-based build flow unchanged (cmake -S . -B build / cmake --build build).
  • Scripts under scripts/ should remain POSIX shell compatible and should surface user-friendly errors tied to README guidance.

Documentation

  • Update the README table of commands whenever new commands are added or behaviors change.
  • Maintain alignment between serial command descriptions and their implementation details.