Skip to content

Commit

Permalink
Get docs buildable
Browse files Browse the repository at this point in the history
rustfmt
  • Loading branch information
playfulFence committed Jun 28, 2024
1 parent b50e3a7 commit b05d194
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 11 additions & 11 deletions esp-hal/src/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,29 +131,29 @@ impl rand_core::RngCore for Rng {
/// Due to pulling the entropy source from the ADC, it uses the associated
/// regiters, so to use TRNG we need to "occupy" the ADC peripheral.
///
/// ```no_run
/// let analog_pin = io.pins.gpio3.into_analog();
/// let mut adc1_config = AdcConfig::new();
/// let mut adc1_pin = adc1_config.enable_pin(analog_pin, Attenuation::Attenuation11dB);
/// let mut adc1 = ADC::<ADC1>::new(peripherals.ADC1, adc1_config);
/// let pin_value: u16 = nb::block!(adc1.read_oneshot(&mut adc1_pin)).unwrap();
///
/// ```rust, ignore
/// let mut buf = [0u8; 16];
/// let mut trng = Trng::new(peripherals.RNG, &mut adc1);
/// let mut trng = Trng::new(peripherals.RNG, &mut peripherals.ADC1);
/// trng.read(&mut buf);
///
/// println!("TRNG: Random bytes: {:?}", buf);
/// println!("TRNG: Random u32: {}", rng.random());
/// println!("TRNG: Random u32: {}", rng.random());
///
/// let mut rng = trng.downgrade();
///
/// let analog_pin = io.pins.gpio3;
/// let mut adc1_config = AdcConfig::new();
/// let mut adc1_pin = adc1_config.enable_pin(analog_pin, Attenuation::Attenuation11dB);
/// let mut adc1 = Adc::<ADC1>::new(peripherals.ADC1, adc1_config);
/// let pin_value: u16 = nb::block!(adc1.read_oneshot(&mut adc1_pin)).unwrap();
///
/// rng.read(&mut buf);
/// println!("Random bytes: {:?}", buf);
///
/// println!("Random u32: {}", rng.random());
/// println!("Random u32: {}", rng.random());
/// let pin_value: u16 = nb::block!(adc1.read_oneshot(&mut adc1_pin)).unwrap();
/// println!("ADC reading = {}", pin_value);
/// ```

pub struct Trng<'d> {
/// The hardware random number generator instance.
pub rng: Rng,
Expand Down
2 changes: 0 additions & 2 deletions esp-hal/src/soc/esp32c6/trng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ pub(crate) fn regi2c_write_mask(block: u8, _host_id: u8, reg_add: u8, msb: u8, l
.read()
.lp_i2c_ana_mast_i2c0_busy()
.bit()
!= false
{}

temp = lp_i2c_ana
Expand All @@ -434,7 +433,6 @@ pub(crate) fn regi2c_write_mask(block: u8, _host_id: u8, reg_add: u8, msb: u8, l
.read()
.lp_i2c_ana_mast_i2c0_busy()
.bit()
!= false
{}

regi2c_disable_block(block);
Expand Down

0 comments on commit b05d194

Please sign in to comment.