comparison dds.c @ 213:fcc988c6f841

Fix ad9956 sweep rate setting. Disable clock divider on init. Simplify
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 14 Apr 2014 12:43:25 +0200
parents c700a2d38fb8
children
comparison
equal deleted inserted replaced
212:3d63702b33c1 213:fcc988c6f841
15 #include <ctype.h> 15 #include <ctype.h>
16 #include <math.h> 16 #include <math.h>
17 #include <stdarg.h> 17 #include <stdarg.h>
18 #endif 18 #endif
19 19
20 #include "dds.h"
21 20
22 int msend(int fd, char *buffer, int n) 21 int msend(int fd, char *buffer, int n)
23 { 22 {
24 int r;
25
26 buffer[n++] = '\r'; 23 buffer[n++] = '\r';
27 buffer[n++] = '\n'; 24 buffer[n++] = '\n';
28 25
29 r = send(fd, buffer, n, 0); 26 return send(fd, buffer, n, 0);
30 if (r < 0)
31 return r;
32
33 return 0;
34 } 27 }
35 28
36 29
37 int mrecv(int fd, char *buffer, int len) 30 int mrecv(int fd, char *buffer, int len)
38 { 31 {
67 60
68 r = mrecv(fd, buffer, sizeof(buffer)); 61 r = mrecv(fd, buffer, sizeof(buffer));
69 if (r < 0) 62 if (r < 0)
70 return r; 63 return r;
71 64
72 if (! streq(buffer, "OK")) 65 if (strcmp(buffer, "OK") != 0)
73 return -1; 66 return -1;
74 67
75 return 0; 68 return 0;
76 } 69 }