本文整理汇总了C++中USB_OTG_BSP_mDelay函数的典型用法代码示例。如果您正苦于以下问题:C++ USB_OTG_BSP_mDelay函数的具体用法?C++ USB_OTG_BSP_mDelay怎么用?C++ USB_OTG_BSP_mDelay使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USB_OTG_BSP_mDelay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: USB_OTG_ResetPort
//--------------------------------------------------------------
uint32_t USB_OTG_ResetPort(USB_OTG_CORE_HANDLE *pdev)
{
USB_OTG_HPRT0_TypeDef hprt0;
hprt0.d32 = USB_OTG_ReadHPRT0(pdev);
hprt0.b.prtrst = 1;
USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
USB_OTG_BSP_mDelay (10); /* See Note #1 */
hprt0.b.prtrst = 0;
USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
USB_OTG_BSP_mDelay (20);
return 1;
}
开发者ID:m4th3u5,项目名称:USB-HID--host-keyboard-anbt2-final-com-acento--repete--limites---menu-e-correcoes,代码行数:14,代码来源:usb_core.c
示例2: USB_OTG_ActiveRemoteWakeup
//--------------------------------------------------------------
void USB_OTG_ActiveRemoteWakeup(USB_OTG_CORE_HANDLE * pdev)
{
USB_OTG_DCTL_TypeDef dctl;
USB_OTG_DSTS_TypeDef dsts;
USB_OTG_PCGCCTL_TypeDef power;
if (pdev->dev.DevRemoteWakeup) {
dsts.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DSTS);
if (dsts.b.suspsts == 1) {
if (pdev->cfg.low_power) {
/* un-gate USB Core clock */
power.d32 = USB_OTG_READ_REG32(&pdev->regs.PCGCCTL);
power.b.gatehclk = 0;
power.b.stoppclk = 0;
USB_OTG_WRITE_REG32(pdev->regs.PCGCCTL, power.d32);
}
/* active Remote wakeup signaling */
dctl.d32 = 0;
dctl.b.rmtwkupsig = 1;
USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DCTL, 0, dctl.d32);
USB_OTG_BSP_mDelay(5);
USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DCTL, dctl.d32, 0);
}
}
}
示例3: USB_OTG_BSP_ConfigVBUS
void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
{
#ifndef USE_USB_OTG_HS
GPIO_InitTypeDef GPIO_InitStructure;
#ifdef USE_STM3210C_EVAL
RCC_APB2PeriphClockCmd(HOST_POWERSW_PORT_RCC, ENABLE);
/* Configure Power Switch Vbus Pin */
GPIO_InitStructure.GPIO_Pin = HOST_POWERSW_VBUS;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(HOST_POWERSW_PORT, &GPIO_InitStructure);
#else
#ifdef USE_USB_OTG_FS
RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOH , ENABLE);
GPIO_InitStructure.GPIO_Pin = HOST_POWERSW_VBUS;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(HOST_POWERSW_PORT,&GPIO_InitStructure);
#endif
#endif
/* By Default, DISABLE is needed on output of the Power Switch */
GPIO_SetBits(HOST_POWERSW_PORT, HOST_POWERSW_VBUS);
USB_OTG_BSP_mDelay(200); /* Delay is need for stabilising the Vbus Low
in Reset Condition, when Vbus=1 and Reset-button is pressed by user */
#endif
}
示例4: Image_Browser
static uint8_t Image_Browser (char* path)
{
FRESULT res;
uint8_t ret = 1;
FILINFO fno;
DIR dir;
char *fn;
uint8_t key = 0;
res = f_opendir(&dir, path);
if (res == FR_OK) {
for (;;) {
res = f_readdir(&dir, &fno);
if (res != FR_OK || fno.fname[0] == 0) break;
if (fno.fname[0] == '.') continue;
fn = fno.fname;
if (fno.fattrib & AM_DIR)
{
continue;
}
else
{
if((strstr(fn, "bmp")) || (strstr(fn, "BMP")))
{
res = f_open(&file, fn, FA_OPEN_EXISTING | FA_READ);
Show_Image();
USB_OTG_BSP_mDelay(100);
ret = 0;
// while((HCD_IsDeviceConnected(&USB_OTG_Core)))// && \
//// (STM_EVAL_PBGetState (BUTTON_KEY) == SET))
// {
// Toggle_Leds();
// }
while(key != '1')
{
SerialKeyPressed((uint8_t*)&key);
Toggle_Leds();
}
key = 0;
f_close(&file);
}
}
}
}
#ifdef USE_USB_OTG_HS
LCD_LOG_SetHeader(" USB OTG HS MSC Host");
#else
LCD_LOG_SetHeader(" USB OTG FS MSC Host");
#endif
LCD_LOG_SetFooter (" USB Host Library v2.1.0" );
LCD_UsrLog("> Disk capacity : %d Bytes\n", USBH_MSC_Param.MSCapacity * \
USBH_MSC_Param.MSPageLength);
USBH_USR_ApplicationState = USH_USR_FS_READLIST;
return ret;
}
示例5: USR_KEYBRD_ProcessData
void USR_KEYBRD_ProcessData(uint8_t pbuf) {
led_state(4, 1);
USB_OTG_BSP_mDelay(50);
led_state(4, 0);
//lcd_print_strn((char*)&pbuf, 1);
usb_keyboard_key = pbuf;
}
示例6: DFU_Req_DETACH
/**
* @brief DFU_Req_DETACH
* Handles the DFU DETACH request.
* @param pdev: device instance
* @param req: pointer to the request structure.
* @retval None.
*/
static void DFU_Req_DETACH(void *pdev, USB_SETUP_REQ *req)
{
if (DeviceState == STATE_dfuIDLE || DeviceState == STATE_dfuDNLOAD_SYNC
|| DeviceState == STATE_dfuDNLOAD_IDLE || DeviceState == STATE_dfuMANIFEST_SYNC
|| DeviceState == STATE_dfuUPLOAD_IDLE )
{
/* Update the state machine */
DeviceState = STATE_dfuIDLE;
DeviceStatus[0] = STATUS_OK;
DeviceStatus[1] = 0;
DeviceStatus[2] = 0;
DeviceStatus[3] = 0; /*bwPollTimeout=0ms*/
DeviceStatus[4] = DeviceState;
DeviceStatus[5] = 0; /*iString*/
wBlockNum = 0;
wlength = 0;
}
/* Check the detach capability in the DFU functional descriptor */
if ((usbd_dfu_CfgDesc[12 + (9 * USBD_ITF_MAX_NUM)]) & DFU_DETACH_MASK)
{
/* Perform an Attach-Detach operation on USB bus */
DCD_DevDisconnect (pdev);
DCD_DevConnect (pdev);
}
else
{
/* Wait for the period of time specified in Detach request */
USB_OTG_BSP_mDelay (req->wValue);
}
}
示例7: USB_OTG_BSP_ConfigVBUS
void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
{
USB_OTG_BSP_mDelay(200); /* Delay is need for stabilising the Vbus Low
in Reset Condition, when Vbus=1 and Reset-button is pressed by user */
}
示例8: DCD_DevDisconnect
/**
* @brief Disconnect device (disable internal pull-up)
* @param pdev: device instance
* @retval : None
*/
void DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev)
{
#ifndef USE_OTG_MODE
USB_OTG_DCTL_TypeDef dctl;
dctl.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DCTL);
/* Disconnect device for 3ms */
dctl.b.sftdiscon = 1;
USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DCTL, dctl.d32);
USB_OTG_BSP_mDelay(3);
#endif
}
示例9: DCD_DevConnect
//--------------------------------------------------------------
void DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev)
{
USB_OTG_DCTL_TypeDef dctl;
dctl.d32 = USB_OTG_READ_REG32(&pdev->regs.DREGS->DCTL);
/* Connect device */
dctl.b.sftdiscon = 0;
USB_OTG_WRITE_REG32(&pdev->regs.DREGS->DCTL, dctl.d32);
USB_OTG_BSP_mDelay(3);
}
示例10: main
int main(void) {
init();
/*
* Disable STDOUT buffering. Otherwise nothing will be printed
* before a newline character or when the buffer is flushed.
*/
setbuf(stdout, NULL);
while(1) {
printf("Test!\n");
USB_OTG_BSP_mDelay(500);
}
return 0;
}
示例11: USB_OTG_BSP_ConfigVBUS
/**
* @brief USB_OTG_BSP_ConfigVBUS
* Configures the IO for the Vbus and OverCurrent
* @param None
* @retval None
*/
void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(HOST_POWERSW_PORT_RCC , ENABLE);
GPIO_InitStructure.GPIO_Pin = HOST_POWERSW_VBUS;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
GPIO_Init(HOST_POWERSW_PORT,&GPIO_InitStructure);
/* By Default, DISABLE is needed on output of the Power Switch */
GPIO_SetBits(HOST_POWERSW_PORT, HOST_POWERSW_VBUS);
USB_OTG_BSP_mDelay(200); /* Delay is need for stabilising the Vbus Low
in Reset Condition, when Vbus=1 and Reset-button is pressed by user */
}
示例12: USB_OTG_SetCurrentMode
//--------------------------------------------------------------
USB_OTG_STS USB_OTG_SetCurrentMode(USB_OTG_CORE_HANDLE * pdev, uint8_t mode)
{
USB_OTG_STS status = USB_OTG_OK;
USB_OTG_GUSBCFG_TypeDef usbcfg;
usbcfg.d32 = USB_OTG_READ_REG32(&pdev->regs.GREGS->GUSBCFG);
usbcfg.b.force_host = 0;
usbcfg.b.force_dev = 0;
if (mode == HOST_MODE) {
usbcfg.b.force_host = 1;
} else if (mode == DEVICE_MODE) {
usbcfg.b.force_dev = 1;
}
USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GUSBCFG, usbcfg.d32);
USB_OTG_BSP_mDelay(50);
return status;
}
示例13: USB_OTG_BSP_Resume
/**
* @brief USB_OTG_BSP_Resume
* Handles the USB Resume from Suspend Mode
* @param pdev: Selected device
* @retval Status
*/
void USB_OTG_BSP_Resume(USB_OTG_CORE_HANDLE *pdev)
{
USB_OTG_HPRT0_TypeDef hprt0;
USB_OTG_PCGCCTL_TypeDef power;
hprt0.d32 = 0;
/* switch-off the clocks */
power.d32 = 0;
power.b.stoppclk = 1;
USB_OTG_MODIFY_REG32(pdev->regs.PCGCCTL,power.d32, 0 );
power.b.gatehclk = 1;
USB_OTG_MODIFY_REG32(pdev->regs.PCGCCTL,power.d32, 0);
hprt0.d32 = 0;
hprt0.d32 = USB_OTG_ReadHPRT0(pdev);
hprt0.b.prtsusp = 0;
hprt0.b.prtres = 1;
USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
USB_OTG_BSP_mDelay (20);
hprt0.b.prtres = 0;
USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
}
示例14: USB_OTG_DriveVbus
//--------------------------------------------------------------
void USB_OTG_DriveVbus (USB_OTG_CORE_HANDLE *pdev, uint8_t state)
{
USB_OTG_HPRT0_TypeDef hprt0;
hprt0.d32 = 0;
/* enable disable the external charge pump */
USB_OTG_BSP_DriveVBUS(pdev, state);
/* Turn on the Host port power. */
hprt0.d32 = USB_OTG_ReadHPRT0(pdev);
if ((hprt0.b.prtpwr == 0 ) && (state == 1 ))
{
hprt0.b.prtpwr = 1;
USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
}
if ((hprt0.b.prtpwr == 1 ) && (state == 0 ))
{
hprt0.b.prtpwr = 0;
USB_OTG_WRITE_REG32(pdev->regs.HPRT0, hprt0.d32);
}
USB_OTG_BSP_mDelay(200);
}
开发者ID:m4th3u5,项目名称:USB-HID--host-keyboard-anbt2-final-com-acento--repete--limites---menu-e-correcoes,代码行数:25,代码来源:usb_core.c
示例15: USBH_USR_EnumerationDone
void USBH_USR_EnumerationDone(void)
{
// it's a fix, leave it here for the time being
// 1000 is possibly (not certain) better for ath3k
USB_OTG_BSP_mDelay(500);
}