[DRAFT] Omi, Rust edition #3065
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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 Rustomi/firmware/omi/src/rust/app_main.rs<- main app in Rustomi/firmware/omi/src/rust/battery.rs<- battery, leaning on HAL to operate safelyomi/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 servicesomi/firmware/omi/src/rust/ffi.rs<- FFI wrappers in Rustomi/firmware/omi/src/rust/hal.rs<- Hardware Abstraction Layer in Rustomi/firmware/omi/src/rust/haptic.rs<- Haptics in Rustomi/firmware/omi/src/rust/led.rs<- LEDs in Rustomi/firmware/omi/src/rust/mic.rs<- microphone in Rustomi/firmware/omi/src/rust/sd_card.rs<- SD card utilities in Rustomi/firmware/omi/src/rust/settings.rs<- Settings in Rustomi/firmware/omi/src/rust/spi_flash.rs<- SPI Flash in Rust(
rust_led_native.rsis 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