-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDevice.cpp
More file actions
37 lines (27 loc) · 733 Bytes
/
Device.cpp
File metadata and controls
37 lines (27 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "Device.h"
#include <libusb.h>
class Device
{
//ïîäãîòîâêà óñòðîéñòâà
libusb_device** devs;
libusb_device_handle* dev_handle;
libusb_context* ctx = NULL;
unsigned char* data;
public:
Device() {
libusb_init(&ctx);
libusb_set_debug(ctx, 3);
dev_handle = libusb_open_device_with_vid_pid(ctx, 0x0483, 0x5750);
libusb_claim_interface(dev_handle, 0);
data = new unsigned char[8];
data[0] = '0x00';
data[1] = '0x00';
data[2] = '0x20';
}
void sendCommand() {
libusb_bulk_transfer(dev_handle, 0x01, data, 64, NULL, 1000);
}
~Device() {
libusb_close(dev_handle);
}
};