refactor: USB HAL conversion + USB lib update (#4207)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: Richard Li <richard.li@ces.hk>
This commit is contained in:
co-authored by
raphaelcoeffic
Richard Li
parent
a68ad817d7
commit
c9334ebda3
@@ -492,7 +492,7 @@ if(INTERNAL_MODULE_SERIAL)
|
||||
set(INTERNAL_MODULES PXX2 CACHE STRING "Internal modules")
|
||||
else()
|
||||
# defines existing internal modules
|
||||
set(INTERNAL_MODULES PXX1;PXX2;MULTI;CRSF CACHE STRING "Internal modules")
|
||||
set(INTERNAL_MODULES MULTI;CRSF CACHE STRING "Internal modules")
|
||||
endif()
|
||||
|
||||
add_definitions(-DINTERNAL_MODULE_SERIAL)
|
||||
@@ -611,8 +611,6 @@ set(FIRMWARE_SRC
|
||||
targets/common/arm/loadboot.cpp
|
||||
targets/common/arm/stm32/heartbeat_driver.cpp
|
||||
targets/common/arm/stm32/audio_dac_driver.cpp
|
||||
targets/common/arm/stm32/sdcard_spi.cpp
|
||||
targets/common/arm/stm32/diskio_spi.cpp
|
||||
)
|
||||
|
||||
set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${BITMAPS_TARGET})
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "hal/switch_driver.h"
|
||||
#include "hal/module_port.h"
|
||||
#include "hal/abnormal_reboot.h"
|
||||
#include "hal/usb_driver.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "boards/generic_stm32/module_ports.h"
|
||||
@@ -54,15 +55,6 @@
|
||||
#include "bluetooth_driver.h"
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "usb_dcd_int.h"
|
||||
#include "usb_bsp.h"
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
HardwareOptions hardwareOptions;
|
||||
|
||||
#if !defined(BOOT)
|
||||
@@ -109,14 +101,8 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
#if defined(MANUFACTURER_RADIOMASTER) && defined(STM32F407xx)
|
||||
|
||||
if (FLASH_OB_GetBOR() != OB_BOR_LEVEL3)
|
||||
{
|
||||
FLASH_OB_Unlock();
|
||||
FLASH_OB_BORConfig(OB_BOR_LEVEL3);
|
||||
FLASH_OB_Launch();
|
||||
FLASH_OB_Lock();
|
||||
}
|
||||
void board_set_bor_level();
|
||||
board_set_bor_level();
|
||||
#endif
|
||||
|
||||
init_trainer();
|
||||
|
||||
@@ -241,63 +241,6 @@ uint8_t isBacklightEnabled();
|
||||
#define BACKLIGHT_ENABLE() backlightEnable(currentBacklightBright)
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
void usbJoystickUpdate();
|
||||
#endif
|
||||
#if defined(RADIO_TX12) || defined(RADIO_TX12MK2)
|
||||
#define USB_NAME "Radiomaster TX12"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'T', 'X', '1', '2', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_BOXER)
|
||||
#define USB_NAME "Radiomaster Boxer"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'B', 'o', 'x', 'e', 'r' /* 8 Bytes */
|
||||
#elif defined(RADIO_ZORRO)
|
||||
#define USB_NAME "Radiomaster Zorro"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'Z', 'O', 'R', 'R', 'O' /* 8 Bytes */
|
||||
#elif defined(RADIO_MT12)
|
||||
#define USB_NAME "Radiomaster MT12"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'M', 'T', '1', '2', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_POCKET)
|
||||
#define USB_NAME "Radiomaster Pocket"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', 'P', 'O', 'C', 'K', 'E', 'T' /* 8 Bytes */
|
||||
#elif defined(RADIO_T8)
|
||||
#define USB_NAME "Radiomaster T8"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'T', '8', ' ', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_LR3PRO)
|
||||
#define USB_NAME "BETAFPV LR3PRO"
|
||||
#define USB_MANUFACTURER 'B', 'E', 'T', 'A', 'F', 'P', 'V', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'L', 'R', '3', 'P', 'R', 'O', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_TLITE)
|
||||
#define USB_NAME "Jumper TLite"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', 'L', 'I', 'T', 'E', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_TPRO)
|
||||
#define USB_NAME "Jumper TPro"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', 'P', 'R', 'O', ' ', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_TPROV2)
|
||||
#define USB_NAME "Jumper TPro V2"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', 'P', 'R', 'O', ' ', 'V', '2' /* 8 Bytes */
|
||||
#elif defined(RADIO_T20)
|
||||
#define USB_NAME "Jumper T20"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', '2', '0', ' ', ' ', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_COMMANDO8)
|
||||
#define USB_NAME "iFlight Commando 8"
|
||||
#define USB_MANUFACTURER 'i', 'F', 'l', 'i', 'g', 'h', 't', '-' /* 8 bytes */
|
||||
#define USB_PRODUCT 'C', 'o', 'm', 'm', 'a', 'n', 'd', 'o' /* 8 Bytes */
|
||||
#else
|
||||
#define USB_NAME "FrSky Taranis"
|
||||
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', 'a', 'r', 'a', 'n', 'i', 's', ' ' /* 8 Bytes */
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2413,12 +2413,9 @@
|
||||
// USB
|
||||
#define USB_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOA
|
||||
#define USB_GPIO GPIOA
|
||||
#define USB_GPIO_PIN_VBUS GPIO_Pin_9 // PA.09
|
||||
#define USB_GPIO_PIN_DM GPIO_Pin_11 // PA.11
|
||||
#define USB_GPIO_PIN_DP GPIO_Pin_12 // PA.12
|
||||
#define USB_GPIO_PinSource_DM GPIO_PinSource11
|
||||
#define USB_GPIO_PinSource_DP GPIO_PinSource12
|
||||
#define USB_GPIO_AF GPIO_AF_OTG1_FS
|
||||
#define USB_GPIO_PIN_VBUS LL_GPIO_PIN_9 // PA.09
|
||||
#define USB_GPIO_PIN_DM LL_GPIO_PIN_11 // PA.11
|
||||
#define USB_GPIO_PIN_DP LL_GPIO_PIN_12 // PA.12
|
||||
|
||||
// BackLight
|
||||
#if defined(PCBX9E)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "hal/usb_driver.h"
|
||||
|
||||
void usbChargerInit()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _USB_DESCRIPTOR_H_
|
||||
#define _USB_DESCRIPTOR_H_
|
||||
|
||||
#if defined(RADIO_TX12) || defined(RADIO_TX12MK2)
|
||||
#define USB_NAME "Radiomaster TX12"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'T', 'X', '1', '2', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_BOXER)
|
||||
#define USB_NAME "Radiomaster Boxer"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'B', 'o', 'x', 'e', 'r' /* 8 Bytes */
|
||||
#elif defined(RADIO_ZORRO)
|
||||
#define USB_NAME "Radiomaster Zorro"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'Z', 'O', 'R', 'R', 'O' /* 8 Bytes */
|
||||
#elif defined(RADIO_MT12)
|
||||
#define USB_NAME "Radiomaster MT12"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'M', 'T', '1', '2', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_POCKET)
|
||||
#define USB_NAME "Radiomaster Pocket"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', 'P', 'O', 'C', 'K', 'E', 'T' /* 8 Bytes */
|
||||
#elif defined(RADIO_T8)
|
||||
#define USB_NAME "Radiomaster T8"
|
||||
#define USB_MANUFACTURER 'R', 'M', '_', 'T', 'X', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'R', 'M', ' ', 'T', '8', ' ', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_LR3PRO)
|
||||
#define USB_NAME "BETAFPV LR3PRO"
|
||||
#define USB_MANUFACTURER 'B', 'E', 'T', 'A', 'F', 'P', 'V', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'L', 'R', '3', 'P', 'R', 'O', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_TLITE)
|
||||
#define USB_NAME "Jumper TLite"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', 'L', 'I', 'T', 'E', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_TPRO)
|
||||
#define USB_NAME "Jumper TPro"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', 'P', 'R', 'O', ' ', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_TPROV2)
|
||||
#define USB_NAME "Jumper TPro V2"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', 'P', 'R', 'O', ' ', 'V', '2' /* 8 Bytes */
|
||||
#elif defined(RADIO_T20)
|
||||
#define USB_NAME "Jumper T20"
|
||||
#define USB_MANUFACTURER 'J', 'U', 'M', 'P', 'E', 'R', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', '-', '2', '0', ' ', ' ', ' ', ' ' /* 8 Bytes */
|
||||
#elif defined(RADIO_COMMANDO8)
|
||||
#define USB_NAME "iFlight Commando 8"
|
||||
#define USB_MANUFACTURER 'i', 'F', 'l', 'i', 'g', 'h', 't', '-' /* 8 bytes */
|
||||
#define USB_PRODUCT 'C', 'o', 'm', 'm', 'a', 'n', 'd', 'o' /* 8 Bytes */
|
||||
#else
|
||||
#define USB_NAME "FrSky Taranis"
|
||||
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', 'a', 'r', 'a', 'n', 'i', 's', ' ' /* 8 Bytes */
|
||||
#endif
|
||||
|
||||
#endif // _USB_DESCRIPTOR_H_
|
||||
Reference in New Issue
Block a user