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

🐛 Add timeout ctor to hal::stm32f1::can_peripheral_manager #91

Merged
merged 1 commit into from
Jan 19, 2025

Conversation

kammce
Copy link
Member

@kammce kammce commented Jan 19, 2025

hal::stm32f1::can_peripheral_manager has its original constructor deprecated and a new constructor accepting a hal::steady_clock and timeout time. If exiting initialization takes longer than the time out time, a hal::timed_out exception will be thrown.

In order to prevent applications unassociated from the can application to continue to work as usual, a try/catch is put around the construction of the hal::stm32f1::can_peripheral_manager object. If construction fails, then none of the can interface optionals will be set and the program will run without them. If the can application is executed and the optionals are nullopt, then access will throw and will terminate the application which is the intended behavior.

`hal::stm32f1::can_peripheral_manager` has its original constructor
deprecated and a new constructor accepting a `hal::steady_clock` and
timeout time. If exiting initialization takes longer than the time out
time, a `hal::timed_out` exception will be thrown.

In order to prevent applications unassociated from the can application
to continue to work as usual, a try/catch is put around the construction
of the `hal::stm32f1::can_peripheral_manager` object. If construction
fails, then none of the can interface optionals will be set and the
program will run without them. If the can application is executed and
the optionals are nullopt, then access will throw and will terminate
the application which is the intended behavior.
@kammce
Copy link
Member Author

kammce commented Jan 19, 2025

Demos PR can be found here: #90

@kammce kammce merged commit 405d41c into main Jan 19, 2025
17 checks passed
@kammce kammce deleted the can-timeout-ctor branch January 19, 2025 21:02
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