# CC2650 Device Support Crate Embedded Rust access API for [TI CC2650][CC2650] microcontrollers. [![crates.io](https://img.shields.io/crates/v/cc2650.svg)](https://crates.io/crates/cc2650) [![Documentation](https://docs.rs/cc2650/badge.svg)][crate-docs] This crate provides an autogenerated API interacting with the CC2650 and its peripherals. The API is generated using [svd2rust] via [dslite2svd]. ## Usage To use, in your Cargo.toml: ```toml [dependencies] cc2650 = "0.1" ``` The `rt` feature is optional and brings in support for [cortex-m-rt]: ```toml [dependencies] cc2650 = { version = "0.1", features = ["rt"] } ``` ### Examples See [my blog post about creating this crate][coding-retreat]. **Note:** The following example assumes you are using [Rust 2018], I.e. Rust >= 1.31. ```rust use cc2650; fn init() { let device_peripherals = cc2650::Peripherals::take().unwrap(); // Configure GPIO pins for output, maximum strength device_peripherals.IOC .iocfg10 .modify(|_r, w| w.port_id().gpio().ie().clear_bit().iostr().max()); device_peripherals.IOC .iocfg15 .modify(|_r, w| w.port_id().gpio().ie().clear_bit().iostr().max()); // Enable the PERIPH power domain and wait for it to be powered up device_peripherals.PRCM.pdctl0.modify(|_r, w| w.periph_on().set_bit()); loop { if device_peripherals.PRCM.pdstat0.read().periph_on().bit_is_set() { break; } } // Enable the GPIO clock device_peripherals.PRCM.gpioclkgr.write(|w| w.clk_en().set_bit()); // Load settings into CLKCTRL and wait for LOAD_DONE device_peripherals.PRCM.clkloadctl.modify(|_r, w| w.load().set_bit()); loop { if device_peripherals.PRCM.clkloadctl.read().load_done().bit_is_set() { break; } } // Enable outputs device_peripherals.GPIO .doe31_0 .modify(|_r, w| w.dio10().set_bit().dio15().set_bit()); } ``` ## Supported Devices * CC2650 — [Datasheet], [Product Page][CC2650] **Note:** There are other devices in the CC26x0 family that may also work but these have not been tested. ## Generating This crate was generated from SVD files generated by [dslite2svd]. ## License This project is dual licenced under: - Apache License, Version 2.0 ([LICENSE-APACHE](https://git.sr.ht/~wezm/cc2650/tree/master/LICENSE-APACHE) OR ) - MIT license ([LICENSE-MIT](https://git.sr.ht/~wezm/cc2650/tree/master/LICENSE-MIT) OR ) [coding-retreat]: https://www.wezm.net/technical/2019/03/sensortag-embedded-rust-coding-retreat/ [cortex-m-rt]: https://crates.io/crates/cortex-m-rt [crate-docs]: https://docs.rs/cc2650 [Datasheet]: http://www.ti.com/lit/gpn/cc2650 [dslite2svd]: https://github.com/wezm/dslite2svd [CC2650]: http://www.ti.com/product/CC2650 [Rust 2018]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/ [svd2rust]: https://github.com/rust-embedded/svd2rust