Allow USB mode selection on USB connect (#5193)

Allow all USB modes to be compiled in at the same time
This commit is contained in:
Arne Schwabe
2017-09-10 17:28:08 +02:00
committed by Bertrand Songis
parent 2910488a30
commit b7acee5723
45 changed files with 1515 additions and 1239 deletions
+5 -9
View File
@@ -22,6 +22,7 @@
#define _BOARD_H_
#include "stddef.h"
#include "stdbool.h"
#if defined(__cplusplus) && !defined(SIMU)
extern "C" {
@@ -71,6 +72,7 @@ extern "C" {
#pragma clang diagnostic pop
#endif
#include "usb_driver.h"
#if !defined(SIMU)
#include "usbd_cdc_core.h"
#include "usbd_msc_core.h"
@@ -157,13 +159,14 @@ uint32_t sdGetSpeed(void);
#define sdInit()
#define sdMount()
#define sdDone()
#define SD_CARD_PRESENT() true
#else
void sdInit(void);
void sdMount(void);
void sdDone(void);
void sdPoll10ms(void);
uint32_t sdMounted(void);
#define SD_CARD_PRESENT() (~SD_GPIO_PRESENT->IDR & SD_GPIO_PIN_PRESENT)
#define SD_CARD_PRESENT() ((SD_GPIO_PRESENT->IDR & SD_GPIO_PIN_PRESENT)==0)
#endif
// Flash Write driver
@@ -453,14 +456,7 @@ uint8_t isBacklightEnabled(void);
#define BACKLIGHT_ENABLE() backlightEnable(g_eeGeneral.backlightBright)
#endif
// USB driver
int usbPlugged();
void usbInit();
void usbStart();
void usbStop();
uint8_t usbStarted();
void usbSerialPutc(uint8_t c);
#if defined(USB_JOYSTICK) && !defined(SIMU)
#if !defined(SIMU)
void usbJoystickUpdate();
#endif
#define USB_NAME "FrSky Taranis"
+7 -2
View File
@@ -993,13 +993,18 @@ void sdInit(void)
void sdInit(void)
{
TRACE("sdInit");
ioMutex = CoCreateMutex();
if (ioMutex >= CFG_MAX_MUTEX ) {
if (ioMutex >= CFG_MAX_MUTEX) {
//sd error
return;
}
sdMount();
}
void sdMount()
{
TRACE("sdMount");
if (f_mount(&g_FATFS_Obj, "", 1) == FR_OK) {
// call sdGetFreeSectors() now because f_getfree() takes a long time first time it's called
sdGetFreeSectors();