view test-ad9956.c @ 266:dfbee05fe464

Fix beatnote sign measurement Breakage was caused by the change of the LO, HG, SR, enum values to use them as array indexes assigning to LO value 0 and thus flase in boolean context.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 09 Jul 2015 23:05:43 +0200
parents da38cbbc7ec8
children
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include "ad9956.h"

#define error() do { printf("ERROR: %s\n", strerror(-r)); exit(EXIT_FAILURE); } while (0)

int main(int argc, char **argv)
{
	int r;
	double f;
	struct ad9956 dds;

	if (argc < 2)
		return 1;
	
	r = ad9956_init(&dds, argv[1], 1e9);
	if (r < 0)
		error();

	r = ad9956_get_frequency(&dds, &f);
	if (r < 0)		
		error();

	r = ad9956_set_frequency(&dds, 10e6);
	if (r < 0)		
		error();

	return 0;
}