jonas-schievink / rubble

(going to be a) BLE stack for embedded Rust
BSD Zero Clause License
396 stars 56 forks source link

Updated nRF51 support #97

Closed JJJollyjim closed 4 years ago

JJJollyjim commented 4 years ago

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 to rubble-nrf5x, and made rubble-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 a memory.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...).

Screenshot_20191129-025638

JJJollyjim commented 4 years ago

Whoops, looks like I'm running into a rustfmt bug in CI: https://github.com/rust-lang/rustfmt/issues/3819

JJJollyjim commented 4 years ago

Have refactored to avoid parameter attributes, should pass CI this time :)

jonas-schievink commented 4 years ago

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).

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...).

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!