Skip to content

Commit

Permalink
ADC: Add initializer based on line number
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Oct 20, 2023
1 parent 2643368 commit ddf9265
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ impl ADCLine {
e => Err(e),
}
}

/// Initialize an ADC line identified by the line number it is assigned on the board
///
/// Safety: See [init]
pub unsafe fn from_number(line: u32) -> Result<Self, i32> {
let line = riot_sys::macro_ADC_LINE(line);
Self::init(line)
}
}

/// A configured representation of the single operating-system level ADC that RIOT exposes via its
Expand Down

0 comments on commit ddf9265

Please # to comment.