esp-rs / std-training

Embedded Rust on Espressif training material.

Home Page:https://esp-rs.github.io/std-training

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Common crates

gruvw opened this issue · comments

Hi, just started my first project in the embedded Rust world :)

I am wondering how can I access the so-called "common crates" outside this training scope ?

I finished going through the awesome examples in this repository, and I feel ready to start a project on my own.
After creating a new project from the template using the recommended cargo-generate, I am a bit lost without those common crates.

Are the rgb-led and wifi common crates published on crates.io, or are we supposed to copy and manually include those short pieces of code in our own projects ?

Thank you so much for your help, and sorry if this is not the right place to ask beginner questions.

You may be confused, because we recently updated how we export our basic 3 crates esp-idf-sys, esp-idf-hal and esp-idf-svc. From a relationship perspective we always made sure that svc depends on hal and hal depends on sys. Because of this with our latest release we fully re-export the hal and sys crate through svc. So you only need one dependency directly- Before that the user needed to make sure all 3 versions were aligned enough, with this we eased this a bit.

To access the underlying other two crates. for example you want to access peripherals of the hal crate, you can do use esp-idf-svc::hal::peripherals and similar for sys using esp-idf-svc::sys.

Wifi support if fully integrated inside esp-idf-svc and if you look what the std-traning does, its essentially just a function that wraps around the setup routine of the wifi, e,g creating a config , passing the nvs partition and creating a driver object and starting all things. In other words for your basic needs all should be there. The rgb-led is a bit special because its a smartl-led ( addressable with timed pwm pulses) if you want to use it in your projects you can either reuse the code from training or use an external driver that supports this ws2218 led's or what they were called.

In general if you have questions, the best place to ask is inside our matrix room