1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Add Composite CDC+HID device option. (#5478)

* Add Composite CDC+HID device option.

- It passes on though HID interface 8 channels received from TX
- Endpoints are reconfigured to support HID interface
- Potentially this can slow down SPI Flash transfer though CDC interface...
- This could be addressed by support for MSC when using SPI Flash (emulating FATFS)

* Different way to handle MIN redefine
This commit is contained in:
conkerkh 2018-03-22 03:21:22 +01:00 committed by Michael Keller
parent b2e807be6c
commit 4786e1a333
11 changed files with 1209 additions and 7 deletions

View file

@ -85,6 +85,12 @@
#include "telemetry/telemetry.h"
#ifdef USB_CDC_HID
//TODO: Make it platform independent in the future
#include "vcpf4/usbd_cdc_vcp.h"
#include "usbd_hid_core.h"
#endif
#ifdef USE_BST
void taskBstMasterProcess(timeUs_t currentTimeUs);
#endif
@ -139,6 +145,16 @@ static void taskUpdateRxMain(timeUs_t currentTimeUs)
isRXDataNew = true;
#ifdef USB_CDC_HID
if (!ARMING_FLAG(ARMED)) {
int8_t report[8];
for (int i = 0; i < 8; i++) {
report[i] = scaleRange(constrain(rcData[i], 1000, 2000), 1000, 2000, -127, 127);
}
USBD_HID_SendReport(&USB_OTG_dev, (uint8_t*)report, sizeof(report));
}
#endif
#if !defined(USE_ALT_HOLD)
// updateRcCommands sets rcCommand, which is needed by updateAltHoldState and updateSonarAltHoldState
updateRcCommands();