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 basic spi compile doctest #693

Closed
wants to merge 1 commit into from

Conversation

MabezDev
Copy link
Member

Run with cd esp-hal-common & cargo test --doc -Zdoctest-xcompile --features esp32c3 --target riscv32imc-unknown-none-elf spi.

It sucks that we need to add a panic handler, and that SYSTEM/DPORT/PCR needs to be cfg'd (maybe we should abstract this in a different way, or consider unifying the name), but other than that it works pretty well.

FYI this is what the final documentation looks like:

image

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 examples work.
  • cargo fmt was run.
  • Your changes were added to the CHANGELOG.md in the proper section.
  • You updated existing examples or added examples (if applicable).
  • Added examples are checked in CI

Nice to have

  • You add a description of your work to this PR.
  • You added proper docs for your newly added features and code.

- Run with `cd esp-hal-common` & `cargo test --doc -Zdoctest-xcompile --features esp32c3 --target riscv32imc-unknown-none-elf spi`
//! # let mut system = peripherals.DPORT.split();
//! # let mut peripheral_clock_control = system.peripheral_clock_control;
//! # let mut clocks = ClockControl::boot_defaults(system.clock_control).freeze();
//! #
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
//! #
//! #

rustfmt doesn't leave us any space.

@jessebraham
Copy link
Member

Maybe this is worth revisiting now? The panic handler situation is still sub-optimal, however the DPORT/SYSTEM/PCR issue has at least been resolved.

@jessebraham
Copy link
Member

I've created an issue to further investigate this; since we are not going to merge this, going to close this PR now. Thanks for the idea and proof-of-concept, though!

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.

None yet

3 participants