Conversation
Whoops, looks like I'm running into a rustfmt bug in CI: rust-lang/rustfmt#3819 |
Have refactored to avoid parameter attributes, should pass CI this time :) |
Awesome! Putting all the nRF5x support in one crate is definitely the way to go, especially now that I've looked at the nRF5340 (it's again pretty much the same radio).
Technically you don't need to see the output just to try it, and all the debug printing might be too much for a 16 MHz Cortex-M0 anyways. Unfortunately there's currently a bug that means that the link layer doesn't work with logging compiled out (#94), this might also apply to the nRF51 (or might not). Will take a closer look at this later. Thanks a lot for the PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To end up with clear naming without breaking backwards compatibility, I renamed
rubble-nrf52
torubble-nrf5x
, and maderubble-nrf52
a shim crate that re-exports all of rubble-nrf5x - I'm happy to rethink this approach if you would prefer something else.
Backwards-compat isn't really a concern currently (Rubble isn't in a state where people could build significant things on top of it), but it would be useful to publish a dummy release of rubble-nrf52
pointing to the new name, like I did for rubble-nrf52810. I think for now you can just delete the rubble-nrf52
crate completely. I'll publish a dummy crate once the next version is ready.
rubble-nrf5x/src/radio.rs
Outdated
pub fn new( | ||
radio: RADIO, | ||
ficr: pac::FICR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since FICR is read-only, it should suffice to pass a reference to it instead of taking ownership (which would make it inaccessible to other code).
It might even be a good idea to take that reference even for the nRF52 chips even though it isn't needed, in order to make the API more uniform (and passing an additional reference isn't really much of a burden to the user). It would allow getting rid of the #[cfg]
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks a lot!
This is an updated version of #59 against the lastest master, and with the code refactored into a single crate, since it turns out there are very few differences between the implementations!
To end up with clear naming without breaking backwards compatibility, I renamed
rubble-nrf52
torubble-nrf5x
, and maderubble-nrf52
a shim crate that re-exports all of rubble-nrf5x - I'm happy to rethink this approach if you would prefer something else.The nrf51 build is tested in CI, though I have not added demos yet (the
nrf51
crate doesn't provide amemory.x
(I'm planning to change this)).I've got the beacon example is working, though I am yet to try the other one (I don't have a pin for UART exposed on the device I'm testing on...).