-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathad983x.h
33 lines (26 loc) · 922 Bytes
/
ad983x.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
#ifndef __AD983X_H
#define __AD983X_H
#include <stdint.h>
typedef void (*spi_transfer_func)(void *ctx, char data[], int len);
typedef struct {
spi_transfer_func spi_transfer;
void *ctx;
uint16_t reg;
} ad983x_t;
typedef enum {
AD983X_SIGN_OUTPUT_NONE = 0x0000,
AD983X_SIGN_OUTPUT_MSB = 0x0028,
AD983X_SIGN_OUTPUT_MSB_2 = 0x0020,
AD983X_SIGN_OUTPUT_COMPARATOR = 0x0038,
} ad983x_sign_output_t;
typedef enum {
AD983X_OUTPUT_MODE_SINE = 0x0000,
AD983X_OUTPUT_MODE_TRIANGLE = 0x0002,
} ad983x_output_mode_t;
void ad983x_init(ad983x_t *dds, spi_transfer_func func, void *ctx);
void ad983x_start(ad983x_t *dds);
void ad983x_set_frequency(ad983x_t *dds, uint8_t reg, uint32_t frequency);
void ad983x_set_phase(ad983x_t *dds, uint8_t reg, uint32_t phase);
void ad983x_set_sign_output(ad983x_t *dds, ad983x_sign_output_t output);
void ad983x_set_output_mode(ad983x_t *dds, ad983x_output_mode_t mode);
#endif