]> git.zerfleddert.de Git - rigol/blame_incremental - scope.c
remove unneeded include for usb.h
[rigol] / scope.c
... / ...
CommitLineData
1#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <stdint.h>
5
6#include "scope.h"
7#include "usbtmc.h"
8
9/* Just USB for now... */
10int sendscpi(struct scope* sc, char* cmd, unsigned char *resp, int resplen)
11{
12 return usbtmc_sendscpi(sc, cmd, resp, resplen);
13}
14
15void closescope(struct scope* sc)
16{
17 return usbtmc_close(sc);
18}
19
20void claimscope(struct scope* sc)
21{
22 return usbtmc_claim(sc);
23}
24
25void releasescope(struct scope* sc)
26{
27 /* Disable keylock, so the user doesn't have to press the 'force'-button */
28 sendscpi(sc, ":KEY:LOCK DISABLE",NULL,0);
29 return usbtmc_release(sc);
30}
31
32void resetscope(struct scope* sc)
33{
34 return usbtmc_reset(sc);
35}
36
37struct scope* initscope(void)
38{
39 struct scope *sc;
40
41 sc = usbtmc_initscope();
42
43 if (!sc) {
44 printf("No scope found.\n");
45 exit(EXIT_FAILURE);
46 }
47
48 claimscope(sc);
49 sendscpi(sc, "*IDN?", (unsigned char*)sc->idn, sizeof(sc->idn));
50 releasescope(sc);
51
52 printf("Scope found (%s)\n", sc->idn);
53
54 return sc;
55}
56
57char *scope_idn(struct scope *sc)
58{
59 return sc->idn;
60}
Impressum, Datenschutz