Mercurial > hg > fxanalyse
comparison test-ad9956.c @ 265:da38cbbc7ec8
Add DDS clients test code
To verify the portabiolity of the clients code and to make testing
easier the test code is independent of the CVI environment and
runtime.
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Sun, 21 Jun 2015 14:44:33 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
264:a40c8af8b028 | 265:da38cbbc7ec8 |
---|---|
1 #include <stdio.h> | |
2 #include <string.h> | |
3 #include "ad9956.h" | |
4 | |
5 #define error() do { printf("ERROR: %s\n", strerror(-r)); exit(EXIT_FAILURE); } while (0) | |
6 | |
7 int main(int argc, char **argv) | |
8 { | |
9 int r; | |
10 double f; | |
11 struct ad9956 dds; | |
12 | |
13 if (argc < 2) | |
14 return 1; | |
15 | |
16 r = ad9956_init(&dds, argv[1], 1e9); | |
17 if (r < 0) | |
18 error(); | |
19 | |
20 r = ad9956_get_frequency(&dds, &f); | |
21 if (r < 0) | |
22 error(); | |
23 | |
24 r = ad9956_set_frequency(&dds, 10e6); | |
25 if (r < 0) | |
26 error(); | |
27 | |
28 return 0; | |
29 } |