mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Updated USB on PipX to latest CDC changes.
This commit is contained in:
parent
6cb13aa2ba
commit
e57543ec29
@ -163,16 +163,16 @@ SRC += $(PIOSSTM32F10X)/pios_eeprom.c
|
|||||||
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
SRC += $(PIOSSTM32F10X)/pios_bl_helper.c
|
||||||
|
|
||||||
# PIOS USB related files (seperated to make code maintenance more easy)
|
# PIOS USB related files (seperated to make code maintenance more easy)
|
||||||
ifeq ($(USE_USB), YES)
|
SRC += $(PIOSSTM32F10X)/pios_usb.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb.c
|
SRC += $(PIOSSTM32F10X)/pios_usbhook.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usbhook.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_cdc.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
|
||||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
||||||
SRC += $(HOME_DIR)/pios_usb_board_data.c
|
SRC += $(OPSYSTEM)/pios_usb_board_data.c
|
||||||
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
|
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c
|
||||||
SRC += $(PIOSCOMMON)/pios_usb_util.c
|
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
|
||||||
endif
|
SRC += $(PIOSCOMMON)/pios_usb_util.c
|
||||||
|
|
||||||
## PIOS Hardware (Common)
|
## PIOS Hardware (Common)
|
||||||
SRC += $(PIOSCOMMON)/pios_crc.c
|
SRC += $(PIOSCOMMON)/pios_crc.c
|
||||||
|
@ -127,36 +127,37 @@ void PIOS_Board_Init(void) {
|
|||||||
/* Initialize board specific USB data */
|
/* Initialize board specific USB data */
|
||||||
PIOS_USB_BOARD_DATA_Init();
|
PIOS_USB_BOARD_DATA_Init();
|
||||||
|
|
||||||
|
|
||||||
|
/* Flags to determine if various USB interfaces are advertised */
|
||||||
|
bool usb_hid_present = false;
|
||||||
bool usb_cdc_present = false;
|
bool usb_cdc_present = false;
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_USB_CDC)
|
#if defined(PIOS_INCLUDE_USB_CDC)
|
||||||
switch (pipxSettings.VCPConfig)
|
|
||||||
{
|
|
||||||
case PIPXSETTINGS_VCPCONFIG_SERIAL:
|
|
||||||
case PIPXSETTINGS_VCPCONFIG_DEBUG:
|
|
||||||
if (PIOS_USB_DESC_HID_CDC_Init()) {
|
if (PIOS_USB_DESC_HID_CDC_Init()) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
|
usb_hid_present = true;
|
||||||
usb_cdc_present = true;
|
usb_cdc_present = true;
|
||||||
break;
|
|
||||||
case PIPXSETTINGS_VCPCONFIG_DISABLED:
|
|
||||||
if (PIOS_USB_DESC_HID_ONLY_Init()) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if (PIOS_USB_DESC_HID_ONLY_Init()) {
|
if (PIOS_USB_DESC_HID_ONLY_Init()) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
|
usb_hid_present = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t pios_usb_id;
|
uint32_t pios_usb_id;
|
||||||
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg);
|
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg);
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_USB_CDC)
|
#if defined(PIOS_INCLUDE_USB_CDC)
|
||||||
|
if (!usb_cdc_present) {
|
||||||
|
/* Force VCP port function to disabled if we haven't advertised VCP in our USB descriptor */
|
||||||
|
pipxSettings.VCPConfig = PIPXSETTINGS_VCPCONFIG_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_COM)
|
switch (pipxSettings.VCPConfig)
|
||||||
if(usb_cdc_present)
|
{
|
||||||
|
case PIPXSETTINGS_VCPCONFIG_SERIAL:
|
||||||
|
case PIPXSETTINGS_VCPCONFIG_DEBUG:
|
||||||
{
|
{
|
||||||
uint32_t pios_usb_cdc_id;
|
uint32_t pios_usb_cdc_id;
|
||||||
if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) {
|
if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) {
|
||||||
@ -180,10 +181,12 @@ void PIOS_Board_Init(void) {
|
|||||||
pios_com_debug_id = pios_com_vcp_id;
|
pios_com_debug_id = pios_com_vcp_id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_COM */
|
case PIPXSETTINGS_VCPCONFIG_DISABLED:
|
||||||
|
break;
|
||||||
#endif /* PIOS_INCLUDE_USB_CDC */
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_USB_HID)
|
#if defined(PIOS_INCLUDE_USB_HID)
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ static const struct pios_usb_cfg pios_usb_main_cfg = {
|
|||||||
#include <pios_usb_hid_priv.h>
|
#include <pios_usb_hid_priv.h>
|
||||||
|
|
||||||
const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
|
const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
|
||||||
.data_if = 0,
|
.data_if = 2,
|
||||||
.data_rx_ep = 1,
|
.data_rx_ep = 1,
|
||||||
.data_tx_ep = 1,
|
.data_tx_ep = 1,
|
||||||
};
|
};
|
||||||
@ -514,10 +514,10 @@ const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
|
|||||||
#include <pios_usb_cdc_priv.h>
|
#include <pios_usb_cdc_priv.h>
|
||||||
|
|
||||||
const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
|
const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
|
||||||
.ctrl_if = 1,
|
.ctrl_if = 0,
|
||||||
.ctrl_tx_ep = 2,
|
.ctrl_tx_ep = 2,
|
||||||
|
|
||||||
.data_if = 2,
|
.data_if = 1,
|
||||||
.data_rx_ep = 3,
|
.data_rx_ep = 3,
|
||||||
.data_tx_ep = 3,
|
.data_tx_ep = 3,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user