-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusb.h
60 lines (43 loc) · 1.67 KB
/
usb.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef UNFL_USB_H
#define UNFL_USB_H
/*********************************
DataType macros
*********************************/
// Settings
#define USE_OSRAW 0 // Use if you're doing USB operations without the PI Manager
// Data types defintions
#define DATATYPE_TEXT 0x01
#define DATATYPE_RAWBINARY 0x02
#define DATATYPE_HEADER 0x03
#define DATATYPE_SCREENSHOT 0x04
/*********************************
USB Functions
*********************************/
/*==============================
usb_initialize
Initializes the USB buffers and pointers
==============================*/
extern void usb_initialize();
/*==============================
usb_write
Writes data to the USB.
@param The DATATYPE that is being sent
@param A buffer with the data to send
@param The size of the data being sent
==============================*/
extern void usb_write(int datatype, const void* data, int size);
/*==============================
usb_poll
Returns the header of data being received via USB
The first byte contains the data type, the next 3 the size
@return The header of incoming data, or 0 if no data
==============================*/
extern int usb_poll();
/*==============================
usb_read
Reads bytes from the USB into the provided buffer
@param The buffer to put the read data in
@param The number of bytes to read
==============================*/
extern void usb_read(void* buffer, int size);
#endif