Skip to content

Conversation

@mdaiter
Copy link

@mdaiter mdaiter commented Sep 30, 2025

Hey all,

Saw the repo, wanted it in Rust, ported the top level (not DK2 or EVT) to Rust. This is a software (read: non-hardware) tested Rust build, encapsulating all unsafe C calls and allowing Rust to take care of:

  1. async coordination natively
  2. declarative device trees
  3. memory safety hardening

Tested to fully compile through cargo check --manifest-path omi/src/rust/Cargo.toml.

Happy to answer questions.
omi/firmware/omi/src/rust/ <- Rust additions. In this:
omi/firmware/omi/src/ffi/shims.c <- shims for FFI, unlocking C functions to be exposed to Rust
omi/firmware/omi/src/rust/app_main.rs <- main app in Rust
omi/firmware/omi/src/rust/battery.rs <- battery, leaning on HAL to operate safely
omi/firmware/omi/src/rust/ble.rs <- BLE services. The Rust macro in here's actually extremely efficient at making all BLE declarative, so there's no confusion or introduced bugs from copy / pasting C while implementing BLE services
omi/firmware/omi/src/rust/ffi.rs <- FFI wrappers in Rust
omi/firmware/omi/src/rust/hal.rs <- Hardware Abstraction Layer in Rust
omi/firmware/omi/src/rust/haptic.rs <- Haptics in Rust
omi/firmware/omi/src/rust/led.rs <- LEDs in Rust
omi/firmware/omi/src/rust/mic.rs <- microphone in Rust
omi/firmware/omi/src/rust/sd_card.rs <- SD card utilities in Rust
omi/firmware/omi/src/rust/settings.rs <- Settings in Rust
omi/firmware/omi/src/rust/spi_flash.rs <- SPI Flash in Rust
(rust_led_native.rs is for when the Zephyr rust support becomes a first class citizen)

Anyone have an idea of how to test if you don't have the hardware on you?

(Also, this is really meant to help anyone looking to code this in Rust. Feel free to run with this if you feel like it cleans up your codebase or toss it if it doesn't)

Looks like @aaravgarg is the guy to contact in Omi for firmware. If not, please let me know who to ask

@mdaiter mdaiter marked this pull request as ready for review October 2, 2025 06:11
@beastoin
Copy link
Collaborator

beastoin commented Oct 4, 2025

interesting, i'll take a look and let you know. feel free to ping me @thinh http://discord.omi.me

@mdaiter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants