mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 14:44:42 +00:00
Documentation fixes (#668)
* Rustdoc improvements * Format efuse bracketed names as code * Fix SPI docs
This commit is contained in:
parent
2472b6d7a9
commit
adeb3c67c8
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@ -59,7 +59,7 @@ jobs:
|
|||||||
run: cd esp-hal-smartled/ && cargo +esp check --features=esp32s3
|
run: cd esp-hal-smartled/ && cargo +esp check --features=esp32s3
|
||||||
# Ensure documentation can be built (requires a chip feature!)
|
# Ensure documentation can be built (requires a chip feature!)
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp-hal-smartled/ && cargo doc --features=esp32c3
|
run: cd esp-hal-smartled/ && cargo doc --features=esp32c3,esp-hal-common/eh1
|
||||||
|
|
||||||
esp32-hal:
|
esp32-hal:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -93,7 +93,7 @@ jobs:
|
|||||||
run: cd esp32-hal/ && cargo check --example=embassy_i2c --features=embassy,embassy-time-timg0,async
|
run: cd esp32-hal/ && cargo check --example=embassy_i2c --features=embassy,embassy-time-timg0,async
|
||||||
# Ensure documentation can be built
|
# Ensure documentation can be built
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp32-hal/ && cargo doc
|
run: cd esp32-hal/ && cargo doc --features=eh1
|
||||||
|
|
||||||
esp32c2-hal:
|
esp32c2-hal:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -135,7 +135,7 @@ jobs:
|
|||||||
run: cd esp32c2-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
run: cd esp32c2-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
||||||
# Ensure documentation can be built
|
# Ensure documentation can be built
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp32c2-hal/ && cargo doc
|
run: cd esp32c2-hal/ && cargo doc --features=eh1
|
||||||
|
|
||||||
esp32c3-hal:
|
esp32c3-hal:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -179,7 +179,7 @@ jobs:
|
|||||||
run: cd esp32c3-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
run: cd esp32c3-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
||||||
# Ensure documentation can be built
|
# Ensure documentation can be built
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp32c3-hal/ && cargo doc
|
run: cd esp32c3-hal/ && cargo doc --features=eh1
|
||||||
|
|
||||||
esp32c6-hal:
|
esp32c6-hal:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -221,7 +221,7 @@ jobs:
|
|||||||
run: cd esp32c6-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
run: cd esp32c6-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
||||||
# Ensure documentation can be built
|
# Ensure documentation can be built
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp32c6-hal/ && cargo doc
|
run: cd esp32c6-hal/ && cargo doc --features=eh1
|
||||||
|
|
||||||
esp32h2-hal:
|
esp32h2-hal:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -263,7 +263,7 @@ jobs:
|
|||||||
run: cd esp32h2-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
run: cd esp32h2-hal/ && cargo check --example=interrupt_preemption --features=interrupt-preemption
|
||||||
# Ensure documentation can be built
|
# Ensure documentation can be built
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp32h2-hal/ && cargo doc
|
run: cd esp32h2-hal/ && cargo doc --features=eh1
|
||||||
|
|
||||||
esp32s2-hal:
|
esp32s2-hal:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -300,7 +300,7 @@ jobs:
|
|||||||
run: cd esp32s2-hal/ && cargo check --example=embassy_i2c --features=embassy,embassy-time-timg0,async
|
run: cd esp32s2-hal/ && cargo check --example=embassy_i2c --features=embassy,embassy-time-timg0,async
|
||||||
# Ensure documentation can be built
|
# Ensure documentation can be built
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp32s2-hal/ && cargo doc
|
run: cd esp32s2-hal/ && cargo doc --features=eh1
|
||||||
|
|
||||||
esp32s3-hal:
|
esp32s3-hal:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -342,7 +342,7 @@ jobs:
|
|||||||
run: cd esp32s3-hal/ && cargo check --example=octal_psram --features=opsram_2m --release # This example requires release!
|
run: cd esp32s3-hal/ && cargo check --example=octal_psram --features=opsram_2m --release # This example requires release!
|
||||||
# Ensure documentation can be built
|
# Ensure documentation can be built
|
||||||
- name: rustdoc
|
- name: rustdoc
|
||||||
run: cd esp32s3-hal/ && cargo doc
|
run: cd esp32s3-hal/ && cargo doc --features=eh1
|
||||||
|
|
||||||
esp-riscv-rt:
|
esp-riscv-rt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -250,6 +250,7 @@ fn gen_efuse_table(device_name: &str, out_dir: impl AsRef<Path>) {
|
|||||||
fields.next().map(|s| s.trim()),
|
fields.next().map(|s| s.trim()),
|
||||||
) {
|
) {
|
||||||
(Some(name), Some(block), Some(bit_off), Some(bit_len), Some(desc)) => {
|
(Some(name), Some(block), Some(bit_off), Some(bit_len), Some(desc)) => {
|
||||||
|
let desc = desc.replace('[', "`[").replace(']', "]`");
|
||||||
writeln!(writer, "/// {desc}").unwrap();
|
writeln!(writer, "/// {desc}").unwrap();
|
||||||
writeln!(
|
writeln!(
|
||||||
writer,
|
writer,
|
||||||
|
@ -38,8 +38,8 @@ pub trait AdcHasCurveCal {
|
|||||||
/// This scheme implements final polynomial error correction using predefined
|
/// This scheme implements final polynomial error correction using predefined
|
||||||
/// coefficient sets for each attenuation.
|
/// coefficient sets for each attenuation.
|
||||||
///
|
///
|
||||||
/// This scheme also includes basic calibration ([`AdcCalBasic`]) and line
|
/// This scheme also includes basic calibration ([`super::AdcCalBasic`]) and
|
||||||
/// fitting ([`AdcCalLine`]).
|
/// line fitting ([`AdcCalLine`]).
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct AdcCalCurve<ADCI> {
|
pub struct AdcCalCurve<ADCI> {
|
||||||
line: AdcCalLine<ADCI>,
|
line: AdcCalLine<ADCI>,
|
||||||
@ -131,7 +131,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
coeff_tables! {
|
coeff_tables! {
|
||||||
/// Error curve coefficients derived from https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32c3/curve_fitting_coefficients.c
|
/// Error curve coefficients derived from <https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32c3/curve_fitting_coefficients.c>
|
||||||
#[cfg(esp32c3)]
|
#[cfg(esp32c3)]
|
||||||
CURVES_COEFFS1 [
|
CURVES_COEFFS1 [
|
||||||
Attenuation0dB => [
|
Attenuation0dB => [
|
||||||
@ -158,7 +158,7 @@ mod impls {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Error curve coefficients derived from https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32c6/curve_fitting_coefficients.c
|
/// Error curve coefficients derived from <https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32c6/curve_fitting_coefficients.c>
|
||||||
#[cfg(esp32c6)]
|
#[cfg(esp32c6)]
|
||||||
CURVES_COEFFS1 [
|
CURVES_COEFFS1 [
|
||||||
Attenuation0dB => [
|
Attenuation0dB => [
|
||||||
@ -183,7 +183,7 @@ mod impls {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Error curve coefficients derived from https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32s3/curve_fitting_coefficients.c
|
/// Error curve coefficients derived from <https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32s3/curve_fitting_coefficients.c>
|
||||||
#[cfg(esp32s3)]
|
#[cfg(esp32s3)]
|
||||||
CURVES_COEFFS1 [
|
CURVES_COEFFS1 [
|
||||||
Attenuation0dB => [
|
Attenuation0dB => [
|
||||||
@ -210,7 +210,7 @@ mod impls {
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Error curve coefficients derived from https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32s3/curve_fitting_coefficients.c
|
/// Error curve coefficients derived from <https://github.com/espressif/esp-idf/blob/903af13e8/components/esp_adc/esp32s3/curve_fitting_coefficients.c>
|
||||||
#[cfg(esp32s3)]
|
#[cfg(esp32s3)]
|
||||||
CURVES_COEFFS2 [
|
CURVES_COEFFS2 [
|
||||||
Attenuation0dB => [
|
Attenuation0dB => [
|
||||||
|
@ -39,10 +39,10 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get efuse block version
|
/// Get efuse block version
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/efuse_hal.c#L27-L30
|
/// see <https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/efuse_hal.c#L27-L30>
|
||||||
pub fn get_block_version() -> (u8, u8) {
|
pub fn get_block_version() -> (u8, u8) {
|
||||||
// see https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/esp32c2/include/hal/efuse_ll.h#L65-L73
|
// see <https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/esp32c2/include/hal/efuse_ll.h#L65-L73>
|
||||||
// https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L90-L91
|
// <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L90-L91>
|
||||||
(
|
(
|
||||||
Self::read_field_le::<u8>(BLK_VERSION_MAJOR),
|
Self::read_field_le::<u8>(BLK_VERSION_MAJOR),
|
||||||
Self::read_field_le::<u8>(BLK_VERSION_MINOR),
|
Self::read_field_le::<u8>(BLK_VERSION_MINOR),
|
||||||
@ -51,7 +51,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get version of RTC calibration block
|
/// Get version of RTC calibration block
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L14
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L14>
|
||||||
pub fn get_rtc_calib_version() -> u8 {
|
pub fn get_rtc_calib_version() -> u8 {
|
||||||
let (major, _minor) = Self::get_block_version();
|
let (major, _minor) = Self::get_block_version();
|
||||||
if major == 0 {
|
if major == 0 {
|
||||||
@ -63,7 +63,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC initial code for specified attenuation from efuse
|
/// Get ADC initial code for specified attenuation from efuse
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L27
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L27>
|
||||||
pub fn get_rtc_calib_init_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
pub fn get_rtc_calib_init_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
||||||
let version = Self::get_rtc_calib_version();
|
let version = Self::get_rtc_calib_version();
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ impl Efuse {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L94
|
// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L94>
|
||||||
let diff_code0: u16 = Self::read_field_le(ADC1_INIT_CODE_ATTEN0);
|
let diff_code0: u16 = Self::read_field_le(ADC1_INIT_CODE_ATTEN0);
|
||||||
let code0 = if diff_code0 & (1 << 7) != 0 {
|
let code0 = if diff_code0 & (1 << 7) != 0 {
|
||||||
2160 - (diff_code0 & 0x7f)
|
2160 - (diff_code0 & 0x7f)
|
||||||
@ -83,7 +83,7 @@ impl Efuse {
|
|||||||
return Some(code0);
|
return Some(code0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L95
|
// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L95>
|
||||||
let diff_code11: u16 = Self::read_field_le(ADC1_INIT_CODE_ATTEN3);
|
let diff_code11: u16 = Self::read_field_le(ADC1_INIT_CODE_ATTEN3);
|
||||||
let code11 = code0 + diff_code11;
|
let code11 = code0 + diff_code11;
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC reference point voltage for specified attenuation in millivolts
|
/// Get ADC reference point voltage for specified attenuation in millivolts
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L65
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L65>
|
||||||
pub fn get_rtc_calib_cal_mv(_unit: u8, atten: Attenuation) -> u16 {
|
pub fn get_rtc_calib_cal_mv(_unit: u8, atten: Attenuation) -> u16 {
|
||||||
match atten {
|
match atten {
|
||||||
Attenuation::Attenuation0dB => 400,
|
Attenuation::Attenuation0dB => 400,
|
||||||
@ -102,7 +102,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC reference point digital code for specified attenuation
|
/// Get ADC reference point digital code for specified attenuation
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L65
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_rtc_calib.c#L65>
|
||||||
pub fn get_rtc_calib_cal_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
pub fn get_rtc_calib_cal_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
||||||
let version = Self::get_rtc_calib_version();
|
let version = Self::get_rtc_calib_version();
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ impl Efuse {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L96
|
// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L96>
|
||||||
let diff_code0: u16 = Self::read_field_le(ADC1_CAL_VOL_ATTEN0);
|
let diff_code0: u16 = Self::read_field_le(ADC1_CAL_VOL_ATTEN0);
|
||||||
let code0 = if diff_code0 & (1 << 7) != 0 {
|
let code0 = if diff_code0 & (1 << 7) != 0 {
|
||||||
1540 - (diff_code0 & 0x7f)
|
1540 - (diff_code0 & 0x7f)
|
||||||
@ -122,7 +122,7 @@ impl Efuse {
|
|||||||
return Some(code0);
|
return Some(code0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L97
|
// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c2/esp_efuse_table.csv#L97>
|
||||||
let diff_code11: u16 = Self::read_field_le(ADC1_CAL_VOL_ATTEN3);
|
let diff_code11: u16 = Self::read_field_le(ADC1_CAL_VOL_ATTEN3);
|
||||||
let code11 = if diff_code0 & (1 << 5) != 0 {
|
let code11 = if diff_code0 & (1 << 5) != 0 {
|
||||||
code0 - (diff_code11 & 0x1f)
|
code0 - (diff_code11 & 0x1f)
|
||||||
|
@ -39,11 +39,11 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get efuse block version
|
/// Get efuse block version
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/efuse_hal.c#L27-L30
|
/// see <https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/efuse_hal.c#L27-L30>
|
||||||
pub fn get_block_version() -> (u8, u8) {
|
pub fn get_block_version() -> (u8, u8) {
|
||||||
// see https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/esp32c3/include/hal/efuse_ll.h#L70-L78
|
// see <https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/esp32c3/include/hal/efuse_ll.h#L70-L78>
|
||||||
// https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L163
|
// <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L163>
|
||||||
// https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L173
|
// <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L173>
|
||||||
(
|
(
|
||||||
Self::read_field_le::<u8>(BLK_VERSION_MAJOR),
|
Self::read_field_le::<u8>(BLK_VERSION_MAJOR),
|
||||||
Self::read_field_le::<u8>(BLK_VERSION_MINOR),
|
Self::read_field_le::<u8>(BLK_VERSION_MINOR),
|
||||||
@ -52,7 +52,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get version of RTC calibration block
|
/// Get version of RTC calibration block
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L12
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L12>
|
||||||
pub fn get_rtc_calib_version() -> u8 {
|
pub fn get_rtc_calib_version() -> u8 {
|
||||||
let (major, _minor) = Self::get_block_version();
|
let (major, _minor) = Self::get_block_version();
|
||||||
if major == 1 {
|
if major == 1 {
|
||||||
@ -64,7 +64,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC initial code for specified attenuation from efuse
|
/// Get ADC initial code for specified attenuation from efuse
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L25
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L25>
|
||||||
pub fn get_rtc_calib_init_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
pub fn get_rtc_calib_init_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
||||||
let version = Self::get_rtc_calib_version();
|
let version = Self::get_rtc_calib_version();
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ impl Efuse {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L176-L179
|
// See <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L176-L179>
|
||||||
let init_code: u16 = Self::read_field_le(match atten {
|
let init_code: u16 = Self::read_field_le(match atten {
|
||||||
Attenuation::Attenuation0dB => ADC1_INIT_CODE_ATTEN0,
|
Attenuation::Attenuation0dB => ADC1_INIT_CODE_ATTEN0,
|
||||||
Attenuation::Attenuation2p5dB => ADC1_INIT_CODE_ATTEN1,
|
Attenuation::Attenuation2p5dB => ADC1_INIT_CODE_ATTEN1,
|
||||||
@ -85,7 +85,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC reference point voltage for specified attenuation in millivolts
|
/// Get ADC reference point voltage for specified attenuation in millivolts
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L49
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L49>
|
||||||
pub fn get_rtc_calib_cal_mv(_unit: u8, atten: Attenuation) -> u16 {
|
pub fn get_rtc_calib_cal_mv(_unit: u8, atten: Attenuation) -> u16 {
|
||||||
match atten {
|
match atten {
|
||||||
Attenuation::Attenuation0dB => 400,
|
Attenuation::Attenuation0dB => 400,
|
||||||
@ -97,7 +97,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC reference point digital code for specified attenuation
|
/// Get ADC reference point digital code for specified attenuation
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L49
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_rtc_calib.c#L49>
|
||||||
pub fn get_rtc_calib_cal_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
pub fn get_rtc_calib_cal_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
||||||
let version = Self::get_rtc_calib_version();
|
let version = Self::get_rtc_calib_version();
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ impl Efuse {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L180-L183
|
// See <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c3/esp_efuse_table.csv#L180-L183>
|
||||||
let cal_code: u16 = Self::read_field_le(match atten {
|
let cal_code: u16 = Self::read_field_le(match atten {
|
||||||
Attenuation::Attenuation0dB => ADC1_CAL_VOL_ATTEN0,
|
Attenuation::Attenuation0dB => ADC1_CAL_VOL_ATTEN0,
|
||||||
Attenuation::Attenuation2p5dB => ADC1_CAL_VOL_ATTEN1,
|
Attenuation::Attenuation2p5dB => ADC1_CAL_VOL_ATTEN1,
|
||||||
|
@ -39,10 +39,10 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get efuse block version
|
/// Get efuse block version
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/efuse_hal.c#L27-L30
|
/// see <https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/efuse_hal.c#L27-L30>
|
||||||
pub fn get_block_version() -> (u8, u8) {
|
pub fn get_block_version() -> (u8, u8) {
|
||||||
// see https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/esp32c6/include/hal/efuse_ll.h#L65-L73
|
// see <https://github.com/espressif/esp-idf/blob/dc016f5987/components/hal/esp32c6/include/hal/efuse_ll.h#L65-L73>
|
||||||
// https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_table.csv#L156
|
// <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_table.csv#L156>
|
||||||
(
|
(
|
||||||
Self::read_field_le::<u8>(BLK_VERSION_MAJOR),
|
Self::read_field_le::<u8>(BLK_VERSION_MAJOR),
|
||||||
Self::read_field_le::<u8>(BLK_VERSION_MINOR),
|
Self::read_field_le::<u8>(BLK_VERSION_MINOR),
|
||||||
@ -51,7 +51,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get version of RTC calibration block
|
/// Get version of RTC calibration block
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L20
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L20>
|
||||||
pub fn get_rtc_calib_version() -> u8 {
|
pub fn get_rtc_calib_version() -> u8 {
|
||||||
let (_major, minor) = Self::get_block_version();
|
let (_major, minor) = Self::get_block_version();
|
||||||
if minor >= 1 {
|
if minor >= 1 {
|
||||||
@ -63,7 +63,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC initial code for specified attenuation from efuse
|
/// Get ADC initial code for specified attenuation from efuse
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L32
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L32>
|
||||||
pub fn get_rtc_calib_init_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
pub fn get_rtc_calib_init_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
||||||
let version = Self::get_rtc_calib_version();
|
let version = Self::get_rtc_calib_version();
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ impl Efuse {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_table.csv#L147-L152
|
// See <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_table.csv#L147-L152>
|
||||||
let init_code: u16 = Self::read_field_le(match atten {
|
let init_code: u16 = Self::read_field_le(match atten {
|
||||||
Attenuation::Attenuation0dB => ADC1_INIT_CODE_ATTEN0,
|
Attenuation::Attenuation0dB => ADC1_INIT_CODE_ATTEN0,
|
||||||
Attenuation::Attenuation2p5dB => ADC1_INIT_CODE_ATTEN1,
|
Attenuation::Attenuation2p5dB => ADC1_INIT_CODE_ATTEN1,
|
||||||
@ -84,7 +84,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC reference point voltage for specified attenuation in millivolts
|
/// Get ADC reference point voltage for specified attenuation in millivolts
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L42
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L42>
|
||||||
pub fn get_rtc_calib_cal_mv(_unit: u8, atten: Attenuation) -> u16 {
|
pub fn get_rtc_calib_cal_mv(_unit: u8, atten: Attenuation) -> u16 {
|
||||||
match atten {
|
match atten {
|
||||||
Attenuation::Attenuation0dB => 400,
|
Attenuation::Attenuation0dB => 400,
|
||||||
@ -96,7 +96,7 @@ impl Efuse {
|
|||||||
|
|
||||||
/// Get ADC reference point digital code for specified attenuation
|
/// Get ADC reference point digital code for specified attenuation
|
||||||
///
|
///
|
||||||
/// see https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L42
|
/// see <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_rtc_calib.c#L42>
|
||||||
pub fn get_rtc_calib_cal_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
pub fn get_rtc_calib_cal_code(_unit: u8, atten: Attenuation) -> Option<u16> {
|
||||||
let version = Self::get_rtc_calib_version();
|
let version = Self::get_rtc_calib_version();
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ impl Efuse {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_table.csv#L153-L156
|
// See <https://github.com/espressif/esp-idf/blob/903af13e8/components/efuse/esp32c6/esp_efuse_table.csv#L153-L156>
|
||||||
let cal_code: u16 = Self::read_field_le(match atten {
|
let cal_code: u16 = Self::read_field_le(match atten {
|
||||||
Attenuation::Attenuation0dB => ADC1_CAL_VOL_ATTEN0,
|
Attenuation::Attenuation0dB => ADC1_CAL_VOL_ATTEN0,
|
||||||
Attenuation::Attenuation2p5dB => ADC1_CAL_VOL_ATTEN1,
|
Attenuation::Attenuation2p5dB => ADC1_CAL_VOL_ATTEN1,
|
||||||
|
@ -34,17 +34,16 @@
|
|||||||
//! - Use the [`SpiBus`](embedded_hal_1::spi::SpiBus) trait (requires the "eh1"
|
//! - Use the [`SpiBus`](embedded_hal_1::spi::SpiBus) trait (requires the "eh1"
|
||||||
//! feature) and its associated functions to initiate transactions with
|
//! feature) and its associated functions to initiate transactions with
|
||||||
//! simultaneous reads and writes, or
|
//! simultaneous reads and writes, or
|
||||||
//! - Use the [`SpiBusWrite`](embedded_hal_1::spi::SpiBusWrite) and
|
// TODO async moved to embedded-hal-bus:
|
||||||
//! [`SpiBusRead`](embedded_hal_1::spi::SpiBusRead) traits (requires the "eh1"
|
//! - Use the `ExclusiveDevice` struct from `embedded-hal-bus` or
|
||||||
//! feature) and their associated functions to read or write mutiple bytes at
|
//! `embedded-hal-async` (recommended).
|
||||||
//! a time.
|
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! ## Shared SPI access
|
//! ## Shared SPI access
|
||||||
//!
|
//!
|
||||||
//! If you have multiple devices on the same SPI bus that each have their own CS
|
//! If you have multiple devices on the same SPI bus that each have their own CS
|
||||||
//! line, you may want to have a look at the [`SpiBusController`] and
|
//! line, you may want to have a look at the [`ehal1::SpiBusController`] and
|
||||||
//! [`SpiBusDevice`] implemented here. These give exclusive access to the
|
//! [`ehal1::SpiBusDevice`] implemented here. These give exclusive access to the
|
||||||
//! underlying SPI bus by means of a Mutex. This ensures that device
|
//! underlying SPI bus by means of a Mutex. This ensures that device
|
||||||
//! transactions do not interfere with each other.
|
//! transactions do not interfere with each other.
|
||||||
|
|
||||||
@ -2440,7 +2439,7 @@ pub trait Instance {
|
|||||||
/// sequential transfers are performed. This function will return before
|
/// sequential transfers are performed. This function will return before
|
||||||
/// all bytes of the last chunk to transmit have been sent to the wire. If
|
/// all bytes of the last chunk to transmit have been sent to the wire. If
|
||||||
/// you must ensure that the whole messages was written correctly, use
|
/// you must ensure that the whole messages was written correctly, use
|
||||||
/// [`flush`].
|
/// [`Self::flush`].
|
||||||
// FIXME: See below.
|
// FIXME: See below.
|
||||||
fn write_bytes(&mut self, words: &[u8]) -> Result<(), Error> {
|
fn write_bytes(&mut self, words: &[u8]) -> Result<(), Error> {
|
||||||
let reg_block = self.register_block();
|
let reg_block = self.register_block();
|
||||||
@ -2504,7 +2503,7 @@ pub trait Instance {
|
|||||||
///
|
///
|
||||||
/// Sends out a stuffing byte for every byte to read. This function doesn't
|
/// Sends out a stuffing byte for every byte to read. This function doesn't
|
||||||
/// perform flushing. If you want to read the response to something you
|
/// perform flushing. If you want to read the response to something you
|
||||||
/// have written before, consider using [`transfer`] instead.
|
/// have written before, consider using [`Self::transfer`] instead.
|
||||||
fn read_bytes(&mut self, words: &mut [u8]) -> Result<(), Error> {
|
fn read_bytes(&mut self, words: &mut [u8]) -> Result<(), Error> {
|
||||||
let empty_array = [EMPTY_WRITE_PAD; FIFO_SIZE];
|
let empty_array = [EMPTY_WRITE_PAD; FIFO_SIZE];
|
||||||
|
|
||||||
@ -2520,7 +2519,7 @@ pub trait Instance {
|
|||||||
///
|
///
|
||||||
/// Copies the contents of the SPI receive FIFO into `words`. This function
|
/// Copies the contents of the SPI receive FIFO into `words`. This function
|
||||||
/// doesn't perform flushing. If you want to read the response to
|
/// doesn't perform flushing. If you want to read the response to
|
||||||
/// something you have written before, consider using [`transfer`]
|
/// something you have written before, consider using [`Self::transfer`]
|
||||||
/// instead.
|
/// instead.
|
||||||
// FIXME: Using something like `core::slice::from_raw_parts` and
|
// FIXME: Using something like `core::slice::from_raw_parts` and
|
||||||
// `copy_from_slice` on the receive registers works only for the esp32 and
|
// `copy_from_slice` on the receive registers works only for the esp32 and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user