diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2020-07-21 21:40:50 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2020-07-21 23:19:32 +0200 |
commit | af1b3fba308008907ef0ea546175f58afa366cec (patch) | |
tree | f99d01f4da13548968c2c04aaa2f7696b72f2d71 /README.md | |
download | nrf-softdevice-af1b3fba308008907ef0ea546175f58afa366cec.zip |
First commit!
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..21f0973 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# `nrf-softdevice` + +Low-level Rust bindings for Nordic Semiconductor nRF series SoftDevices. + +Bindings are generated with `bindgen`, with extra post-processing to correctly generate the `svc`-based softdevice calls. + +Generated code consists of inline functions using inline ASM, ensuring the lowest possible +overhead. Most of the times you'll see them inlined as a single `svc` instruction in the +calling function. Here is an example: + +```rust +#[inline(always)] +pub unsafe fn sd_ble_gap_connect( + p_peer_addr: *const ble_gap_addr_t, + p_scan_params: *const ble_gap_scan_params_t, + p_conn_params: *const ble_gap_conn_params_t, + conn_cfg_tag: u8, +) -> u32 { + let ret: u32; + asm!("svc 140", + inout("r0") p_peer_addr => res, + inout("r1") p_scan_params => _, + inout("r2") p_conn_params => _, + inout("r3") conn_cfg_tag => _, + lateout("r12") _, + ); + ret +} +``` + +## Generating + +The bindings are generated from the headers with the `gen.sh` script. + +## License + +This repo includes the softdevice headers, which are licensed under [Nordic's proprietary license](LICENSE-NORDIC). + +Generated `binding.rs` files are a derived work of the headers, so they are also subject to Nordic's license. + +The generator code ([nrf-softdevice-gen](nrf-softdevice-gen)) is licensed under either of + +- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) +- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. |