REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches

#include <AD9834.h>

Inheritance diagram for functions::AD9834:
Collaboration diagram for functions::AD9834:

Public Member Functions

 AD9834 (bus::addr_t address)
 
bool init ()
 Initialises the chip and puts it into sleep mode.
 
void write_frequency (float freq)
 Sets the frequency of the sine / triangle output in Hz.
 
void write_phase (float phase)
 Sets the phase of the outputs synchronised to the reset pin. Possible values are mapped to [0, 2PI].
 
void write_wave_form (WaveForm wave_form)
 Sets the wave form of the function generator output.
 
float get_real_frequency () const
 Returns the actually set frequency, containing rounding errors.
 
float get_real_phase () const
 Returns the actually set phase, containing rounding errors. Possible values are [0, 2PI].
 
void sleep ()
 Sets the sine / triangle output to zero. The square output will stay at high or low level.
 
void awake ()
 Resumes outputs to regular operation, according to the previously specified frequencies.
 
 DataFunction (bus::addr_t address, const SPISettings &spiSettings)
 
- Public Member Functions inherited from functions::DataFunction
 DataFunction (bus::addr_t address, const SPISettings &spiSettings)
 
void begin_communication () const
 
void end_communication () const
 
- Public Member Functions inherited from functions::Function
 Function (bus::addr_t address)
 

Static Public Attributes

static const SPISettings DEFAULT_SPI_SETTINGS {4'000'000, MSBFIRST, SPI_MODE2}
 
static constexpr uint16_t REG_FREQ_0 = 0x4000
 
static constexpr uint16_t REG_FREQ_1 = 0x8000
 
static constexpr uint16_t REG_PHASE_0 = 0xC000
 
static constexpr uint16_t REG_PHASE_1 = 0xE000
 
static constexpr uint16_t REG_FREQ_MASK = 0x3FFF
 
static constexpr uint16_t REG_PHASE_MASK = 0x0FFF
 
static constexpr uint16_t CONTROL_B28 = 0x2000
 
static constexpr uint16_t CONTROL_HLB = 0x1000
 
static constexpr uint16_t CONTROL_FSEL = 0x0800
 
static constexpr uint16_t CONTROL_PSEL = 0x0400
 
static constexpr uint16_t CONTROL_PINSW = 0x0200
 
static constexpr uint16_t CONTROL_RESET = 0x0100
 
static constexpr uint16_t CONTROL_SLEEP1 = 0x0080
 
static constexpr uint16_t CONTROL_SLEEP12 = 0x0040
 
static constexpr uint16_t CONTROL_OPBITEN = 0x0020
 
static constexpr uint16_t CONTROL_SIGNPIB = 0x0010
 
static constexpr uint16_t CONTROL_DIV2 = 0x0008
 
static constexpr uint16_t CONTROL_MODE = 0x0002
 
static constexpr uint16_t ENABLE_SQUARE_WAVE = CONTROL_OPBITEN
 
static constexpr uint16_t ENABLE_TRIANGLE_WAVE = CONTROL_MODE
 
static constexpr float MASTER_CLK = 75000000.0f
 

Additional Inherited Members

- Public Attributes inherited from functions::DataFunction
const SPISettings & spi_settings
 
- Public Attributes inherited from functions::Function
const bus::addr_t address
 
- Protected Member Functions inherited from functions::DataFunction
void transfer (const void *mosi_buf, void *miso_buf, size_t count) const
 
uint8_t transfer8 (uint8_t data_in) const
 
uint16_t transfer16 (uint16_t data_in) const
 
uint32_t transfer32 (uint32_t data_in) const
 
- Static Protected Member Functions inherited from functions::DataFunction
static SPIClass & get_raw_spi ()
 

Detailed Description

Definition at line 14 of file AD9834.h.

Constructor & Destructor Documentation

◆ AD9834()

functions::AD9834::AD9834 ( bus::addr_t address)
explicit

Definition at line 10 of file AD9834.cpp.

Member Function Documentation

◆ awake()

void functions::AD9834::awake ( )

Resumes outputs to regular operation, according to the previously specified frequencies.

Definition at line 35 of file AD9834.cpp.

◆ DataFunction()

functions::DataFunction::DataFunction ( bus::addr_t address,
const SPISettings & spiSettings )

Definition at line 63 of file functions.cpp.

◆ get_real_frequency()

float functions::AD9834::get_real_frequency ( ) const

Returns the actually set frequency, containing rounding errors.

Definition at line 77 of file AD9834.cpp.

◆ get_real_phase()

float functions::AD9834::get_real_phase ( ) const

Returns the actually set phase, containing rounding errors. Possible values are [0, 2PI].

Definition at line 81 of file AD9834.cpp.

◆ init()

bool functions::AD9834::init ( )

Initialises the chip and puts it into sleep mode.

Definition at line 12 of file AD9834.cpp.

◆ sleep()

void functions::AD9834::sleep ( )

