From 4169cd82515e38bbeae5033ae91f56047077bbb8 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Thu, 29 Apr 2021 16:22:06 +0200 Subject: [PATCH] Adding AFE functions --- src/hardware/afe.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/hardware/afe.rs b/src/hardware/afe.rs index 9e3674b..836a3d0 100644 --- a/src/hardware/afe.rs +++ b/src/hardware/afe.rs @@ -20,6 +20,18 @@ pub struct ProgrammableGainAmplifier { 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 for Gain { type Error = ();