A fork of Nordic Semiconductor's nRF8001 Arduino SDK ported for ARM with optional Rust bindings generated via bindgen.
All low-level IO and delay routines are left as external dependencies so that they're not directly tied to any particular architecture.
The SDK works as expected though the IO interface could use some minor cleanup. It's configured to run without the use of interrupts.
I generally erred on the side of leaving the SDK and associated API's as intact as possible for the sake of getting it working and maintaining backwards compatibility, at least for now.
Although there's nothing ARM-specific about the codebase, it is currently configured to only run on ARM. Fixing this should be pretty easy:
- Don't hard-code the ARM gcc compiler and archiver in the build.rs script.
- Rip out the old AVR-specific code that's currently #define'd out when the
__arm__
flag is available and then get rid of that build flag.
- Initialize GPIO and SPI yourself
- Provide implementations for functions in io_support.h.
- Follow Nordic's documentation to use the SDK. The reference manual is generally great, and Nordic provides many examples in C in the examples folder.
See nrf8001-sandbox for some example usage in Rust.
- Mashing old dev boards I had laying around together. The nRF8001 is used on the Adafruit Bluefruit LE.
- Figuring out how to use bindgen to generate C bindings for Rust, and seeing what I can prototype and build in Rust on top of this.
- Learning a little bit about BLE along the way.
A few downers I learned along the way:
- The nRF8001 is not recommended for new designs by Nordic.
- Defining BLE characteristics beyond the examples in the Nordic SDK requires using the Windows-only nRFgo Studio to generate opaque setup messages.
- Building a Rust-C interface is a bit ugly in that it requires a lot of unsafe calls. There's no real way around this other than to build a wrapper that hides away all the unsafe calls.
- Nordic's nRF8001 Arduino SDK. Porting instructions are provided in their documentation.
- nRF8001 product specification
- shraken/nrf8001-stm32f4: another port of the nRF8001 SDK to the STM32F4 that uses the STM32 peripheral library extensively. This served as a useful reference and starting point.
- Making a *-sys crate