
* feat: (WIP) add CSI api * feat: Enable G_CONFIG.csi_enable and update example * fix: Allow user to set the dessired cb method * fix: Clippy warnings * fix: Add missing doccomments * feat: Add csi_enable config * refactor: Update CsiConfiguration c6 struct * feat: Create set_csi WifiController and EspNowManager methods * docs: Update changelog * refactor: Rename CsiConfig struct * docs: Document c6 version of CsiConfig * feat: impl From<CsiConfig> for crate::include::wifi_csi_config_t * style: Rustfmt * docs: Fix comment Co-authored-by: Dániel Buga <bugadani@gmail.com> * docs: Fix typo Co-authored-by: Juraj Sadel <jurajsadel@gmail.com> * feat: Enable CSI on examples by default * feat: Handle errors * style: Rustfmt * feat: Update error * feat: Panic if csi config is not enabled * feat: Cfg CSI stuff when CSI is disabled instead of panicing * fix: Clippy lints * feat: Fix signed bitfields * feat: Pass the cb via ctx * feat: Update CSI callback to use closures * refactor: Rename promiscuous_csi_rx_cb to csi_rx_cb * feat: Move extra boxing inside set_receive_cb * feat: Refactor CSI callback to use generic types * refactor: Remove Sized bound from CsiCallback trait * feat: Add csi_enable field to EspWifiConfig and update CsiCallback trait for conditional compilation * feat: Remove unnecessary boxes * feat: Update callback type in set_csi to require Send trait Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com> --------- Co-authored-by: Dániel Buga <bugadani@gmail.com> Co-authored-by: Juraj Sadel <jurajsadel@gmail.com> Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
Examples
This package contains a number of binary applications demonstrating the use of various hardware peripherals found within ESP32 the family of devices.
Each device has its own unique set of peripherals, and as such not every example will run on every device. We recommend building and flashing the examples using the xtask
method documented below, which will greatly simplify the process.
To check if a device is compatible with a given example, check the metadata comments above the imports, which will list all supported devices following the //% CHIPS:
designator. If this metadata is not present, then the example will work on any device supported by esp-hal
.
As previously stated, we use the cargo-xtask pattern for automation. Commands invoking this tool must be run from the root of the repository.
Building Examples
You can build all examples for a given device using the build-examples
subcommand:
cargo xtask build-examples esp-hal esp32
Note that we must specify which package to build the examples for, since this repository contains multiple packages.
Running Examples
You can also build and then subsequently flash and run an example using the run-example
subcommand. With a target device connected to your host system, run:
cargo xtask run-example esp-hal esp32c6 hello_world
Again, note that we must specify which package to build the example from, plus which example to build and flash to the target device.
Adding Examples
If you are contributing to esp-hal
and would like to add an example, the process is generally the same as any other project.
One major difference in our case is the metadata comments which state the compatible devices and required features for an example. Both of these designators are optional; if //% CHIPS:
is omitted then all devices considered to be supported, and if //% FEATURES:
is omitted then no features are enabled at build time.
To demonstrated, in src/bin/embassy_hello_world.rs
you will see the following:
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
//% FEATURES: embassy esp-hal-embassy/integrated-timers
Another thing to be aware of is the GPIO pins being used. We have tried to use pins available the DevKit-C boards from Espressif, however this is being done on a best-effort basis.
In general, the following GPIO are recommended for use, though be conscious of whether certain pins are used for UART, strapping pins, etc. on some devices:
- GPIO0
- GPIO1
- GPIO2
- GPIO3
- GPIO4
- GPIO5
- GPIO8
- GPIO9
- GPIO10