Adding AFE functions

master
Ryan Summers 2021-04-29 16:22:06 +02:00
parent e746e2a12c
commit 4169cd8251
1 changed files with 12 additions and 0 deletions

View File

@ -20,6 +20,18 @@ pub struct ProgrammableGainAmplifier<A0, A1> {
a1: A1,
}
impl Gain {
/// Get the AFE gain as a multiplying integer.
pub fn to_multiplier(&self) -> u8 {
match self {
Gain::G1 => 1,
Gain::G2 => 2,
Gain::G5 => 5,
Gain::G10 => 10,
}
}
}
impl TryFrom<u8> for Gain {
type Error = ();