mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-28 12:50:53 +00:00
[1/3] Timer abstraction: refactor systimer
and timer
modules into a common timer
module (#1527)
* Refactor `systimer` and `timer` modules into a common `timer` module * Update `CHANGELOG.md` * Rebase and update new example
This commit is contained in:
parent
fd1c7b4fc7
commit
68a4fb29ed
@ -6,11 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Updated example on i2c to use the new `interrupt_handler` parameter (#1376)
|
- Updated example on i2c to use the new `interrupt_handler` parameter (#1376)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- i2c: implement `I2C:transaction` for `embedded-hal` and `embedded-hal-async`
|
- i2c: implement `I2C:transaction` for `embedded-hal` and `embedded-hal-async`
|
||||||
- ESP32-PICO-V3-02: Initial support (#1155)
|
- ESP32-PICO-V3-02: Initial support (#1155)
|
||||||
- `time::current_time` API (#1503)
|
- `time::current_time` API (#1503)
|
||||||
- ESP32-S3: Add LCD_CAM Camera driver (#1483)
|
- ESP32-S3: Add LCD_CAM Camera driver (#1483)
|
||||||
@ -30,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- RNG is no longer TRNG, the `CryptoRng` implementation has been removed. To track this being re-added see #1499 (#1498)
|
- RNG is no longer TRNG, the `CryptoRng` implementation has been removed. To track this being re-added see #1499 (#1498)
|
||||||
- Make software interrupts shareable (#1500)
|
- Make software interrupts shareable (#1500)
|
||||||
- The `SystemParts` struct has been renamed to `SystemControl`, and now has a constructor which takes the `SYSTEM` peripheral (#1495)
|
- The `SystemParts` struct has been renamed to `SystemControl`, and now has a constructor which takes the `SYSTEM` peripheral (#1495)
|
||||||
|
- Timer abstraction: refactor `systimer` and `timer` modules into a common `timer` module (#1527)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ impl embedded_hal::delay::DelayNs for Delay {
|
|||||||
#[cfg(riscv)]
|
#[cfg(riscv)]
|
||||||
mod implementation {
|
mod implementation {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{clock::Clocks, systimer::SystemTimer};
|
use crate::{clock::Clocks, timer::systimer::SystemTimer};
|
||||||
|
|
||||||
impl Delay {
|
impl Delay {
|
||||||
/// Create a new `Delay` instance
|
/// Create a new `Delay` instance
|
||||||
|
@ -5,7 +5,7 @@ use super::AlarmState;
|
|||||||
use crate::{
|
use crate::{
|
||||||
clock::Clocks,
|
clock::Clocks,
|
||||||
peripherals,
|
peripherals,
|
||||||
systimer::{Alarm, SystemTimer, Target},
|
timer::systimer::{Alarm, SystemTimer, Target},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ALARM_COUNT: usize = 3;
|
pub const ALARM_COUNT: usize = 3;
|
||||||
|
@ -3,12 +3,12 @@ use peripherals::TIMG0;
|
|||||||
|
|
||||||
use super::AlarmState;
|
use super::AlarmState;
|
||||||
#[cfg(any(esp32, esp32s2, esp32s3))]
|
#[cfg(any(esp32, esp32s2, esp32s3))]
|
||||||
use crate::timer::Timer1;
|
use crate::timer::timg::Timer1;
|
||||||
use crate::{
|
use crate::{
|
||||||
clock::Clocks,
|
clock::Clocks,
|
||||||
peripherals,
|
peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
timer::{Instance, Timer0, TimerGroup},
|
timer::timg::{Instance, Timer0, TimerGroup},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(any(esp32, esp32s2, esp32s3)))]
|
#[cfg(not(any(esp32, esp32s2, esp32s3)))]
|
||||||
|
@ -151,10 +151,8 @@ pub mod sha;
|
|||||||
pub mod spi;
|
pub mod spi;
|
||||||
#[cfg(any(dport, hp_sys, pcr, system))]
|
#[cfg(any(dport, hp_sys, pcr, system))]
|
||||||
pub mod system;
|
pub mod system;
|
||||||
#[cfg(systimer)]
|
|
||||||
pub mod systimer;
|
|
||||||
pub mod time;
|
pub mod time;
|
||||||
#[cfg(any(timg0, timg1))]
|
#[cfg(any(systimer, timg0, timg1))]
|
||||||
pub mod timer;
|
pub mod timer;
|
||||||
#[cfg(trace0)]
|
#[cfg(trace0)]
|
||||||
pub mod trace;
|
pub mod trace;
|
||||||
|
@ -37,9 +37,9 @@ pub use crate::ledc::{
|
|||||||
timer::{TimerHW as _esp_hal_ledc_timer_TimerHW, TimerIFace as _esp_hal_ledc_timer_TimerIFace},
|
timer::{TimerHW as _esp_hal_ledc_timer_TimerHW, TimerIFace as _esp_hal_ledc_timer_TimerIFace},
|
||||||
};
|
};
|
||||||
#[cfg(any(timg0, timg1))]
|
#[cfg(any(timg0, timg1))]
|
||||||
pub use crate::timer::{
|
pub use crate::timer::timg::{
|
||||||
Instance as _esp_hal_timer_Instance,
|
Instance as _esp_hal_timer_timg_Instance,
|
||||||
TimerGroupInstance as _esp_hal_timer_TimerGroupInstance,
|
TimerGroupInstance as _esp_hal_timer_timg_TimerGroupInstance,
|
||||||
};
|
};
|
||||||
#[cfg(any(uart0, uart1, uart2))]
|
#[cfg(any(uart0, uart1, uart2))]
|
||||||
pub use crate::uart::{Instance as _esp_hal_uart_Instance, UartPins as _esp_hal_uart_UartPins};
|
pub use crate::uart::{Instance as _esp_hal_uart_Instance, UartPins as _esp_hal_uart_UartPins};
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
use core::ptr::addr_of_mut;
|
use core::ptr::addr_of_mut;
|
||||||
|
|
||||||
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
||||||
use crate::{rtc_cntl::Rtc, timer::Wdt};
|
use crate::{rtc_cntl::Rtc, timer::timg::Wdt};
|
||||||
|
|
||||||
pub mod cpu_control;
|
pub mod cpu_control;
|
||||||
pub mod efuse;
|
pub mod efuse;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//! for interacting with various system-related peripherals on `ESP32-C2` chip.
|
//! for interacting with various system-related peripherals on `ESP32-C2` chip.
|
||||||
|
|
||||||
use self::peripherals::{LPWR, TIMG0};
|
use self::peripherals::{LPWR, TIMG0};
|
||||||
use crate::{rtc_cntl::Rtc, timer::Wdt};
|
use crate::{rtc_cntl::Rtc, timer::timg::Wdt};
|
||||||
|
|
||||||
pub mod efuse;
|
pub mod efuse;
|
||||||
pub mod gpio;
|
pub mod gpio;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
//! * I2S_DEFAULT_CLK_SRC: 2 - I2S clock source
|
//! * I2S_DEFAULT_CLK_SRC: 2 - I2S clock source
|
||||||
|
|
||||||
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
||||||
use crate::{rtc_cntl::Rtc, timer::Wdt};
|
use crate::{rtc_cntl::Rtc, timer::timg::Wdt};
|
||||||
|
|
||||||
pub mod efuse;
|
pub mod efuse;
|
||||||
pub mod gpio;
|
pub mod gpio;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//! * I2S_SCLK: 160_000_000 - I2S clock frequency
|
//! * I2S_SCLK: 160_000_000 - I2S clock frequency
|
||||||
|
|
||||||
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
||||||
use crate::{rtc_cntl::Rtc, timer::Wdt};
|
use crate::{rtc_cntl::Rtc, timer::timg::Wdt};
|
||||||
|
|
||||||
pub mod efuse;
|
pub mod efuse;
|
||||||
pub mod gpio;
|
pub mod gpio;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
//! * I2S_SCLK: 96_000_000 - I2S clock frequency
|
//! * I2S_SCLK: 96_000_000 - I2S clock frequency
|
||||||
|
|
||||||
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
||||||
use crate::{rtc_cntl::Rtc, timer::Wdt};
|
use crate::{rtc_cntl::Rtc, timer::timg::Wdt};
|
||||||
|
|
||||||
pub mod efuse;
|
pub mod efuse;
|
||||||
pub mod gpio;
|
pub mod gpio;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
use core::ptr::addr_of_mut;
|
use core::ptr::addr_of_mut;
|
||||||
|
|
||||||
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
||||||
use crate::{rtc_cntl::Rtc, timer::Wdt};
|
use crate::{rtc_cntl::Rtc, timer::timg::Wdt};
|
||||||
|
|
||||||
pub mod efuse;
|
pub mod efuse;
|
||||||
pub mod gpio;
|
pub mod gpio;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
use core::ptr::addr_of_mut;
|
use core::ptr::addr_of_mut;
|
||||||
|
|
||||||
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
use self::peripherals::{LPWR, TIMG0, TIMG1};
|
||||||
use crate::{rtc_cntl::Rtc, timer::Wdt};
|
use crate::{rtc_cntl::Rtc, timer::timg::Wdt};
|
||||||
|
|
||||||
pub mod cpu_control;
|
pub mod cpu_control;
|
||||||
pub mod efuse;
|
pub mod efuse;
|
||||||
|
@ -42,10 +42,10 @@ pub fn current_time() -> fugit::Instant<u64, 1, 1_000_000> {
|
|||||||
#[cfg(not(esp32))]
|
#[cfg(not(esp32))]
|
||||||
let (ticks, div) = {
|
let (ticks, div) = {
|
||||||
// otherwise use SYSTIMER
|
// otherwise use SYSTIMER
|
||||||
let ticks = crate::systimer::SystemTimer::now();
|
let ticks = crate::timer::systimer::SystemTimer::now();
|
||||||
(
|
(
|
||||||
ticks,
|
ticks,
|
||||||
(crate::systimer::SystemTimer::TICKS_PER_SECOND / 1_000_000),
|
(crate::timer::systimer::SystemTimer::TICKS_PER_SECOND / 1_000_000),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
6
esp-hal/src/timer/mod.rs
Normal file
6
esp-hal/src/timer/mod.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//! General-purpose timers.
|
||||||
|
|
||||||
|
#[cfg(systimer)]
|
||||||
|
pub mod systimer;
|
||||||
|
#[cfg(any(timg0, timg1))]
|
||||||
|
pub mod timg;
|
@ -23,7 +23,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rng::Rng,
|
rng::Rng,
|
||||||
systimer::SystemTimer,
|
timer::systimer::SystemTimer,
|
||||||
};
|
};
|
||||||
use esp_println::{print, println};
|
use esp_println::{print, println};
|
||||||
use hex_literal::hex;
|
use hex_literal::hex;
|
||||||
|
@ -19,7 +19,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
|
@ -21,7 +21,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
systimer::SystemTimer,
|
timer::systimer::SystemTimer,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
|
@ -28,7 +28,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use lis3dh_async::{Lis3dh, Range, SlaveAddr};
|
use lis3dh_async::{Lis3dh, Range, SlaveAddr};
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[main]
|
#[main]
|
||||||
|
@ -30,7 +30,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use static_cell::make_static;
|
use static_cell::make_static;
|
||||||
|
@ -25,7 +25,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use static_cell::make_static;
|
use static_cell::make_static;
|
||||||
|
@ -32,7 +32,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use static_cell::make_static;
|
use static_cell::make_static;
|
||||||
|
@ -23,7 +23,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ async fn main(spawner: Spawner) {
|
|||||||
let system = SystemControl::new(peripherals.SYSTEM);
|
let system = SystemControl::new(peripherals.SYSTEM);
|
||||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
||||||
|
|
||||||
let timer_group0 = esp_hal::timer::TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
let timer_group0 = esp_hal::timer::timg::TimerGroup::new_async(peripherals.TIMG0, &clocks);
|
||||||
embassy::init(&clocks, timer_group0);
|
embassy::init(&clocks, timer_group0);
|
||||||
|
|
||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
|
@ -20,7 +20,7 @@ use esp_hal::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
rmt::{asynch::TxChannelAsync, PulseCode, Rmt, TxChannelConfig, TxChannelCreatorAsync},
|
rmt::{asynch::TxChannelAsync, PulseCode, Rmt, TxChannelConfig, TxChannelCreatorAsync},
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ use esp_hal::{
|
|||||||
peripherals::{Peripherals, UART0},
|
peripherals::{Peripherals, UART0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
uart::{config::AtCmdConfig, Uart, UartRx, UartTx},
|
uart::{config::AtCmdConfig, Uart, UartRx, UartTx},
|
||||||
Async,
|
Async,
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,7 @@ use esp_hal::{
|
|||||||
SpiMode,
|
SpiMode,
|
||||||
},
|
},
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[main]
|
#[main]
|
||||||
|
@ -18,8 +18,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
systimer::SystemTimer,
|
timer::{systimer::SystemTimer, timg::TimerGroup},
|
||||||
timer::TimerGroup,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[main]
|
#[main]
|
||||||
|
@ -29,7 +29,7 @@ use esp_hal::{
|
|||||||
peripherals::{self, Peripherals, TWAI0},
|
peripherals::{self, Peripherals, TWAI0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
twai::{self, EspTwaiFrame, TwaiRx, TwaiTx},
|
twai::{self, EspTwaiFrame, TwaiRx, TwaiTx},
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
@ -27,7 +27,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[main]
|
#[main]
|
||||||
|
@ -18,7 +18,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
usb_serial_jtag::{UsbSerialJtag, UsbSerialJtagRx, UsbSerialJtagTx},
|
usb_serial_jtag::{UsbSerialJtag, UsbSerialJtagRx, UsbSerialJtagTx},
|
||||||
Async,
|
Async,
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[main]
|
#[main]
|
||||||
|
@ -11,7 +11,7 @@ use esp_hal::{
|
|||||||
gpio::{etm::GpioEtmChannels, Io},
|
gpio::{etm::GpioEtmChannels, Io},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
systimer::{etm::SysTimerEtmEvent, SystemTimer},
|
timer::systimer::{etm::SysTimerEtmEvent, SystemTimer},
|
||||||
};
|
};
|
||||||
use fugit::ExtU32;
|
use fugit::ExtU32;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ use esp_hal::{
|
|||||||
peripherals::{Peripherals, TIMG0},
|
peripherals::{Peripherals, TIMG0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::{
|
timer::timg::{
|
||||||
etm::{TimerEtmEvents, TimerEtmTasks},
|
etm::{TimerEtmEvents, TimerEtmTasks},
|
||||||
Timer,
|
Timer,
|
||||||
Timer0,
|
Timer0,
|
||||||
|
@ -65,7 +65,7 @@ use esp_hal::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
rng::Rng,
|
rng::Rng,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
systimer::SystemTimer,
|
timer::systimer::SystemTimer,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use hmac::{Hmac as HmacSw, Mac};
|
use hmac::{Hmac as HmacSw, Mac};
|
||||||
|
@ -18,7 +18,7 @@ use esp_hal::{
|
|||||||
peripherals::{Interrupt, Peripherals},
|
peripherals::{Interrupt, Peripherals},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
systimer::{Alarm, Periodic, SystemTimer, Target},
|
timer::systimer::{Alarm, Periodic, SystemTimer, Target},
|
||||||
Blocking,
|
Blocking,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
@ -17,7 +17,7 @@ use esp_hal::{
|
|||||||
peripherals::{Interrupt, Peripherals, TIMG0},
|
peripherals::{Interrupt, Peripherals, TIMG0},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::{Timer, Timer0, TimerGroup, TimerInterrupts},
|
timer::timg::{Timer, Timer0, TimerGroup, TimerInterrupts},
|
||||||
};
|
};
|
||||||
|
|
||||||
static TIMER0: Mutex<RefCell<Option<Timer<Timer0<TIMG0>, esp_hal::Blocking>>>> =
|
static TIMER0: Mutex<RefCell<Option<Timer<Timer0<TIMG0>, esp_hal::Blocking>>>> =
|
||||||
|
@ -15,7 +15,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
|
@ -8,6 +8,6 @@ pub fn cycles() -> u64 {
|
|||||||
|
|
||||||
#[cfg(not(feature = "esp32"))]
|
#[cfg(not(feature = "esp32"))]
|
||||||
{
|
{
|
||||||
esp_hal::systimer::SystemTimer::now()
|
esp_hal::timer::systimer::SystemTimer::now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ use esp_hal::{
|
|||||||
macros::handler,
|
macros::handler,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
static COUNTER: Mutex<RefCell<u32>> = Mutex::new(RefCell::new(0));
|
static COUNTER: Mutex<RefCell<u32>> = Mutex::new(RefCell::new(0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user