Skip to content

Commit

Permalink
/unit_count/unit_value/g
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev committed Nov 21, 2024
1 parent c1d5a62 commit b8e29a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- ESP32-S3: Added SDMMC signals (#2556)
- `dma::{Channel, ChannelRx, ChannelTx}::set_priority` for GDMA devices (#2403)
- `SystemTimer::set_unit_count` & `SystemTimer::configure_unit` (#2576)
- `SystemTimer::set_unit_value` & `SystemTimer::configure_unit` (#2576)

### Changed

- `SystemTimer` no longer uses peripheral ref (#2576)
- `SystemTimer::now` has been renamed `SystemTimer::unit_count(Unit)` (#2576)
- `SystemTimer::now` has been renamed `SystemTimer::unit_value(Unit)` (#2576)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion esp-hal/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn now() -> Instant {
let (ticks, div) = {
use crate::timer::systimer::{SystemTimer, Unit};
// otherwise use SYSTIMER
let ticks = SystemTimer::unit_count(Unit::Unit0);
let ticks = SystemTimer::unit_value(Unit::Unit0);
(ticks, (SystemTimer::ticks_per_second() / 1_000_000))
};

Expand Down
4 changes: 2 additions & 2 deletions esp-hal/src/timer/systimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl SystemTimer {
}

/// Get the current count of the given unit in the System Timer.
pub fn unit_count(unit: Unit) -> u64 {
pub fn unit_value(unit: Unit) -> u64 {
// This should be safe to access from multiple contexts
// worst case scenario the second accessor ends up reading
// an older time stamp
Expand Down Expand Up @@ -142,7 +142,7 @@ impl SystemTimer {
/// unexpected behaviour
/// - Any modification of the unit0 count will affect
/// [`now`](crate::time::now).
pub unsafe fn set_unit_count(unit: Unit, value: u64) {
pub unsafe fn set_unit_value(unit: Unit, value: u64) {
unit.set_count(value)
}
}
Expand Down

0 comments on commit b8e29a9

Please sign in to comment.