lupyuen / bl602-rust-wrapper

Rust Wrapper for BL602 IoT SDK
https://lupyuen.github.io/articles/adc
Apache License 2.0
16 stars 2 forks source link

How does this interact with bl602-hal #1

Open Kethku opened 3 years ago

Kethku commented 3 years ago

I'm interested in using the bl602 as a driver for the dwm1000 ultra wideband transceiver. However I don't think it makes sense to create a rust driver based on a hardware abstraction layer which isn't portable to other devices.

One of the appeals of the bl602 is that it can communicate over wifi and is so low power in sleep mode. These qualities make it seem like a great cheaper replacement for the more expensive esp32 which I've also been playing with. Plus being risk-v means that the rust compiles for it pretty much natively as apposed to requiring a janky fork of the compiler like the espressif toolchain.

So my question is how does this sdk interact with the bl602-hal https://github.com/sipeed/bl602-hal. I think I need to use this sdk in order to access wifi capabilities, but I'd rather not use it when communicating over spi to the dwm1000 because it would be better to create an abstract driver based on the embedded-rust traits.

Maybe I'm asking the wrong questions? I'm pretty new to all this (embedded hardware work) so any guidance would be greatly appreciated!

Kethku commented 3 years ago

Further investigation shows an existing implementation of the dwm1000 driver here https://docs.rs/dw1000/0.5.0/dw1000/ so now I'm even more motivated to find a way to use the bl602-hal along with the sdk at the same time!

lupyuen commented 3 years ago

Hi: Your project sounds really interesting! The two Rust APIs are totally different, they don't share any code...

  1. bl602-hal is the Pure Rust implementation of the BL602 HAL. If we're porting a driver that depends on the Rust Embedded HAL Framework (like dw1000), we should use bl602-hal

  2. bl602-rust-wrapper is a Rust Wrapper for the BL602 IoT SDK (in C). So it follows the conventions of the BL602 IoT SDK, not the Rust Embedded HAL.

(Someday we might build another wrapper around bl602-rust-wrapper to make it look like Rust Embedded HAL. But no plans yet)

I suggest you have a chat with the bl602-hal team? They are fairly active (I have friends there) and I think they would be happy to work with you :-)