-
Notifications
You must be signed in to change notification settings - Fork 1
/
AD9954.h
executable file
·138 lines (117 loc) · 4.77 KB
/
AD9954.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA *
* *
***************************************************************************
* *
* (c) Copyright, 1997-2012, ANSR *
* *
***************************************************************************
* *
* Filename: AD9954.h *
* *
***************************************************************************/
#ifndef AD9954_H
#define AD9954_H
/**
* @defgroup external External Peripherals
*
* @{
*/
/**
* Control the Analog Devices AD9954 DDS. The AD9954 is a 400 MSPS,
* 14-Bit, 1.8 V CMOS, Direct Digital Synthesizer.
*/
class AD9954
{
public:
/// Desired operational DDS mode.
typedef enum
{
/// Place the DDS in low power mode
PowerDown,
/// CW (Continuous Wave) carrier.
CW,
/// CW (Continuous Wave) carrier with automatic OSK (Output Shift Keying) disabled.
CWNoAutoOSK
} DDSMode;
/// Enumerated type that selects 1 of 4 possible profiles.
typedef enum
{
/// Profile select 0 and 1 are set low.
Profile0 = 0x00,
/// Profile select 0 is set high and 1 is set low.
Profile1 = 0x01,
/// Profile select 0 is set low and 1 is set high.
Profile2 = 0x02,
/// Profile select 0 and 1 are set high.
Profile3 = 0x03
} ProfileSelect;
/**
* Callback to set the Chip Select control line.
*
* @param state false to set line low and enable device; otherwise true
*/
virtual void IOSetCS(bool_t state);
/**
* Callback to clock and read data from the SPI bus.
*
* @return 8-bit data read from SPI bus
*/
virtual uint8_t SPIRead();
/**
* Callback to clock and send data over SPI bus.
*
* @param data 8-bit data to write
*/
virtual void SPIWrite(uint8_t data);
/**
* Callback to set OSK (Output Shift Key) control line.
*
* @param state true to turn on RF output; otherwise false
*/
virtual void IOSetOSK(bool_t state);
/**
* Callback to set I/O Update strobe line.
*
* @param state true to update the I/O registers; otherwise false
*/
virtual void IOSetIOUpdate(bool_t state);
/**
* Callback to set the Reset control line.
*
* @param state true to place AD9954 in reset mode
*/
virtual void IOSetReset(bool_t state);
/**
* Callback to set the profile select control lines.
*
* @param profile enumerated type that selects 1 of 4 possible profiles
*/
virtual void IOSetProfileSelect(ProfileSelect profile);
void Enable();
static uint32_t GetAmplitudeScale (uint32_t amplitude);
void SetAmplitude (uint32_t amplitude);
void SetAmplitudeRampRate (uint32_t arr);
void SetFreq(uint32_t freq);
void SetFTW (uint32_t ftw);
void SetMode (DDSMode mode);
void SetOSK (bool_t state);
void SetOutputScale (uint32_t scale);
void SetPhase (bool_t phase);
static AD9954 *GetInstance();
};
/** @} */
#endif // #ifndef AD9954_H