mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Added boolean operator and more
Added a bool operator to check if a midi device is connected, added methods to get vid and pid to match those of Teensy's 3.6 built-in USB Host.
This commit is contained in:
parent
03933edb41
commit
8ef3db254d
1 changed files with 5 additions and 2 deletions
|
@ -66,6 +66,9 @@ protected:
|
||||||
public:
|
public:
|
||||||
uint16_t pid, vid;
|
uint16_t pid, vid;
|
||||||
USBH_MIDI(USB *p);
|
USBH_MIDI(USB *p);
|
||||||
|
operator bool() { return (pUsb->getUsbTaskState()==USB_STATE_RUNNING && isMidiFound); }
|
||||||
|
uint16_t idVendor() { return vid; }
|
||||||
|
uint16_t idProduct() { return pid; }
|
||||||
// Methods for recieving and sending data
|
// Methods for recieving and sending data
|
||||||
uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
|
uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
|
||||||
uint8_t RecvData(uint8_t *outBuf, bool isRaw=false);
|
uint8_t RecvData(uint8_t *outBuf, bool isRaw=false);
|
||||||
|
@ -76,8 +79,8 @@ public:
|
||||||
uint8_t extractSysExData(uint8_t *p, uint8_t *buf);
|
uint8_t extractSysExData(uint8_t *p, uint8_t *buf);
|
||||||
uint8_t SendRawData(uint16_t bytes_send, uint8_t *dataptr);
|
uint8_t SendRawData(uint16_t bytes_send, uint8_t *dataptr);
|
||||||
// backward compatibility functions
|
// backward compatibility functions
|
||||||
inline uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr){ return RecvData(bytes_rcvd, dataptr); };
|
inline uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) { return RecvData(bytes_rcvd, dataptr); };
|
||||||
inline uint8_t RcvData(uint8_t *outBuf){ return RecvData(outBuf); };
|
inline uint8_t RcvData(uint8_t *outBuf) { return RecvData(outBuf); };
|
||||||
|
|
||||||
// USBDeviceConfig implementation
|
// USBDeviceConfig implementation
|
||||||
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
|
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
|
||||||
|
|
Loading…
Reference in a new issue