Skip to content
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

HRTIM #146

Open
wants to merge 75 commits into
base: staged-pac
Choose a base branch
from
Open

HRTIM #146

wants to merge 75 commits into from

Conversation

usbalbin
Copy link
Contributor

@usbalbin usbalbin commented Nov 9, 2024

NOTE: This is targeted at the staged-pac branch which depends on the newer staged pac

@usbalbin usbalbin mentioned this pull request Nov 9, 2024
usbalbin and others added 29 commits November 9, 2024 11:18
* Rcc enable is now handled for the entire HRTIM peripheral by dp.HRTIM_COMMON.hr_control() instead of by every timer
* HRTIM calibration is now mandatory, also handled by `dp.HRTIM_COMMON.hr_control()` but also by running on that result `_.wait_for_calibration().
* Add `get_state` for `HrOutput` to check what state an output is in: `Idle`, `Running` or `Fault`
* dma - update for new pac
* adc - triggers
* hrtim
* Add output polarity
* Add counting direction
* Do not start timer directly when created, helps when used as AD trigger
* Add methods for starting/stopping timers
* Add some adc triggers
* One does no longer specify an EventSource variant manually, instead the user can pass the actual object that will emit the signal. For example pass a reference to HrCr1 to output.enable_reset_event to make output listen to HrCr1
* Added support for deadtime
usbalbin and others added 26 commits November 9, 2024 11:18
This is quite an ugly hack but it does try to keep the API as unchanged as possible.
This fix only fixes the problem on cat 3 and 4 devices for now.

According to RM0440 under "DMAMUX mapping":

For category 3 and category 4 devices:
* DMAMUX channels 0 to 7 are connected to DMA1 channels 1 to 8
* DMAMUX channels 8 to 15 are connected to DMA2 channels 1 to 8

For category 2 devices:
* DMAMUX channels 0 to 5 are connected to DMA1 channels 1 to 6
* DMAMUX channels 6 to 11 are connected to DMA2 channels 1 to 6
* Allow disabling update of shadow registers
* Add `control` member to HrPwmControl
* HRTIM now has its own `FaultMonitor` trait
… of init

This ensures there is no sporadic output at the pins.

This is a breaking change and does change and clean up quite a lot of things.
Examples will need to be updated.
@usbalbin usbalbin mentioned this pull request Nov 9, 2024
5 tasks
@usbalbin usbalbin changed the title Hrtim6 HRTIM Nov 9, 2024
@usbalbin
Copy link
Contributor Author

usbalbin commented Nov 9, 2024

This is by no means complete. There are a lot of missing things like listening on events from neighbor timers, burst mode, chopper etc. However I still believe it does cover quite a lot of use cases. Some of which are showed in the examples.

I am no type system ninja so there are probably a lot of things that can(and should?) be improved upon :)

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