drogue-device icon indicating copy to clipboard operation
drogue-device copied to clipboard

A distribution of tools and examples for building embedded IoT applications in Rust

Drogue Device

CI Build CI Test crates.io docs.rs Matrix Bors enabled

Drogue device is a distribution of tools and examples for building embedded applications in Rust.

  • Built using rust, an efficient, memory safe and thread safe programming language.
  • Based on embassy, the embedded async project.
  • IoT examples for BLE, BLE Mesh, WiFi and LoRaWAN.
  • Async programming model for writing safe and efficient applications.
  • All software is licensed under the Apache 2.0 open source license.

See the documentation for more information and an overview of the examples.

Go to our homepage to learn more about the Drogue IoT project.

Example application

An overview of the examples can be found in the documentation.

Drogue device runs on any hardware supported by embassy, which at the time of writing includes:

  • nRF52
  • STM32
  • Raspberry Pi Pico
  • Linux, Mac OS X or Windows
  • WASM (WebAssembly)

Once you've found an example you like, you can run cargo xtask clone <example_dir> <target_dir> to create a copy with the correct dependencies and project files set up.

A basic blinky application

#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
    let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);

    loop {
        led.set_high();
        Timer::after(Duration::from_millis(300)).await;
        led.set_low();
        Timer::after(Duration::from_millis(300)).await;
    }
}

Building

To build drogue-device, you must install the nightly rust toolchain. Once installed, you can build and test the framework by running

cargo build

To do a full build of everything including examples:

cargo xtask ci

This might require you do install additional toolchains for the examples to build. Recent versions of cargo should automatically install the toolchain from looking at the rust-toolchain.toml file.

To update dependencies, run:

cargo xtask update

Directory layout

  • device - the source of the drogue-device framework
    • device/src/traits - traits provided by drogue that can be used in async code, such as TCP, WiFi or LoRa
    • device/src/drivers - async drivers that implement traits for a one or more peripherals
    • device/src/network - network connectivity, common network implementations, HTTP clients,
    • device/src/actors - common actors that can be used in applications
    • device/src/bsp - board support packages for boards commonly used in drogue device
  • macros - macros used by drogue-device and application code
  • examples - examples for different platforms and boards

Contributing

See the document CONTRIBUTING.md.

Community