]> git.zerfleddert.de Git - rigol/blame - scope.c
remove unneeded include for usb.h
[rigol] / scope.c
CommitLineData
713be7a4
MG
1#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
7df76f49 4#include <stdint.h>
713be7a4 5
713be7a4 6#include "scope.h"
7906b395 7#include "usbtmc.h"
713be7a4
MG
8
9/* Just USB for now... */
10int sendscpi(struct scope* sc, char* cmd, unsigned char *resp, int resplen)
11{
7906b395 12 return usbtmc_sendscpi(sc, cmd, resp, resplen);
713be7a4
MG
13}
14
15void closescope(struct scope* sc)
16{
7906b395 17 return usbtmc_close(sc);
713be7a4
MG
18}
19
20void claimscope(struct scope* sc)
21{
7906b395 22 return usbtmc_claim(sc);
713be7a4
MG
23}
24
25void releasescope(struct scope* sc)
26{
10ca7ea8 27 /* Disable keylock, so the user doesn't have to press the 'force'-button */
713be7a4 28 sendscpi(sc, ":KEY:LOCK DISABLE",NULL,0);
7906b395 29 return usbtmc_release(sc);
713be7a4
MG
30}
31
10ca7ea8
MG
32void resetscope(struct scope* sc)
33{
34 return usbtmc_reset(sc);
35}
36
713be7a4
MG
37struct scope* initscope(void)
38{
713be7a4
MG
39 struct scope *sc;
40
7906b395 41 sc = usbtmc_initscope();
713be7a4 42
7906b395 43 if (!sc) {
2999345d
MG
44 printf("No scope found.\n");
45 exit(EXIT_FAILURE);
46 }
713be7a4 47
713be7a4
MG
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