Skip to content

Stm32 fork#117

Draft
j-zhao wants to merge 10 commits intoJonnyHaystack:masterfrom
j-zhao:stm32-fork
Draft

Stm32 fork#117
j-zhao wants to merge 10 commits intoJonnyHaystack:masterfrom
j-zhao:stm32-fork

Conversation

@j-zhao
Copy link

@j-zhao j-zhao commented Mar 12, 2026

No description provided.

Jesse Zhao added 10 commits March 11, 2026 12:42
Adds STM32/maple HAL layer (XInput, GPIO, serial, keyboard mode) and
stm32pintester board configuration. App is linked at 0x08001000 with
VECT_TAB_ADDR relocated to support a 4KB custom bootloader at 0x08000000.
Implement reboot_bootloader() via RAM magic (0xDEADBEEFCC00FFEE) for
davidgfnet DFU bootloader. Fix RAM to 96KB with 8-byte reservation for
reboot flags. Add dfu-util upload command to env.ini.
- Rename config from stm32pintester to jz-stm32-leverless
- Rewrite button_mappings[] with 17 active pins verified via pintester
  (12 of 27 original pin assignments were wrong)
- Fix PC12 (A button) stuck/unresponsive: maple framework was using
  PC12 as USB disconnect pin. Override with -DBOARD_USB_DISC_DEV=NULL
- Add SOCD toggle combo (Start + Select + DPadUp cycles SOCD modes)
- Add ButtonMappings.md with full mapping table
- Set default mode to FGC (default_mode_config = 4)
Change the default vertical SOCD from SOCD_NEUTRAL to SOCD_DIR1_PRIORITY
(Up wins over Down). SOCD toggle combo now cycles only the vertical pair
(index 1), leaving horizontal always SOCD_NEUTRAL. The cycle now includes
DIR1_PRIORITY: DIR1 → NEUTRAL → 2IP → 2IP_NO_REAC → DIR1.
Add pre-clear pass before GPIO reads so multiple pins mapped to the
same BTN_* constant use OR semantics: any pressed pin sets the button
true; no unpressed pin can overwrite it false. Without this, the last
entry in button_mappings[] always wins, breaking secondary mappings.

UpdateButtonState now only sets true; false is handled by the pre-clear.
Same pattern applied to SwitchMatrixInput, DebouncedGpioButtonInput,
DebouncedSwitchMatrixInput, and Pca9671Input for consistency.
setManualReportMode(true) prevents safeSendReport() from firing a
blocking USB send on every button/axis setter call. Previously each of
the ~21 setters triggered a full sendData() with two USB wait cycles,
capping the effective loop rate at ~47Hz. With manual mode, setters
only update the in-memory report struct and a single send() at the end
of SendReport() does one USB transfer per frame (~1000Hz).

Also add patch_usb_polling.py pre-build script to set bInterval=1 in
the USBComposite usb_x360w.c endpoint descriptor, raising the USB host
polling rate from 250Hz (bInterval=4) to 1000Hz (bInterval=1).
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.

1 participant