Skip to content

docs: layered architecture wiki#48

Draft
anpeaco wants to merge 2 commits into
masterfrom
docs/architecture-wiki
Draft

docs: layered architecture wiki#48
anpeaco wants to merge 2 commits into
masterfrom
docs/architecture-wiki

Conversation

@anpeaco
Copy link
Copy Markdown
Owner

@anpeaco anpeaco commented May 26, 2026

Summary

Adds a layered architecture wiki under docs/ — a from-scratch guide to how FreeJoyX works, written so a reader can stop at whatever depth they need.

Structure (17 files, ~1,400 lines):

  • Mental model01-what-is-freejoyx, 02-stm32-fundamentals
  • Build & runtime03-memory-and-boot (3-region flash + boot decision + warm jump), 04-runtime-model (setup sequence + superloop vs timer tick)
  • Subsystems05-axes (the full analog.c pipeline), 06-buttons (sources, debounce, logical types, LOGIC, gestures), 07-encoders, 08-usb-hid (descriptors, enumeration, report IDs, the two report structs)
  • Config & lifecycle09-configuration (dev_config_t, flash storage, R/W protocol), 10-wire-format-and-versioning (the & 0xFFF0 generation mask, the _Static_assert trip-wire, the legacy-migrator/archival rule, header-sync), 11-flashing-and-dfu (the chunked HID protocol + CRC + the Device gets stuck after flash, requires manual unplug to recover #36 clean-disconnect), 12-f103-vs-f411 (the BSP seam, StdPeriph vs HAL/LL), 13-repos-and-build
  • Deep dives — end-to-end traces of a button press and a config write, plus a glossary.md

Each layer links to the next and cites real files/functions so the docs are a map into the source, not a substitute for it. The deadband-on-inverted-axes work (PR #47) is used as a teaching case study in the axes layer.

Notes

  • Docs-only; no code changes. Kept on its own branch so PR Fix dynamic deadband failing on inverted axes #47 (the deadband fix) stays focused.
  • Accuracy is grounded in the current tree (analog.c, main.c, common_types.h). If prose and code ever diverge, the code wins — treat it as a docs bug.

Test plan

  • Skim docs/README.md and confirm the layering / reading path makes sense.
  • Spot-check a couple of code references resolve to the right files.

Generated by Claude Code

claude added 2 commits May 26, 2026 16:20
A multi-layer guide under docs/ explaining FreeJoyX from first principles
down to register-level detail: the mental model, STM32 fundamentals, flash
layout & boot, the runtime model, the input subsystems (axes/buttons/
encoders), USB/HID, the configuration model, wire-format versioning,
flashing/DFU, the F103-vs-F411 board seam, and repo/build/CI. Plus two
end-to-end deep-dive traces (button press, config write) and a glossary.

Grounded in the actual source (analog.c pipeline, main.c superloop,
common_types.h structs) with file references throughout.
New docs/state-machines.md collecting the state-machine pattern that recurs
across subsystems: the lookup-table quadrature encoder decoder, the logical
button family (NORMAL/TOGGLE/TAP/DOUBLE_TAP) over one debounced input, and the
USB-enumeration and DFU chunked-flash protocols. Grounded in encoders.c and
the logical_buttons_state_t / encoder_state_t structs. Linked from the index
and cross-referenced from the buttons and encoders layers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants