M5Unit-DDS 0.1.0 git rev:bcf3c40
Loading...
Searching...
No Matches
m5::unit::UnitDDS Class Reference

DDS unit with AD9833. More...

#include <unit_DDS.hpp>

Inheritance diagram for m5::unit::UnitDDS:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitDDS (const uint8_t addr=DEFAULT_ADDRESS)
 
virtual bool begin () override
 
bool readDescription (char str[7])
 Read the description.
 
Settings for begin
config_t config ()
 Gets the configration.
 
void config (const config_t &cfg)
 Set the configration.
 
Properties
uint16_t frequency0 () const
 Gets written frequency 0 (Hz)
 
uint16_t frequency1 () const
 Gets written frequency 1 (Hz)
 
Output mode
bool readMode (dds::Mode &mode)
 Read the mode.
 
bool writeMode (const dds::Mode mode)
 Write the mode.
 
Settings
bool writeFrequency (const bool select, const uint32_t freq)
 Write the frequency.
 
bool writeFrequency0 (const uint32_t freq)
 Write the frequency to bank 0.
 
bool writeFrequency1 (const uint32_t freq)
 Write the frequency to bank 1.
 
bool writePhase (const bool select, const uint16_t deg)
 Write the phase.
 
bool writePhase0 (const uint16_t deg)
 Write the phase to bank 0.
 
bool writePhase1 (const uint16_t deg)
 Write the phase to bank 1.
 
bool writeFrequencyAndPhase (const bool select_freq, const uint32_t freq, const bool select_phase, const uint16_t deg)
 Write the frequency and phase.
 
bool writeCurrent (const bool select_freq, const bool select_phase)
 Write which bank setting to use.
 
bool writeCurrentFrequency (const bool select)
 Write which bank frequency setting to use.
 
bool writeCurrentPhase (const bool select)
 Write which bank phase setting to use.
 
Operation
bool writeOutput (const dds::Mode mode, const bool select, const uint32_t freq, const uint16_t deg)
 Write mode and settings.
 
bool sleep (const bool mclk=true, const bool DAC=true)
 Sleep.
 
bool wakeup ()
 Wake up.
 
bool reset ()
 Reset.
 

Protected Member Functions

bool read_control (uint8_t &ctrl)
 
bool write_register8 (const uint8_t reg, const uint8_t v)
 

Detailed Description

DDS unit with AD9833.

Member Function Documentation

◆ readDescription()

bool m5::unit::UnitDDS::readDescription ( char str[7])

Read the description.

Parameters
[out]strDescription string buffer (at least 7 bytes)
Returns
True if successful
Note
returns "ad9833" if M5Unit-DDS

◆ readMode()

bool m5::unit::UnitDDS::readMode ( dds::Mode & mode)

Read the mode.

Parameters
[out]modeMode
Returns
True if successful

◆ reset()

bool m5::unit::UnitDDS::reset ( )

Reset.

Returns
True if successful
Note
Fixes DAC output to mid-scale

◆ sleep()

bool m5::unit::UnitDDS::sleep ( const bool mclk = true,
const bool DAC = true )

Sleep.

Parameters
mclkSleep mclk (Keep output current value)
DACSleep DAC (Stop output)
Returns
True if successful

◆ wakeup()

bool m5::unit::UnitDDS::wakeup ( )

Wake up.

Returns
True if successful
Note
Wake up from sleep or reset

◆ writeCurrent()

bool m5::unit::UnitDDS::writeCurrent ( const bool select_freq,
const bool select_phase )

Write which bank setting to use.

Parameters
select_freqFrequecny using bank 0 if false, bank 1 if true
select_freqPhase using bank 0 if false, bank 1 if true
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeCurrentFrequency()

bool m5::unit::UnitDDS::writeCurrentFrequency ( const bool select)

Write which bank frequency setting to use.

Parameters
select_freqFrequecny using bank 0 if false, bank 1 if true
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeCurrentPhase()

bool m5::unit::UnitDDS::writeCurrentPhase ( const bool select)

Write which bank phase setting to use.

Parameters
select_freqPhase using bank 0 if false, bank 1 if true
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeFrequency()

bool m5::unit::UnitDDS::writeFrequency ( const bool select,
const uint32_t freq )

Write the frequency.

Parameters
selectTarget bank 0 if false, bank 1 if true
freqFrequency(Hz) 0 - 1Mhz
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeFrequency0()

bool m5::unit::UnitDDS::writeFrequency0 ( const uint32_t freq)
inline

Write the frequency to bank 0.

Parameters
freqFrequency(Hz) 0 - 1Mhz
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeFrequency1()

bool m5::unit::UnitDDS::writeFrequency1 ( const uint32_t freq)
inline

Write the frequency to bank 1.

Parameters
freqFrequency(Hz) 0 - 1Mhz
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeFrequencyAndPhase()

bool m5::unit::UnitDDS::writeFrequencyAndPhase ( const bool select_freq,
const uint32_t freq,
const bool select_phase,
const uint16_t deg )

Write the frequency and phase.

Parameters
select_freqFrequency target bank 0 if false, bank 1 if true
freqFrequency(Hz) 0 - 1Mhz
select_freqPhase target bank 0 if false, bank 1 if true
degPhase (degree)
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeMode()

bool m5::unit::UnitDDS::writeMode ( const dds::Mode mode)

Write the mode.

Parameters
modeMode
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writeOutput()

bool m5::unit::UnitDDS::writeOutput ( const dds::Mode mode,
const bool select,
const uint32_t freq,
const uint16_t deg )

Write mode and settings.

Parameters
modeMode
selectUsing bank
freqFrequency(Hz) 0 - 1Mhz
degPhase (degree)
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writePhase()

bool m5::unit::UnitDDS::writePhase ( const bool select,
const uint16_t deg )

Write the phase.

Parameters
selectTarget bank 0 if false, bank 1 if true
degPhase (degree)
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writePhase0()

bool m5::unit::UnitDDS::writePhase0 ( const uint16_t deg)
inline

Write the phase to bank 0.

Parameters
degPhase (degree)
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC

◆ writePhase1()

bool m5::unit::UnitDDS::writePhase1 ( const uint16_t deg)
inline

Write the phase to bank 1.

Parameters
degPhase (degree)
Returns
True if successful
Warning
Frequency and phase settings are ignored for Mode::Sawtooth and Mode::DC