Skip to content

Commit

Permalink
documented to_num() for Temp::measure() result
Browse files Browse the repository at this point in the history
  • Loading branch information
BartMassey committed Jul 26, 2023
1 parent 939c017 commit 604e982
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nrf-hal-common/src/temp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ impl Temp {
/// Starts a new measurement and blocks until completion.
///
/// If a measurement was already started, it will be canceled.
///
/// Returns the measured temperature in °C.
///
/// Note: This return type is [fixed::types::I30F2]. It
/// can be converted into [f32] or [f64] (or other numeric types)
/// via the `to_num()` method.
///
/// # Examples
///
/// ```ignore
/// let mut temp = Temp::new(board.TEMP);
/// let deg_c: f32 = temp.measure().to_num();
/// ```
pub fn measure(&mut self) -> I30F2 {
self.stop_measurement();
self.start_measurement();
Expand Down

0 comments on commit 604e982

Please sign in to comment.