Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #62 from keyboardio/late-descriptors
Browse files Browse the repository at this point in the history
Delay appending the HID descriptors until .begin()
  • Loading branch information
obra authored Dec 13, 2019
2 parents c421b7c + 69efc65 commit 5eb4a7c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/MultiReport/ConsumerControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ static const uint8_t _hidMultiReportDescriptorConsumer[] PROGMEM = {
};

ConsumerControl_::ConsumerControl_(void) {
static HIDSubDescriptor node(_hidMultiReportDescriptorConsumer, sizeof(_hidMultiReportDescriptorConsumer));
HID().AppendDescriptor(&node);
}

void ConsumerControl_::begin(void) {
static HIDSubDescriptor node(_hidMultiReportDescriptorConsumer, sizeof(_hidMultiReportDescriptorConsumer));
HID().AppendDescriptor(&node);

// release all buttons
end();
}
Expand Down
5 changes: 3 additions & 2 deletions src/MultiReport/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ static const uint8_t _hidMultiReportDescriptorKeyboard[] PROGMEM = {
};

Keyboard_::Keyboard_(void) {
static HIDSubDescriptor node(_hidMultiReportDescriptorKeyboard, sizeof(_hidMultiReportDescriptorKeyboard));
HID().AppendDescriptor(&node);
}

void Keyboard_::begin(void) {
static HIDSubDescriptor node(_hidMultiReportDescriptorKeyboard, sizeof(_hidMultiReportDescriptorKeyboard));
HID().AppendDescriptor(&node);

// Force API to send a clean report.
// This is important for and HID bridge where the receiver stays on,
// while the sender is resetted.
Expand Down
5 changes: 3 additions & 2 deletions src/MultiReport/SystemControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ static const uint8_t _hidMultiReportDescriptorSystem[] PROGMEM = {
};

SystemControl_::SystemControl_(void) {
static HIDSubDescriptor node(_hidMultiReportDescriptorSystem, sizeof(_hidMultiReportDescriptorSystem));
HID().AppendDescriptor(&node);
}

void SystemControl_::begin(void) {
static HIDSubDescriptor node(_hidMultiReportDescriptorSystem, sizeof(_hidMultiReportDescriptorSystem));
HID().AppendDescriptor(&node);

// release all buttons
end();
}
Expand Down

0 comments on commit 5eb4a7c

Please sign in to comment.