jisakson3
SignalGenDAC Class Reference
The Signal Generator DAC Driver. More...
#include <SignalGenDAC.h>
Public Member Functions | |
SignalGenDAC (PinName aout=p18, float minV=0.0, float maxV=3.3) | |
Constructor, which is used to define the hardware. | |
~SignalGenDAC () | |
Destructor. | |
void | PrepareWaveform (SG_Waveform mode, float frequency, float dutycycle, float voltage, float offset) |
Create the waveform in the private memory buffer that is used to DMA to the DAC. | |
void | Start (bool oneShot=false) |
Start the signal, in either a oneshot, or continuous mode. | |
void | Stop (void) |
Stop the signal, if it is running. | |
bool | isRunning (void) |
Determine if the signal is running. |
Detailed Description
The Signal Generator DAC Driver.
This class provides the interface to first configure the DAC hardware characteristics, and then to define and control the DAC output.
A choice of waveforms is available (Sine, Square, Triangle, Sawtooth, and User Defined.
SignalGenDAC g_signal; // defaults to LPC1768 mbed module (p18 and 3.3v) g_signal.PrepareWaveform(SG_SINE, 1000, 50, 2.2, 1.5); g_signal.Start(); wait_ms(1000); g_signal.Stop();
Definition at line 35 of file SignalGenDAC.h.
Constructor & Destructor Documentation
SignalGenDAC | ( | PinName | aout = p18 , |
float | minV = 0.0 , |
||
float | maxV = 3.3 |
||
) |
Constructor, which is used to define the hardware.
The default parameters are based on the mbed LPC1768 micro, which has AnalogOut on p18 and uses a 3.3v supply for the A/D reference.
- Parameters:
-
[in] aout is the analog output pin [in] minV is based on the A/D low reference voltage (default 0.0) [in] maxV is based on the A/D high reference voltage (default 3.3)
Definition at line 31 of file SignalGenDAC.cpp.
~SignalGenDAC | ( | ) |
Destructor.
Definition at line 36 of file SignalGenDAC.cpp.
Member Function Documentation
bool isRunning | ( | void | ) |
Determine if the signal is running.
- Returns:
- true if the signal is running.
Definition at line 80 of file SignalGenDAC.h.
void PrepareWaveform | ( | SG_Waveform | mode, |
float | frequency, | ||
float | dutycycle, | ||
float | voltage, | ||
float | offset | ||
) |
Create the waveform in the private memory buffer that is used to DMA to the DAC.
- Parameters:
-
[in] mode defines the waveform: Sine, Square, Triangle, Sawtooth, User [in] frequency defines the desired frequency [in] dutycycle defined the duty cycle of the waveform to be created. The value is range limited to 5 to 95 (representing 5 to 95 %). [in] voltage is the peak-to-peak voltage, and it range limited to 0 to 3.0. [in] offset is the offset voltage, and is range limited to 0 to 3.0.
Definition at line 102 of file SignalGenDAC.cpp.
void Start | ( | bool | oneShot = false ) |
Start the signal, in either a oneshot, or continuous mode.
- Parameters:
-
[in] oneShot defaults false, which causes continuous mode. When set true, one cycle is produced.
Definition at line 39 of file SignalGenDAC.cpp.
void Stop | ( | void | ) |
Stop the signal, if it is running.
Definition at line 92 of file SignalGenDAC.cpp.
Generated on Mon Dec 5 2022 02:02:14 by 1.7.2