-
Notifications
You must be signed in to change notification settings - Fork 503
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
Opt-in PWM conflict avoidance #496
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
2981565
Remove dead code
henrygab b4d777f
Expose API for count of used/free channels
henrygab af68035
analogWrite() avoids hostile takeover of PWM peripherals
henrygab a771af3
remove dead code
henrygab ab1b904
opt-in ownership of PWM peripheral
henrygab d469728
Use HwPWM ownership abstraction
henrygab d5dc053
Use HwPWM ownership abstraction
henrygab 3efce16
Servo can also use HwPWM ownership abstraction
henrygab c58c01d
Add check for PWM being ENABLED
henrygab c190318
Use const void* for ownership token
henrygab 027bcd3
Fix check for connected pins
henrygab 85e41af
remove dead code
henrygab a6e0d2c
Prefer `uintptr_t` to `void const *` for ownership token
henrygab 0acacf6
Finish conversion back to `uintptr_t` token
henrygab 145167b
tone() auto-release ownership
henrygab bbc4531
Improve logging for end users
henrygab aebdca3
Ensure default value for `analogWriteResolution()`
henrygab dd06e2f
Fix HwPWM debug logging typo
henrygab be9927e
Simplify by auto-detecting when called from ISR
henrygab 37935c7
Remove always_inline attribute
henrygab e58b39e
Reduce debug output for analog_write()
henrygab eb55315
Explicit `void` for no parameters
henrygab a2a4371
Remove static assertion
henrygab 43da173
Update noTone() to be safe to call from ISR
henrygab d00de2d
Change variable name per @hathach request.
henrygab d7b18ed
Code review required comment removal
henrygab 29843da
Redefine tone() without ISR
henrygab e200ee8
Remove deeper debug level 3
henrygab db5e0d6
Merge branch 'master' into PWM_Conflicts
henrygab 68a9302
Fix off-by-one typo
henrygab 2019117
Merge branch 'PWM_Conflicts' of https://github.com/henrygab/Adafruit_…
henrygab a566c69
With no ISR, use Mutex (not Binary) semaphore
henrygab e99b5ea
Use C++11 atomic
henrygab 02045e3
Poe-tay-toe, poe-tah-toe
henrygab fdf405c
@hathach believes having `noexcept` means code might throw exceptions…
henrygab 4555fc1
Rename struct per @hathach request
henrygab 1ba1299
change casing of class functions per @hathach request
henrygab a7ffaaa
@hathach doesn't like static_assert
henrygab 5f3d871
@hathach says internal classes should not guard against API misuse ..…
henrygab 53819e5
More removal of `noexcept` markings
henrygab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I still prefer using freeRTOS mutex, since I have no idea how this atomic function is implemented in ARM arch with preempted RTOS with/without ISR.
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.
Previously, you were uncomfortable because the CAS operation was using a GNU C++ macro, which you said was "legacy, mainly targeted Intel CPU".
I definitely looked at rewriting using a mutex. But, if you try, you will see that it quickly gets much more complicated, especially when you have to consider order of initialization for statics, error paths, etc.
The good news is that C++ has defined the atomic operation. Therefore, since it's ensured to work per the C++ standard, I'm not understanding your concern about ARM or whether preemption is enabled in freeRTOS?
From what I could see, the use of the C++ atomic fully addressed your concerns about "legacy" and "mainly targeted Intel CPU".
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.
I am new to these atomic operation, unless somebody could point out how these are implemented on ARM, I am not convinced. I suspected it would enable/disable with cpsie/cpsid which is not as ideal as using RTOS critical API. Anyway, I will do the change myself later on.