diff --git a/examples/hpm5300evk/src/bin/adc.rs b/examples/hpm5300evk/src/bin/adc.rs index 7b32299..504f276 100644 --- a/examples/hpm5300evk/src/bin/adc.rs +++ b/examples/hpm5300evk/src/bin/adc.rs @@ -58,11 +58,17 @@ async fn main(spawner: Spawner) -> ! { loop { Timer::after_millis(200).await; - // defmt::info!("tick {}", MCHTMR.mtime().read()); + // let n = adc.blocking_read(&mut adc_ch7_pin, Default::default()); + let mut sum = 0; + for _ in 0..1000 { + let n = adc.blocking_read(&mut adc_ch7_pin, Default::default()); + sum += n as u32; + } + let n = sum / 1000; - let n = adc.blocking_read(&mut adc_ch7_pin, Default::default()); + let voltage = (n as u32) * 3300 / 65536; - println!("ADC0_CH7: {}", n); + println!("ADC0_CH7: {} {}mV", n, voltage); } } diff --git a/examples/hpm5300evk/src/bin/blinky.rs b/examples/hpm5300evk/src/bin/blinky.rs index c89ab6b..d9bbb17 100644 --- a/examples/hpm5300evk/src/bin/blinky.rs +++ b/examples/hpm5300evk/src/bin/blinky.rs @@ -4,7 +4,7 @@ use embedded_hal::delay::DelayNs; use hal::gpio::{Level, Output, Speed}; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal}; #[hal::entry] fn main() -> ! { diff --git a/examples/hpm5300evk/src/bin/blocking_uart_tx.rs b/examples/hpm5300evk/src/bin/blocking_uart_tx.rs index adda6d7..6a08a96 100644 --- a/examples/hpm5300evk/src/bin/blocking_uart_tx.rs +++ b/examples/hpm5300evk/src/bin/blocking_uart_tx.rs @@ -6,7 +6,7 @@ use embedded_io::Write as _; // `writeln!` provider use hpm_hal::gpio::{Level, Output, Speed}; use hpm_hal::uart::UartTx; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, panic_halt as _, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal, panic_halt as _}; const BANNER: &str = include_str!("../../../assets/BANNER"); diff --git a/examples/hpm5300evk/src/bin/button.rs b/examples/hpm5300evk/src/bin/button.rs index 945a124..b916f36 100644 --- a/examples/hpm5300evk/src/bin/button.rs +++ b/examples/hpm5300evk/src/bin/button.rs @@ -4,9 +4,9 @@ use embedded_hal::delay::DelayNs; use hpm_hal::gpio::{Input, Pull}; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, panic_halt as _, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal, panic_halt as _}; -#[riscv_rt::entry] +#[hal::entry] fn main() -> ! { let p = hal::init(Default::default()); diff --git a/examples/hpm5300evk/src/bin/i2c_oled.rs b/examples/hpm5300evk/src/bin/i2c_oled.rs index aa27552..1a83a9c 100644 --- a/examples/hpm5300evk/src/bin/i2c_oled.rs +++ b/examples/hpm5300evk/src/bin/i2c_oled.rs @@ -13,7 +13,7 @@ use hal::gpio::{Level, Output, Speed}; use hal::i2c::I2c; use hal::mode::Blocking; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal}; const BANNER: &str = include_str!("../../../assets/BANNER"); diff --git a/examples/hpm5300evk/src/bin/pll_setting.rs b/examples/hpm5300evk/src/bin/pll_setting.rs index bafd191..ead9e4b 100644 --- a/examples/hpm5300evk/src/bin/pll_setting.rs +++ b/examples/hpm5300evk/src/bin/pll_setting.rs @@ -8,7 +8,7 @@ use hal::pac; use hal::uart::UartTx; use hpm_hal::time::Hertz; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, panic_halt as _, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal, panic_halt as _}; const BANNER: &str = include_str!("../../../assets/BANNER"); diff --git a/examples/hpm5300evk/src/bin/qspi.rs b/examples/hpm5300evk/src/bin/qspi.rs index 88779af..2db0664 100644 --- a/examples/hpm5300evk/src/bin/qspi.rs +++ b/examples/hpm5300evk/src/bin/qspi.rs @@ -23,7 +23,7 @@ use hpm_hal::spi::{ }; use hpm_hal::time::Hertz; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal}; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] pub enum Orientation { diff --git a/examples/hpm5300evk/src/bin/spi.rs b/examples/hpm5300evk/src/bin/spi.rs index 419ad6b..2383abe 100644 --- a/examples/hpm5300evk/src/bin/spi.rs +++ b/examples/hpm5300evk/src/bin/spi.rs @@ -23,7 +23,7 @@ use hpm_hal::mode::Blocking; use hpm_hal::spi::{Config, Spi}; use hpm_hal::time::Hertz; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, panic_halt as _, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal, panic_halt as _}; pub struct ST7789< Spi: SpiDevice, diff --git a/examples/hpm5300evk/src/bin/tsns.rs b/examples/hpm5300evk/src/bin/tsns.rs index a6cc7b1..656a917 100644 --- a/examples/hpm5300evk/src/bin/tsns.rs +++ b/examples/hpm5300evk/src/bin/tsns.rs @@ -8,7 +8,7 @@ use hal::gpio::{Level, Output, Speed}; use hal::pac; use hpm_hal::time::Hertz; use riscv::delay::McycleDelay; -use {defmt_rtt as _, hpm_hal as hal, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal}; const BANNER: &str = include_str!("../../../assets/BANNER"); diff --git a/examples/hpm5300evk/src/bin/usb.rs b/examples/hpm5300evk/src/bin/usb.rs index 003e3e9..3221109 100644 --- a/examples/hpm5300evk/src/bin/usb.rs +++ b/examples/hpm5300evk/src/bin/usb.rs @@ -12,7 +12,7 @@ use embassy_usb::Builder; use futures_util::future::join; use hal::usb::{Instance, UsbDriver}; use hpm_hal::{bind_interrupts, peripherals}; -use {defmt_rtt as _, hpm_hal as hal, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal}; bind_interrupts!(struct Irqs { USB0 => hal::usb::InterruptHandler; diff --git a/examples/hpm5300evk/src/bin/usb_hid.rs b/examples/hpm5300evk/src/bin/usb_hid.rs index 0b0fa5f..e1f24d7 100644 --- a/examples/hpm5300evk/src/bin/usb_hid.rs +++ b/examples/hpm5300evk/src/bin/usb_hid.rs @@ -16,7 +16,7 @@ use hpm_hal::gpio::{Input, Pull}; use hpm_hal::{bind_interrupts, peripherals}; use static_cell::StaticCell; use usbd_hid::descriptor::{KeyboardReport, SerializedDescriptor}; -use {defmt_rtt as _, hpm_hal as hal, riscv_rt as _}; +use {defmt_rtt as _, hpm_hal as hal}; bind_interrupts!(struct Irqs { USB0 => hal::usb::InterruptHandler;