The project has moved to a new location: daisy-embassy/daisy-embassy.
Please visit the new repository for the latest updates and development, and please update any git references in your Cargo.toml or other tooling.
daisy-embassy
is a Rust crate for building embedded async audio applications on the Daisy Seed using the Embassy framework. It provides a streamlined interface to initialize and configure Daisy Seed hardware for both low-latency, non-blocking audio processing and powerful asynchronous application processing, making it an ideal starting point for embedded audio projects in Rust.
This crate is designed for developers familiar with embedded systems and audio processing, but new to Rust's embedded ecosystem. It enables safe and flexible audio application development, leveraging Rust's type system to prevent common peripheral configuration errors at compile time.
- Audio Processing as an Integrated Task: You can treat audio processing as a dedicated task within the Embassy async runtime, ensuring low-latency, non-blocking audio output. This approach allows seamless integration with other system tasks, enabling efficient resource sharing and predictable performance for audio applications on the Daisy Seed.
- Asynchronous Application Processing: Leverage the power of Embassy's async framework to build responsive and efficient applications.
daisy-embassy
(and embassy) supportsasync
handling of GPIO interrupts, MIDI message stream reading/writing, OLED display updates, AD/DA streaming, and other application logic, allowing developers to create complex, event-driven audio projects with ease. - Simplified Setup: Use the
new_daisy_board!
macro to initialize Daisy Seed peripherals with minimal boilerplate. - Safe Configuration: Get sane clock defaults via
daisy_embassy::default_rcc
, and avoid the usual headaches of manual peripheral and DMA setup. - Flexible API: Access peripherals through builder structs for safe defaults, or dive deeper with public accessors for custom configurations.
- Community-Inspired: Built on foundations from stm32h7xx-hal, daisy_bsp, zlosynth/daisy, and libdaisy-rust.
To demonstrate the ease of use, here's a simplified version of the passthrough.rs
example, which sets up an audio passthrough (input to output) using the new_daisy_board!
macro:
// safe clock configuration
let config = daisy_embassy::default_rcc();
// initialize the "board"
let p = hal::init(config);
let board: DaisyBoard<'_> = new_daisy_board!(p);
// build the "interface"
let mut interface = board
.audio_peripherals
.prepare_interface(Default::default())
.await;
// start audio callback
interface
.start(|input, output| {
// process audio data
// here we just copy input to output
output.copy_from_slice(input);
})
.await;
- Macro Simplicity: The
new_daisy_board!
macro moves necessary objects fromembassy::Peripherals
into builders likedaisy_embassy::AudioPeripherals
ordaisy_embassy::FlashBuilder
and so on, streamlining peripheral initialization. - Builder Pattern: Peripherals are accessed via a
XXXBuilder
struct, which provides builder methods (in the case above,.prepare_interface()
) for safe configuration. - Flexibility: Builders expose
pub
accessors, allowing advanced users to bypass our building and implement custom initialization logic for peripherals. - Safety: The API ensures memory safety and correct peripheral usage, aligning with Rust's guarantees.
See the examples/
directory for more demos, such as blinky.rs
or triangle_wave_tx.rs
.
Board | Revision | Codec | Status |
---|---|---|---|
Daisy Seed 1.1 | Rev5 | WM8731 | ✅ Supported |
Daisy Seed 1.2 | Rev7 | PCM3060 | ✅ Supported |
Daisy Seed (AK4556) | - | AK4556 | 🚧 Not yet |
Daisy Patch SM | - | - | 🚧 Not yet |
Note: Additional board support is planned. Contributions are welcome; see the Issues page for details.
-
Rust Toolchain: Install via rustup:
rustup target add thumbv7em-none-eabihf
-
probe-rs: For flashing and debugging, install probe-rs.
-
Daisy Seed: Supported board (Rev5 or Rev7) and USB cable.
Tip: If probe-rs fails, verify your board connection and check probe-rs docs.
-
Clone the Repository:
git clone https://github.com/Dicklessgreat/daisy-embassy.git cd daisy-embassy
-
Identify Your Board:
- Rev5 (WM8731): Default, no extra flags.
- Rev7 (PCM3060): Use
--features=seed_1_2 --no-default-features
.
-
Run an Example:
# Rev5: Blinky example cargo run --example blinky --release # Rev7: Triangle wave example cargo run --example triangle_wave_tx --features=seed_1_2 --no-default-features --release
-
Build and Customize:
- Explore
examples/
for demos likepassthrough.rs
ortriangle_wave_tx.rs
. - Modify examples to create custom audio applications.
- Debug issues using probe-rs logs.
- When you find a bug, need help, or have suggestions, open an Issue.
- Explore
- Daisy
- Embassy Documentation
- probe-rs Guide
- Daisy Community Forum for hardware-related questions.
This project is licensed under the MIT License.