[all with SD support] Update to latest FatFS version

[Taranis] Bug fixed with EEPROM saving when USB is plugged. It will now reboot when USB is unplugged
This commit is contained in:
bsongis@gmail.com
2013-06-24 19:46:12 +00:00
parent 475b8bc3e6
commit d0156700f5
17 changed files with 838 additions and 553 deletions
+9 -3
View File
@@ -35,12 +35,13 @@
*/
#include "../../opentx.h"
extern "C" {
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
}
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
UsbState usbState = USB_DISCONNECTED;
#define PIN_MODE_MASK 0x0003
#define PIN_INPUT 0x0000
@@ -104,9 +105,9 @@ void configure_pins( uint32_t pins, uint16_t config )
}
#endif
uint8_t usbPlugged(void)
bool usbPlugged(void)
{
return usbState == USB_CONNECTED;
return GPIO_ReadInputDataBit(GPIOA, PIN_FS_VBUS);
}
#if !defined(SIMU)
@@ -120,6 +121,11 @@ void OTG_FS_IRQHandler(void)
}
void usbInit()
{
USB_OTG_BSP_Init(&USB_OTG_dev);
}
void usbStart()
{
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
}
+7 -13
View File
@@ -74,11 +74,6 @@ void configure_pins( uint32_t pins, uint16_t config );
extern uint16_t sessionTimer;
/* USB driver */
uint8_t usbPlugged(void);
#define BOOTLOADER_REQUEST() (0)
#define usbBootloader()
#define SLAVE_MODE() (g_model.trainerMode == 1)
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(GPIOTRNDET, PIN_TRNDET) == Bit_RESET)
@@ -168,16 +163,15 @@ void pwrOff();
#define setBacklight(xx)
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
#define IS_BACKLIGHT_ON() GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_BL)
// USB driver
#define BOOTLOADER_REQUEST() (0)
#define usbBootloader()
void usbInit(void);
enum UsbState {
USB_DISCONNECTED,
USB_CONNECTED,
USB_DISCONNECTING,
};
extern UsbState usbState;
void usbStart(void);
bool usbPlugged(void);
#define EEPROM_MASSSTORAGE() usbPlugged()
// EEPROM driver
#if !defined(SIMU)
@@ -188,7 +182,7 @@ extern UsbState usbState;
#define eepromInit()
void eeWriteBlockCmp(const void *pointer_ram, uint16_t pointer_eeprom, size_t size);
#endif
#define EEPROM_MASSSTORAGE() usbPlugged()
extern uint8_t currentTrainerMode;
+2 -4
View File
@@ -107,9 +107,7 @@ void USBD_USR_DeviceResumed(void)
*/
void USBD_USR_DeviceConnected (void)
{
sdDone();
//eeCheck(true);
usbState = USB_CONNECTED;
}
@@ -121,7 +119,7 @@ void USBD_USR_DeviceConnected (void)
*/
void USBD_USR_DeviceDisconnected (void)
{
usbState = USB_DISCONNECTING;
NVIC_SystemReset();
}