Skip to content

Commit

Permalink
Use usbGenerateDisconnectPulse for F1/F3 targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra committed Feb 26, 2017
1 parent ca67cf1 commit 447325e
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions src/main/vcp/hw_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include <stdbool.h>
#include "drivers/system.h"
#include "drivers/usb_io.h"
#include "drivers/nvic.h"

#include "common/utils.h"
Expand Down Expand Up @@ -85,30 +86,7 @@ void Set_System(void)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
#endif /* STM32L1XX_XD */

/*Pull down PA12 to create USB Disconnect Pulse*/ // HJI
#if defined(STM32F303xC) // HJI
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); // HJI

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; // HJI
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // HJI
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // HJI
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; // HJI
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // HJI
#else
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); // HJI

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;// HJI
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;// HJI
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;// HJI
#endif

GPIO_Init(GPIOA, &GPIO_InitStructure); // HJI

GPIO_ResetBits(GPIOA, GPIO_Pin_12); // HJI

delay(200); // HJI

GPIO_SetBits(GPIOA, GPIO_Pin_12); // HJI
usbGenerateDisconnectPulse();

#if defined(STM32F37X) || defined(STM32F303xC)

Expand Down

0 comments on commit 447325e

Please sign in to comment.