-
Notifications
You must be signed in to change notification settings - Fork 1.7k
FIX AT32 LED blink BUG #11228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
FIX AT32 LED blink BUG #11228
Conversation
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
PR Compliance Guide 🔍All compliance sections have been disabled in the configurations. |
| if (IO_GPIO(io)->odt & mask) { | ||
| IO_GPIO(io)->clr = mask; | ||
| } else { | ||
| IO_GPIO(io)->scr = mask; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Refactor the AT32F43x GPIO toggle logic to use the scr register for both setting and clearing pins in a single atomic write, which improves efficiency by removing the if/else branch. [general, importance: 6]
| if (IO_GPIO(io)->odt & mask) { | |
| IO_GPIO(io)->clr = mask; | |
| } else { | |
| IO_GPIO(io)->scr = mask; | |
| } | |
| #elif defined(AT32F43x) | |
| uint32_t toggleMask = mask; | |
| if (IO_GPIO(io)->odt & mask) { | |
| toggleMask <<= 16; | |
| } | |
| IO_GPIO(io)->scr = toggleMask; |
PR Type
Bug fix
Description
This description is generated by an AI tool. It may have inaccuracies
Fixed AT32F43x LED toggle logic using correct register operations
Replaced incorrect bit-shifting approach with proper
clrandscrregistersAdded missing braces for proper conditional statement structure
Diagram Walkthrough
File Walkthrough
io.c
Correct AT32F43x GPIO toggle register operationssrc/main/drivers/io.c
IOToggle()functionusing
clrandscrodtto match proper AT32 HAL usage