-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAD9850.h
41 lines (40 loc) · 1.39 KB
/
AD9850.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
/*
* ------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <[email protected]> wrote this file. As long as you retain this notice
* you can do whatever you want with this stuff. If we meet some day,
* and you think this stuff is worth it, you can buy me a beer in return
* Poul-Henning Kamp
* ------------------------------------------------------------------------
*/
#ifndef AD9850_H
#define AD9850_H
#include <Arduino.h>
#include <stdint.h>
#define EX_CLK 125.0e6
// change if ad9850 is connected to other frequency crystal oscillator
class AD9850
{
private:
const char W_CLK; // word load clock pin
const char FQ_UD; // frequency update pin
const char D7; // serial input pin
uint32_t frequency; // delta phase
uint8_t phase; // phase offset
void update();
public:
AD9850(char w_clk, char fq_ud, char d7);
/* NOTE: For device start-up in serial mode,
hardwire pin 2 at 0, pin 3 at 1, and pin 4 at 1 */
void setfreq(double f);
// set frequency in Hz
void setphase(uint8_t p);
// for flexibility, p is an int value and 0 <= p <= 32,
// as input, 360 degree devide into 32 parts,
// you will get phase increments for 360/32*p degree
void down();
// power down
void up();
// power on
};
#endif