Skip to content

Conversation

@annie444
Copy link

This pull request introduces several updates to the radio crate, focusing on enhancing maintainability, feature support, and compatibility with newer Rust standards. Key changes include updates to the Cargo.toml file to modernize dependencies and features, the addition of new functionality for testing feature combinations, and various code improvements across multiple files.

Dependency and Feature Updates:

  • Updated the Rust edition in Cargo.toml from 2018 to 2024 and added new features (log, clap) to the feature set. Dependencies were also updated to their latest versions, improving compatibility and security. (Cargo.toml, Cargo.tomlL4-R53). The log and clap features were referenced in the cfg directives, but not defined in the Cargo.toml.

New Testing Functionality:

  • Added a check script in the justfile to test all feature combinations in Cargo.toml using tq and jq. This ensures the crate builds correctly under different feature sets. (justfile, justfileR1-R25). This is not the most eloquent solution, but it's a solution nonetheless.

Logging Enhancements:

  • Introduced conditional logging using the log crate when the defmt feature is not enabled, providing more flexibility in debugging. (src/blocking.rs, [1]; src/helpers.rs, [2]. This was mostly implemented, but there were cases where the cfg directives on debug! calls specified any(feature = "defmt", feature = "log"), but log::debug was not imported.

Code Modernization and Refactoring:

  • Refactored imports and improved modularity by grouping related imports and using feature flags for conditional compilation. (src/helpers.rs, src/helpers.rsL25-R33)
  • Updated method names for continuity, such as renaming expect to update_expectations in the mock module. (src/mock.rs, src/mock.rsL55-R54). This matches the updated method in the embedded-hal crate.

New Functionality:

  • Added a delay_us method in the mock module to simulate delays, enhancing the testing capabilities for timing-sensitive operations. (src/mock.rs, src/mock.rsR224-R232). The alternative was to change the test logic, but I opted for this approach (more methods = more functionality).

@annie444
Copy link
Author

annie444 commented May 25, 2025

resolves #30
resolves #32

@annie444
Copy link
Author

cc: @henrikssn

description = "Generic traits for embedded packet radio devices"
repository = "https://github.com/rust-iot/radio-hal"
authors = ["Ryan Kurte <[email protected]>"]
repository = "https://github.com/annie444/radio-hal"
Copy link
Member

Choose a reason for hiding this comment

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

probably don't need to change this

@ryankurte
Copy link
Member

hey thanks for the PR, i'd rather add a few more feature-flag permutations to the CI matrix than include a bunch of python tools but the rest of this seems good.

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