Trait stabilizer::hardware::pounder::attenuators::AttenuatorInterface
source · pub trait AttenuatorInterface {
// Required methods
fn reset_attenuators(&mut self) -> Result<(), Error>;
fn latch_attenuator(&mut self, channel: Channel) -> Result<(), Error>;
fn transfer_attenuators(
&mut self,
channels: &mut [u8; 4]
) -> Result<(), Error>;
// Provided methods
fn set_attenuation(
&mut self,
channel: Channel,
attenuation: f32
) -> Result<f32, Error> { ... }
fn get_attenuation(&mut self, channel: Channel) -> Result<f32, Error> { ... }
fn validate(attenuation: f32) -> Result<f32, Error> { ... }
}
Expand description
Provide an interface for managing digital attenuators on Pounder hardware.
Note: The digital attenuators do not allow read-back of attenuation. To circumvent this, this driver maintains the attenuation code in both the shift register as well as the latched output register of the attenuators. This allows the “active” attenuation code to be read back by reading the shfit register. The downside of this approach is that any read is destructive, so a read-writeback approach is employed.
Required Methods§
fn reset_attenuators(&mut self) -> Result<(), Error>
fn latch_attenuator(&mut self, channel: Channel) -> Result<(), Error>
fn transfer_attenuators(&mut self, channels: &mut [u8; 4]) -> Result<(), Error>
Provided Methods§
sourcefn set_attenuation(
&mut self,
channel: Channel,
attenuation: f32
) -> Result<f32, Error>
fn set_attenuation( &mut self, channel: Channel, attenuation: f32 ) -> Result<f32, Error>
Set the attenuation of a single channel.
Args:
channel
- The pounder channel to configure the attenuation of.attenuation
- The desired attenuation of the channel in dB. This has a resolution of 0.5dB.
sourcefn get_attenuation(&mut self, channel: Channel) -> Result<f32, Error>
fn get_attenuation(&mut self, channel: Channel) -> Result<f32, Error>
Get the attenuation of a channel.
Args:
channel
- The channel to get the attenuation of.
Returns: The programmed attenuation of the channel in dB.
fn validate(attenuation: f32) -> Result<f32, Error>
Object Safety§
This trait is not object safe.