main
Last change
on this file since 32c7682 was 32c7682, checked in by Adrien Destugues <pulkomandy@…>, 12 years ago |
- Poll motor on pin status and report it in the GUI.
- Some cleanup of device class.
git-svn-id: svn://localhost/thomson@12 85ae3b6b-dc8f-4344-a89d-598714f2e4e5
|
-
Property mode
set to
100644
|
File size:
917 bytes
|
Line | |
---|
1 | /* CrO2 datassette emulator
|
---|
2 | * Copyright 2012, Adrien Destugues <pulkomandy@pulkomandy.ath.cx>
|
---|
3 | *
|
---|
4 | * Distributed under the terms of the MIT licence.
|
---|
5 | *
|
---|
6 | * Handles device communication through libusb
|
---|
7 | */
|
---|
8 |
|
---|
9 | #include <stdint.h>
|
---|
10 |
|
---|
11 | #include <lusb0_usb.h> /* this is libusb, see http://libusb.sourceforge.net/ */
|
---|
12 |
|
---|
13 | class Device
|
---|
14 | {
|
---|
15 | public:
|
---|
16 | static Device& getDevice() throw(const char*);
|
---|
17 |
|
---|
18 | ~Device();
|
---|
19 |
|
---|
20 | int read(uint8_t* buffer, size_t max); // Fill the buffer with data from device
|
---|
21 | int write(uint8_t* buffer, size_t size, int blktype);
|
---|
22 | uint8_t getStatus();
|
---|
23 |
|
---|
24 | private:
|
---|
25 | Device() throw(const char*); // Open device and set it up for communication
|
---|
26 | Device(const Device& other);
|
---|
27 |
|
---|
28 |
|
---|
29 | usb_dev_handle* handle;
|
---|
30 |
|
---|
31 | static bool initOnce;
|
---|
32 | static Device* instance;
|
---|
33 |
|
---|
34 | static const uint32_t vid;
|
---|
35 | static const uint32_t pid;
|
---|
36 | static const char* vendor;
|
---|
37 | static const char* product;
|
---|
38 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.