fix: SWD_Sequence stuck in spi mode when req bits less than 8#61
Conversation
WalkthroughThe Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
projects/HSLink-Pro/src/SW_DP/SW_DP_SPI.c (3)
21-22: Drop stale logging macrosThe commented-out
LOG_TAGandelog.hlines are dead code and add noise during future merges. Either wrap them in a compile-time logging switch (e.g.#ifdef SWD_DEBUG_LOG) or remove them altogether.
117-117: Remove in-line commented trace
// log_d("SWD_Sequence …")is likewise inert. Delete or wrap it in the same conditional logging block suggested above to keep the function lean.
147-155: Nit: set data width before burst length for symmetryPure style, but calling
spi_set_data_bits()first makes the write path match the remainder-bit path and removes any future ambiguity about which setting is applied to the burst:- spi_set_write_data_count(SWD_SPI_BASE, integer_val); - spi_set_data_bits(SWD_SPI_BASE, 8); + spi_set_data_bits(SWD_SPI_BASE, 8); + spi_set_write_data_count(SWD_SPI_BASE, integer_val);No functional difference today, but helps readability and guards against potential driver argument-validation changes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
projects/HSLink-Pro/src/SW_DP/SW_DP_SPI.c(3 hunks)
🔇 Additional comments (1)
projects/HSLink-Pro/src/SW_DP/SW_DP_SPI.c (1)
120-133: Guard against integer-val == 0 looks good – double-check SWDIO idle levelThe new
if (integer_val)block elegantly avoids an unnecessary byte-wide transfer when fewer than 8 bits are requested – nice catch.One point to verify: after the integer-byte read completes, SWDIO stays in input mode (
gpio_write_pin(..., 0)only comes at the very end). Ensure this meets the electrical/timing spec for the whole function path (especially error branches).
|
@HalfSweet 看看? |
|
LGTM |
Summary by CodeRabbit
Bug Fixes
Refactor