[][src]Struct ad983x::Ad983x

pub struct Ad983x<DI, IC> { /* fields omitted */ }

AD983x direct digital synthesizer

Methods

impl<SPI, CS> Ad983x<SpiInterface<SPI, CS>, Ad9833Ad9837>[src]

pub fn new_ad9833(spi: SPI, chip_select: CS) -> Self[src]

Create a new instance of an AD9833 device. Remember to call reset() before using the device after power up.

pub fn new_ad9837(spi: SPI, chip_select: CS) -> Self[src]

Create a new instance of an AD9837 device. Remember to call reset() before using the device after power up.

impl<CommE, PinE, DI> Ad983x<DI, Ad9833Ad9837> where
    DI: SpiWrite<Error = Error<CommE, PinE>>, 
[src]

pub fn set_output_waveform(
    &mut self,
    waveform: OutputWaveform
) -> Result<(), DI::Error>
[src]

Set the output waveform

impl<SPI, CS> Ad983x<SpiInterface<SPI, CS>, Ad9834Ad9838>[src]

pub fn new_ad9834(spi: SPI, chip_select: CS) -> Self[src]

Create a new instance of an AD9834 device. Remember to call reset() before using the device after power up.

pub fn new_ad9838(spi: SPI, chip_select: CS) -> Self[src]

Create a new instance of an AD9838 device. Remember to call reset() before using the device after power up.

impl<CommE, PinE, DI> Ad983x<DI, Ad9834Ad9838> where
    DI: SpiWrite<Error = Error<CommE, PinE>>, 
[src]

pub fn set_output_waveform(
    &mut self,
    waveform: OutputWaveform
) -> Result<(), DI::Error>
[src]

Set the output waveform

Will return Error::InvalidArgument for SquareMsbOfDac and SquareMsbOfDacDiv2 as this is not available on AD9834/AD9838 devices. To set the digital output, please use

pub fn set_sign_bit_output(
    &mut self,
    configuration: SignBitOutput
) -> Result<(), DI::Error>
[src]

Set the digital output

pub fn set_control_source(
    &mut self,
    source: ControlSource
) -> Result<(), DI::Error>
[src]

Set the control source used for the functions: frequency register selection, phase register selection, reset of internal registers, and DAC power-down.

impl<SPI, CS, IC> Ad983x<SpiInterface<SPI, CS>, IC>[src]

pub fn destroy(self) -> (SPI, CS)[src]

Destroy driver instance, return SPI bus instance and CS output pin.

impl<CommE, PinE, DI, IC> Ad983x<DI, IC> where
    DI: SpiWrite<Error = Error<CommE, PinE>>, 
[src]

pub fn reset(&mut self) -> Result<(), DI::Error>[src]

Resets the internal registers and leaves the device disabled.

Note that this is ignored in AD9834/AD9838 devices if hardware pin control source is selected.

pub fn disable(&mut self) -> Result<(), DI::Error>[src]

Disable the device (enable reset)

This resets the internal registers. Note that this is ignored in AD9834/AD9838 devices if hardware pin control source is selected.

pub fn enable(&mut self) -> Result<(), DI::Error>[src]

Enable the device (disable reset)

Note that this is ignored in AD9834/AD9838 devices if hardware pin control source is selected.

pub fn set_frequency(
    &mut self,
    register: FrequencyRegister,
    value: u32
) -> Result<(), DI::Error>
[src]

Set the frequency as a 28-bit word

This will change the mode to 28-bit if it is not used. Returns Error::InvalidArgument if providing a value that does not fit in 28 bits.

pub fn set_frequency_msb(
    &mut self,
    register: FrequencyRegister,
    value: u16
) -> Result<(), DI::Error>
[src]

Set the frequency 14-bit MSBs

This will deactivate the 28-bit mode if it is not already the case. Returns Error::InvalidArgument if providing a value that does not fit in 14 bits.

pub fn set_frequency_lsb(
    &mut self,
    register: FrequencyRegister,
    value: u16
) -> Result<(), DI::Error>
[src]

Set the frequency 14-bit LSBs

This will deactivate the 28-bit mode if it is not already the case. Returns Error::InvalidArgument if providing a value that does not fit in 14 bits.

pub fn select_frequency(
    &mut self,
    register: FrequencyRegister
) -> Result<(), DI::Error>
[src]

Select the frequency register that is used

Note: this can be overriden through the FSELECT pin in AD9834/AD9838 devices if hardware pin control source is selected.

pub fn set_phase(
    &mut self,
    register: PhaseRegister,
    value: u16
) -> Result<(), DI::Error>
[src]

Set a phase register (12-bit value)

Returns Error::InvalidArgument if providing a value that does not fit in 12 bits.

pub fn select_phase(&mut self, register: PhaseRegister) -> Result<(), DI::Error>[src]

Select the phase register that is used.

Note: this can be overriden through the PSELECT pin in AD9834/AD9838 devices if hardware pin control source is selected.

pub fn set_powered_down(&mut self, config: PoweredDown) -> Result<(), DI::Error>[src]

Set device parts powered-down state.

Note: This can be overriden through the SLEEP pin in AD9834/AD9838 devices if hardware pin control source is selected.

Trait Implementations

impl<DI: Debug, IC: Debug> Debug for Ad983x<DI, IC>[src]

impl<DI: Default, IC: Default> Default for Ad983x<DI, IC>[src]

Auto Trait Implementations

impl<DI, IC> Unpin for Ad983x<DI, IC> where
    DI: Unpin,
    IC: Unpin

impl<DI, IC> Send for Ad983x<DI, IC> where
    DI: Send,
    IC: Send

impl<DI, IC> Sync for Ad983x<DI, IC> where
    DI: Sync,
    IC: Sync

impl<DI, IC> UnwindSafe for Ad983x<DI, IC> where
    DI: UnwindSafe,
    IC: UnwindSafe

impl<DI, IC> RefUnwindSafe for Ad983x<DI, IC> where
    DI: RefUnwindSafe,
    IC: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]