Skip to content

Commit cf1925f

Browse files
authored
Merge pull request #56 from adafruit/develop
update new hid descriptor (drop comma after report id)
2 parents 950fc6b + 058bac6 commit cf1925f

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

examples/HID/hid_composite/hid_composite.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@
3535
enum
3636
{
3737
RID_KEYBOARD = 1,
38-
RID_MOUSE
38+
RID_MOUSE,
39+
RID_CONSUMER_CONTROL, // Media, volume etc ..
3940
};
4041

4142
// HID report descriptor using TinyUSB's template
4243
uint8_t const desc_hid_report[] =
4344
{
44-
TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(RID_KEYBOARD), ),
45-
TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(RID_MOUSE), )
45+
TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(RID_KEYBOARD) ),
46+
TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(RID_MOUSE) ),
47+
//TUD_HID_REPORT_DESC_CONSUMER( HID_REPORT_ID(RID_CONSUMER_CONTROL), )
4648
};
4749

4850
// USB HID object

examples/HID/hid_composite_joy_featherwing/hid_composite_joy_featherwing.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ enum
4242
// HID report descriptor using TinyUSB's template
4343
uint8_t const desc_hid_report[] =
4444
{
45-
TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(RID_KEYBOARD), ),
46-
TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(RID_MOUSE), )
45+
TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(RID_KEYBOARD) ),
46+
TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(RID_MOUSE) )
4747
};
4848

4949
// USB HID object

src/Adafruit_USBD_MIDI.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "Adafruit_USBD_MIDI.h"
2626

27-
#if CFG_TUD_MIDI && defined(TUD_MIDI_DESC_HEAD_LEN)
27+
#if CFG_TUD_MIDI
2828

2929
//--------------------------------------------------------------------+
3030
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
@@ -35,8 +35,7 @@
3535

3636
Adafruit_USBD_MIDI::Adafruit_USBD_MIDI(void) : _n_cables(1) {}
3737

38-
Adafruit_USBD_MIDI::Adafruit_USBD_MIDI(uint8_t n_cables)
39-
: _n_cables(n_cables) {}
38+
void Adafruit_USBD_MIDI::setCables(uint8_t n_cables) { _n_cables = n_cables; }
4039

4140
bool Adafruit_USBD_MIDI::begin(void) {
4241
if (!USBDevice.addInterface(*this))
@@ -114,4 +113,12 @@ void Adafruit_USBD_MIDI::flush(void) {
114113
// MIDI Library doen't use flush
115114
}
116115

116+
bool Adafruit_USBD_MIDI::send(const uint8_t packet[4]) {
117+
return tud_midi_send(packet);
118+
}
119+
120+
bool Adafruit_USBD_MIDI::receive(uint8_t packet[4]) {
121+
return tud_midi_receive(packet);
122+
}
123+
117124
#endif

src/Adafruit_USBD_MIDI.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
class Adafruit_USBD_MIDI : public Stream, Adafruit_USBD_Interface {
3131
public:
3232
Adafruit_USBD_MIDI(void);
33-
Adafruit_USBD_MIDI(uint8_t n_cables);
3433

3534
bool begin(void);
3635

@@ -47,10 +46,16 @@ class Adafruit_USBD_MIDI : public Stream, Adafruit_USBD_Interface {
4746
virtual int peek(void);
4847
virtual void flush(void);
4948

49+
// Raw MIDI USB packet interface.
50+
bool send(const uint8_t packet[4]);
51+
bool receive(uint8_t packet[4]);
52+
5053
// from Adafruit_USBD_Interface
5154
virtual uint16_t getDescriptor(uint8_t itfnum, uint8_t *buf,
5255
uint16_t bufsize);
5356

57+
void setCables(uint8_t n_cables);
58+
5459
private:
5560
uint8_t _n_cables;
5661
};

0 commit comments

Comments
 (0)