annotate test-ad9956.c @ 268:ec4462c7f8b7

Extensive cleanup of beatnote specific variables Reorganize the beatnote specific variables in arrays indexed by the beatnote enum constants LO, HG, SR. Also reorganize DDS frequency related variables in arrays indexed by the DDS channel number.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 09 Jul 2015 23:11:00 +0200
parents da38cbbc7ec8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
265
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
1 #include <stdio.h>
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
2 #include <string.h>
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
3 #include "ad9956.h"
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
4
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
5 #define error() do { printf("ERROR: %s\n", strerror(-r)); exit(EXIT_FAILURE); } while (0)
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
6
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
7 int main(int argc, char **argv)
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
8 {
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
9 int r;
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
10 double f;
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
11 struct ad9956 dds;
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
12
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
13 if (argc < 2)
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
14 return 1;
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
15
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
16 r = ad9956_init(&dds, argv[1], 1e9);
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
17 if (r < 0)
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
18 error();
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
19
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
20 r = ad9956_get_frequency(&dds, &f);
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
21 if (r < 0)
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
22 error();
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
23
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
24 r = ad9956_set_frequency(&dds, 10e6);
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
25 if (r < 0)
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
26 error();
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
27
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
28 return 0;
da38cbbc7ec8 Add DDS clients test code
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
diff changeset
29 }