Fast SPI-based serial interface to AD9850 clock generator. Has same interface as (bit-banging based) AD9850 library, but more than x100 faster in frequency update speed. Can sweep 1KHz to 30MHz in 1KHz step in a few seconds.
AD9850SPI Class Reference
Fast AD9850 serial interface over SPI. More...
#include <AD9850SPI.h>
Public Member Functions | |
| AD9850SPI (SPI &spi, PinName fq_ud, PinName reset) | |
| Create AD9850SPI instance. | |
| void | reset_spi () |
| Reset SPI parameter (only) to match with AD9850 requirement. | |
| void | reset () |
| Reset device and enable serial mode. | |
| void | setFrequency (int freq, int powerdown=0, int phase=0) |
| Set frequency. | |
Detailed Description
Fast AD9850 serial interface over SPI.
Definition at line 7 of file AD9850SPI.h.
Constructor & Destructor Documentation
| AD9850SPI | ( | SPI & | spi, |
| PinName | fq_ud, | ||
| PinName | reset_pin | ||
| ) |
Create AD9850SPI instance.
SPI instance should be externally created and passed in, with DATA as MOSI and W_CLK as SCLK. Note that NC can be given for MISO, as AD9850 does not have any output.
- Parameters:
-
spi SPI interface to use fu_ud Chip select pin reset Reset pin
Definition at line 32 of file AD9850SPI.cpp.
Member Function Documentation
| void reset | ( | void | ) |
Reset device and enable serial mode.
Also reconfigures SPI bus parameter for transfer.
Definition at line 73 of file AD9850SPI.cpp.
| void reset_spi | ( | void | ) |
Reset SPI parameter (only) to match with AD9850 requirement.
This is useful when sharing SPI bus line with multiple chips with different SPI parameter.
Definition at line 46 of file AD9850SPI.cpp.
| void setFrequency | ( | int | freq, |
| int | powerdown = 0, |
||
| int | phase = 0 |
||
| ) |
Set frequency.
Note frequency should be <33% of reference clock when used as a clock generator.
- Parameters:
-
freq Frequency in Hz (maps to W0-W31) powerdown Power-down bit (maps to W34) phase Phase in degrees (maps to W35-W39)
Definition at line 117 of file AD9850SPI.cpp.
Generated on Mon Jul 25 2022 22:39:35 by
1.7.2