Sets the sine / triangle output to zero. The square output will stay at high or low level.

Definition at line 28 of file AD9834.cpp.

◆ write_frequency()

void functions::AD9834::write_frequency ( float freq)

Sets the frequency of the sine / triangle output in Hz.

Note that the square output will always operate on half of the specified frequency.

Definition at line 60 of file AD9834.cpp.

References uint32_t.

◆ write_phase()

void functions::AD9834::write_phase ( float phase)

Sets the phase of the outputs synchronised to the reset pin. Possible values are mapped to [0, 2PI].

Definition at line 69 of file AD9834.cpp.

◆ write_wave_form()

void functions::AD9834::write_wave_form ( WaveForm wave_form)

Sets the wave form of the function generator output.

Definition at line 42 of file AD9834.cpp.

Member Data Documentation

◆ CONTROL_B28

uint16_t functions::AD9834::CONTROL_B28 = 0x2000
staticconstexpr

Definition at line 26 of file AD9834.h.

◆ CONTROL_DIV2

uint16_t functions::AD9834::CONTROL_DIV2 = 0x0008
staticconstexpr

Definition at line 36 of file AD9834.h.

◆ CONTROL_FSEL

uint16_t functions::AD9834::CONTROL_FSEL = 0x0800
staticconstexpr

Definition at line 28 of file AD9834.h.

◆ CONTROL_HLB

uint16_t functions::AD9834::CONTROL_HLB = 0x1000
staticconstexpr

Definition at line 27 of file AD9834.h.

◆ CONTROL_MODE

uint16_t functions::AD9834::CONTROL_MODE = 0x0002
staticconstexpr

Definition at line 37 of file AD9834.h.

◆ CONTROL_OPBITEN

uint16_t functions::AD9834::CONTROL_OPBITEN = 0x0020
staticconstexpr

Definition at line 34 of file AD9834.h.

◆ CONTROL_PINSW

uint16_t functions::AD9834::CONTROL_PINSW = 0x0200
staticconstexpr

Definition at line 30 of file AD9834.h.

◆ CONTROL_PSEL

uint16_t functions::AD9834::CONTROL_PSEL = 0x0400
staticconstexpr

Definition at line 29 of file AD9834.h.

◆ CONTROL_RESET

uint16_t functions::AD9834::CONTROL_RESET = 0x0100
staticconstexpr

Definition at line 31 of file AD9834.h.

◆ CONTROL_SIGNPIB

uint16_t functions::AD9834::CONTROL_SIGNPIB = 0x0010
staticconstexpr

Definition at line 35 of file AD9834.h.

◆ CONTROL_SLEEP1

uint16_t functions::AD9834::CONTROL_SLEEP1 = 0x0080
staticconstexpr

Definition at line 32 of file AD9834.h.

◆ CONTROL_SLEEP12

uint16_t functions::AD9834::CONTROL_SLEEP12 = 0x0040
staticconstexpr

Definition at line 33 of file AD9834.h.

◆ DEFAULT_SPI_SETTINGS

const SPISettings functions::AD9834::DEFAULT_SPI_SETTINGS {4'000'000, MSBFIRST, SPI_MODE2}
static

Definition at line 8 of file AD9834.h.

◆ ENABLE_SQUARE_WAVE

uint16_t functions::AD9834::ENABLE_SQUARE_WAVE = CONTROL_OPBITEN
staticconstexpr

Definition at line 39 of file AD9834.h.

◆ ENABLE_TRIANGLE_WAVE

uint16_t functions::AD9834::ENABLE_TRIANGLE_WAVE = CONTROL_MODE
staticconstexpr

Definition at line 40 of file AD9834.h.

◆ MASTER_CLK

float functions::AD9834::MASTER_CLK = 75000000.0f
staticconstexpr

Definition at line 42 of file AD9834.h.

◆ REG_FREQ_0

uint16_t functions::AD9834::REG_FREQ_0 = 0x4000
staticconstexpr

Definition at line 18 of file AD9834.h.

◆ REG_FREQ_1

uint16_t functions::AD9834::REG_FREQ_1 = 0x8000
staticconstexpr

Definition at line 19 of file AD9834.h.

◆ REG_FREQ_MASK

uint16_t functions::AD9834::REG_FREQ_MASK = 0x3FFF
staticconstexpr

Definition at line 23 of file AD9834.h.

◆ REG_PHASE_0

uint16_t functions::AD9834::REG_PHASE_0 = 0xC000
staticconstexpr

Definition at line 20 of file AD9834.h.

◆ REG_PHASE_1

uint16_t functions::AD9834::REG_PHASE_1 = 0xE000
staticconstexpr

Definition at line 21 of file AD9834.h.

◆ REG_PHASE_MASK

uint16_t functions::AD9834::REG_PHASE_MASK = 0x0FFF
staticconstexpr

Definition at line 24 of file AD9834.h.


The documentation for this class was generated from the following files: