Skip to content

Commit 5afbbab

Browse files
authored
Merge pull request #425 from BartMassey-upstream/doc-temp-measure
documented to_num() for Temp::measure() result
2 parents 939c017 + 604e982 commit 5afbbab

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

nrf-hal-common/src/temp.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ impl Temp {
2020
/// Starts a new measurement and blocks until completion.
2121
///
2222
/// If a measurement was already started, it will be canceled.
23+
///
24+
/// Returns the measured temperature in °C.
25+
///
26+
/// Note: This return type is [fixed::types::I30F2]. It
27+
/// can be converted into [f32] or [f64] (or other numeric types)
28+
/// via the `to_num()` method.
29+
///
30+
/// # Examples
31+
///
32+
/// ```ignore
33+
/// let mut temp = Temp::new(board.TEMP);
34+
/// let deg_c: f32 = temp.measure().to_num();
35+
/// ```
2336
pub fn measure(&mut self) -> I30F2 {
2437
self.stop_measurement();
2538
self.start_measurement();

0 commit comments

Comments
 (0)