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 method to check if bus is dominant #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

epontan
Copy link
Collaborator

@epontan epontan commented Jan 30, 2025

Checking if the bus is dominant (i.e., the RX pin value is low) can be particularly useful in scenarios where the transceiver is put into sleep mode. Some transceivers (such as TCAN1043-Q11) signals wake-up by setting the RX pin (and nFAULT) to low while being in sleep mode. To accurately tell if the transceiver requests a wake-up, the RX pin state needs to be accessible from the application.

Fortunately MCAN exposes a way to read the state of the RX pin through its TEST register. Extend the DynAux trait with an additional method that reads the RX bit from that register.

Thank you!

Thank you for your contribution.
Please make sure that your submission includes the following:

Must

  • The code compiles without errors or warnings.
  • All tests pass and in the best case you also added new tests.
  • cargo +stable fmt was run.
  • cargo +stable clippy yields no warnings.
  • Your changes were added to the CHANGELOG.md in the proper section.
  • You add a description of your work to this PR.
  • You added proper docs (in code, rustdoc and README.md) for your
    newly added features and code.

@epontan epontan requested a review from a team as a code owner January 30, 2025 10:01
* Elide lifetimes as suggested by `clippy::needless_lifetimes`[1]

* Fix doc list indentation warnings, `clippy::doc_lazy_continuation`[2],
  as appropriate

* Add `Default` implementation for `SharedMemory` as suggested by
  `clippy::new_without_default`[3]

[1]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
[2]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
[3]: https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
Checking if the bus is dominant (i.e., the RX pin value is low) can be
particularly useful in scenarios where the transceiver is put into sleep
mode. Some transceivers (such as TCAN1043-Q1[1]) signals wake-up by
setting the RX pin (and nFAULT) to low while being in sleep mode. To
accurately tell if the transceiver requests a wake-up, the RX pin state
needs to be accessible from the application.

Fortunately MCAN exposes a way to read the state of the RX pin through
its `TEST` register. Extend the `DynAux` trait with an additional method
that reads the `RX` bit from that register.

[1]: https://www.ti.com/product/TCAN1043-Q1
Copy link
Contributor

@evading evading left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

@Ironedde Ironedde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice addition 👍

Just rebase this PR with the latest HEAD and I'll approve this one as well and get a release going for mcan/0.6.0.

There is an option for rebasing here on Github, if you want you can try it out so we can see how well it works.

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.

3 participants