Kayo Phoenix 74438fcec5
ADC raw values calibration (#555)
* adc_cal: c2: Add efuse functions for reading calibration

* adc_cal: c3: Add efuse functions for reading calibration

* adc_cal: c6: Add efuse functions for reading calibration

* adc_cal: Add extra traits to support calibration

- `AdcCalScheme<ADCI>` implemented for each calibration scheme (basic, linear, curved)
- `AdcCalEfuse` implemented for each ADC unit to get calibration data from efuse bits

* adc_cal: Add basic ADC calibration scheme

Basic calibration is related to setting some initial bias value to ADC unit.
Such values usually is stored in efuse bit fields but also can be measured
in runtime by connecting ADC input to ground internally.

* adc_cal: Add line fitting ADC calibration scheme

This scheme also includes basic calibration and implements gain correction based
on reference point.

Reference point is a pair of reference voltage and corresponding mean raw ADC
value. Such raw values usually is stored in efuse bit fields for each supported
attenuation.

Possibly it also can be measured in runtime by connecting ADC to reference
voltage internally.

* adc_cal: Add curve fitting ADC calibration scheme

This scheme also includes basic and linear and implements final polynomial error
correction.

* adc_cal: riscv: Add ADC calibration implementation for riscv chips

* adc_cal: c2: Add calibrated ADC reading example

This example uses line fitting calibration scheme by default.
It periodically prints both raw measured value and computed millivolts.

* adc_cal: c3: Add calibrated ADC reading example

This example uses curve fitting calibration scheme by default.
It periodically prints both raw measured value and computed millivolts.

* adc_cal: c6: Add calibrated ADC reading example

This example uses curve fitting calibration scheme by default.
It periodically prints both raw measured value and computed millivolts.

* adc_cal: riscv: Add changelog entry for ADC calibration
2023-07-04 10:14:27 -07:00
2023-06-22 05:37:24 -07:00
2023-07-04 10:14:27 -07:00
2021-10-19 15:00:41 -07:00
2021-10-19 15:00:41 -07:00
2023-05-11 08:53:03 -07:00
2023-05-09 10:34:22 -07:00

esp-hal

GitHub Workflow Status MIT/Apache-2.0 licensed Matrix

Hardware Abstraction Layer crates for the ESP32, ESP32-C2/C3/C6, ESP32-H2, and ESP32-S2/S3 from Espressif.

These HALs are no_std; if you are looking for std support, please use esp-idf-hal instead.

This project is still in the early stages of development, and as such there should be no expectation of API stability. A significant number of peripherals currently have drivers implemented (you can see a full list here) but have varying levels of functionality. For most basic tasks, this should be usable already.

If you have any questions, comments, or concerns, please open an issue, start a new discussion, or join us on Matrix. For additional information regarding any of the crates in this repository, please refer to the crate's README.

Crate Target Technical Reference Manual
esp32-hal xtensa-esp32-none-elf ESP32
esp32c2-hal riscv32imc-unknown-none-elf ESP32-C2
esp32c3-hal riscv32imc-unknown-none-elf ESP32-C3
esp32c6-hal riscv32imac-unknown-none-elf ESP32-C6
esp32h2-hal riscv32imac-unknown-none-elf Currently unavailable
esp32s2-hal xtensa-esp32s2-none-elf ESP32-S2
esp32s3-hal xtensa-esp32s3-none-elf ESP32-S3

Quickstart

We recommend using cargo-generate and esp-template in order to generate a new project with all the required dependencies and configuration:

$ cargo install cargo-generate
$ cargo generate -a esp-rs/esp-template

For more information on using this template, please refer to its README.

Ancillary Crates

There are a number of other crates within the esp-rs organization which can be used in conjunction with esp-hal:

Crate Description
esp-alloc A simple no_std heap allocator
esp-backtrace Backtrace support for bare-metal applications
esp-println Provides print! and println! implementations
esp-storage Implementation of embedded-storage traits to access unencrypted flash memory
esp-wifi no_std Wi-Fi/Bluetooth LE support

MSRV

The Minimum Supported Rust Versions are:

  • 1.65.0 for RISC-V devices (ESP32-C2, ESP32-C3, ESP32-C6, ESP32-H2)
  • 1.65.0 for Xtensa devices (ESP32, ESP32-S2, ESP32-S3)
  • 1.67.0 for all async examples (embassy_hello_world, embassy_wait, etc.)

Note that targeting the Xtensa ISA currently requires the use of the esp-rs/rust compiler fork. The esp-rs/rust-build repository has pre-compiled release artifacts for most common platforms, and provides installation scripts to aid you in the process.

RISC-V is officially supported by the official Rust compiler.

Git Hooks

We provide a simple pre-commit hook to verify the formatting of each package prior to committing changes. This can be enabled by placing it in the .git/hooks/ directory:

$ cp pre-commit .git/hooks/pre-commit

When using this hook, you can choose to ignore its failure on a per-commit basis by committing with the --no-verify flag; however, you will need to be sure that all packages are formatted when submitting a pull request.

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Description
no_std Hardware Abstraction Layers for ESP32 microcontrollers
Readme 113 MiB
Languages
Rust 99.8%
Jinja 0.1%