当前位置: 首页>>代码示例>>C++>>正文


C++ USB_Cable_Config函数代码示例

本文整理汇总了C++中USB_Cable_Config函数的典型用法代码示例。如果您正苦于以下问题:C++ USB_Cable_Config函数的具体用法?C++ USB_Cable_Config怎么用?C++ USB_Cable_Config使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了USB_Cable_Config函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: f_usb_enable

static int f_usb_enable(int ena) {
  if (_argc != 1) {
    return -1;
  }
  if (ena) {
    print("Enable usb\n");
    USB_Cable_Config(ENABLE);
    USB_ARC_init();
  } else {
    print("Disable usb\n");
    USB_Cable_Config(DISABLE);
  }
  return 0;
}
开发者ID:godzivan,项目名称:arcadehid,代码行数:14,代码来源:cli.c

示例2: PowerOn

/*******************************************************************************
* Function Name  : PowerOn
* Description    :
* Input          : None.
* Output         : None.
* Return         : USB_SUCCESS.
*******************************************************************************/
RESULT PowerOn(void)
{
#ifndef STM32F10X_CL
  uint16_t wRegVal;
  
  /*** cable plugged-in ? ***/
  /*while(!CablePluggedIn());*/
  USB_Cable_Config(ENABLE);

  /*** CNTR_PWDN = 0 ***/
  wRegVal = CNTR_FRES;
  _SetCNTR(wRegVal);

  /*** CNTR_FRES = 0 ***/
  wInterrupt_Mask = 0;
  _SetCNTR(wInterrupt_Mask);
  /*** Clear pending interrupts ***/
  _SetISTR(0);
  /*** Set interrupt mask ***/
  wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
  _SetCNTR(wInterrupt_Mask);
#endif /* STM32F10X_CL */
  
  return USB_SUCCESS;
}
开发者ID:Treadmule,项目名称:deviation,代码行数:32,代码来源:usb_pwr.c

示例3: main

 int main(void)
 { 
	delay_init();	    	 //延时函数初始化	  
	uart_init(9600);	 	//串口初始化为9600
	LED_Init();		  		//初始化与LED连接的硬件接口
	 LED0=1;
	 LED1=1;
	LED2=1;
	USB_Cable_Config (ENABLE); 
	delay_ms(500);
	USB_Port_Set(0); 	
	delay_ms(500);
	USB_Port_Set(1);	
 	Set_USBClock();   
 	USB_Interrupts_Config();    
 	USB_Init();	 	 
	 	 	
	 SPI_IO_Init(); 
	 DMA_configuration();
	spi_conf(SPI_DEFAULT_SPEED);
	LED1=0;
	LED2=0;
	while(1)
	{	
		/* Get command */
    serprog_handle_command(usb_getc());
    /* Flush output via USB */
    usb_sync();
		
	}
}
开发者ID:duxingkei33,项目名称:serprog-stm32-gd32,代码行数:31,代码来源:main.c

示例4: PowerOn

/*******************************************************************************
* Function Name  : PowerOn
* Description    :
* Input          : None.
* Output         : None.
* Return         : USB_SUCCESS.
*******************************************************************************/
RESULT PowerOn(void)
{
#ifndef STM32F10X_CL
  uint16_t wRegVal;
  
  /*** cable plugged-in ? ***/
  /*while(!CablePluggedIn());*/
  USB_Cable_Config(ENABLE);//使能usb控制引脚  PD9 改为PA8

  /*** CNTR_PWDN = 0 ***/
  wRegVal = CNTR_FRES;
  _SetCNTR(wRegVal);//清除CNTR寄存器上的PWDN P406

  /*** CNTR_FRES = 0 ***/
  wInterrupt_Mask = 0;
  _SetCNTR(wInterrupt_Mask);//清除CNTR寄存器上的FRES
  /*** Clear pending interrupts ***/
  _SetISTR(0);
  /*** Set interrupt mask ***/ 
  wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;//P413
  _SetCNTR(wInterrupt_Mask);//使能复位中断,唤醒中断,挂起中断 p412
#endif /* STM32F10X_CL */
  
  return USB_SUCCESS;
}
开发者ID:rgwan,项目名称:stm32-gcc,代码行数:32,代码来源:usb_pwr.c

示例5: USB_Configs

void USB_Configs()
{
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); 
	USB_Cable_Config(ENABLE);
	USB_Interrupts_Config();    
	Set_USBClock();  
	USB_Init();	
}
开发者ID:RTOS-Developers,项目名称:TRTOS,代码行数:8,代码来源:Usb_App.c

示例6: PowerOff

/**
  * @brief  handles switch-off conditions
  * @param  None.
  * @retval USB_SUCCESS.
  */
RESULT PowerOff()
{
	_SetCNTR(CNTR_FRES);			/* disable all interrupts and force USB reset */
	_SetISTR(0);					/* clear interrupt status register */
	USB_Cable_Config(DISABLE);		/* Disable the Pull-Up*/
	_SetCNTR(CNTR_FRES + CNTR_PDWN);/* switch-off device */

	return USB_SUCCESS;
}
开发者ID:thegeek82000,项目名称:rlc-meter-balmer-1,代码行数:14,代码来源:usb_pwr.c

示例7: USBDevice_Connect

void USBDevice_Connect()
{
    DBG_MSG("called", 0);
    if(!InitMemoryInfo())
        return;
    USB_Interrupts_Config(ENABLE);
    USB_Cable_Config(ENABLE);
    USB_Init();
}
开发者ID:jackeyjiang,项目名称:3DPrinter-firmware,代码行数:9,代码来源:usb.c

示例8: Set_System

/**
  * @brief  Configures USB Cable.
  * @param  None
  * @retval None
  */
void Set_System(void)
{
  /* Unlock the internal flash */
  FLASH_Unlock();

  /* Configure the USB Disconnect Pin */
  iNEMO_USB_Disconnet_Pin_Config();
  
  /*Disable the USB Cable*/
  USB_Cable_Config(DISABLE);

  
  /* Init the media interface */
  MAL_Init();
  
  /*Enable the USB Cable*/
  USB_Cable_Config(ENABLE);

}
开发者ID:ultrasystem,项目名称:iNemoSuite,代码行数:24,代码来源:main.c

示例9: USB_USART_Init

/*******************************************************************************
 * Function Name  : USB_USART_Init
 * Description    : Start USB-USART protocol.
 * Input          : baudRate (0 : disconnect usb else init usb only once).
 * Return         : None.
 *******************************************************************************/
void USB_USART_Init(uint32_t baudRate)
{
    if (linecoding.bitrate != baudRate)
    {
        if (!baudRate)
        {
            USB_Cable_Config(DISABLE);
        }
        else if (!linecoding.bitrate)
        {
            //Perform a Detach-Attach operation on USB bus
            USB_Cable_Config(DISABLE);
            USB_Cable_Config(ENABLE);

            //Initialize USB device only once (if linecoding.bitrate==0)
            SPARK_USB_Setup();
        }
        //linecoding.bitrate will be overwritten by USB Host
        linecoding.bitrate = baudRate;
    }
}
开发者ID:rac146,项目名称:firmware1,代码行数:27,代码来源:usb_hal.c

示例10: usb_config

void usb_config(void) {
    GPIO_InitTypeDef gpioInitStructure;
    EXTI_InitTypeDef extiInitStructure;
    NVIC_InitTypeDef nvicInitStructure;

    print_info("usb_config\n");

    ring_buffer_init(&usb_tx_ring_buffer, usb_tx_buffer, USB_TX_BUFFER_SIZE);

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);

    /* Enable the USB disconnect GPIO clock */
    RCC_APB2PeriphClockCmd(USB_DISCONNECT_RCC, ENABLE);

    /* USB_DISCONNECT used as USB pull-up */
    gpioInitStructure.GPIO_Pin = USB_DISCONNECT_PIN;
    gpioInitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    gpioInitStructure.GPIO_Speed = GPIO_Speed_2MHz;
    GPIO_Init(USB_DISCONNECT, &gpioInitStructure);

    /* Configure the EXTI line 18 connected internally to the USB IP */
    EXTI_ClearITPendingBit(EXTI_Line18);
    extiInitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
    extiInitStructure.EXTI_Line = EXTI_Line18;
    extiInitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
    extiInitStructure.EXTI_LineCmd = ENABLE;
    EXTI_Init(&extiInitStructure);

    USB_Cable_Config(DISABLE);

    /* Enable USB clock */
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);

    nvicInitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
    nvicInitStructure.NVIC_IRQChannelPreemptionPriority = 2;
    nvicInitStructure.NVIC_IRQChannelSubPriority = 0;
    nvicInitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&nvicInitStructure);

    /* Enable the USB Wake-up interrupt */
    nvicInitStructure.NVIC_IRQChannel = USBWakeUp_IRQn;
    nvicInitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_Init(&nvicInitStructure);

    print_info("USB_Init\n");
    USB_Init();
    delay_ms(100); // TODO remove?
}
开发者ID:Aharobot,项目名称:telepresenceRobot,代码行数:49,代码来源:usb.c

示例11: Set_USBPullUp

void Set_USBPullUp()
{
	GPIO_InitTypeDef GPIO_InitStructure;

	/* Enable GPIO clock */
	RCC_APB2PeriphClockCmd(USB_PULLUP_RCC_APB2PERIPH, ENABLE);

	/* Setup USB pull-up */
	GPIO_InitStructure.GPIO_Pin = USB_PULLUP_GPIO_BIT;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
	GPIO_Init(USB_PULLUP_GPIO_PORT, &GPIO_InitStructure);

	USB_Cable_Config(DISABLE);
}
开发者ID:ozwin,项目名称:desenet,代码行数:15,代码来源:usb-vcom-hw-config.cpp

示例12: main

/*******************************************************************************
* Function Name  : main.
* Description    : main routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
int main(void)
{
	NVIC_InitTypeDef NVIC_InitStructure;
  DFU_Button_Config();

  /* Check if the Key push-button on STM3210x-EVAL Board is pressed */
  if (DFU_Button_Read() != 0x00)
  { /* Test if user code is programmed starting from address 0x8003000 */
    if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
    { /* Jump to user application */

      JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
      Jump_To_Application = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) ApplicationAddress);
      Jump_To_Application();
    }
  } /* Otherwise enters DFU mode to allow user to program his application */

  /* Enter DFU mode */
  DeviceState = STATE_dfuERROR;
  DeviceStatus[0] = STATUS_ERRFIRMWARE;
  DeviceStatus[4] = DeviceState;

	RCC_Configuration();
	NVIC_Configuration();
  
  NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);

	GPIO_Configuration();

  /* Init the media interface */
  MAL_Init();
  
	/* potrebne ? */
	USB_Cable_Config(ENABLE);
	
  //USB_Init();
	USB_Init(&Device_Table, &Device_Property, &User_Standard_Requests);
  /* Main loop */
  while (1)
  {}
}
开发者ID:Farewellly,项目名称:STM32,代码行数:54,代码来源:main.c

示例13: PowerOff

/*******************************************************************************
* Function Name  : PowerOff
* Description    : handles switch-off conditions
* Input          : None.
* Output         : None.
* Return         : USB_SUCCESS.
*******************************************************************************/
RESULT PowerOff()
{
#ifndef STM32F10X_CL
  /* disable all interrupts and force USB reset */
  _SetCNTR(CNTR_FRES);
  /* clear interrupt status register */
  _SetISTR(0);
  /* Disable the Pull-Up*/
  USB_Cable_Config(DISABLE);
  /* switch-off device */
  _SetCNTR(CNTR_FRES + CNTR_PDWN);
  /* sw variables reset */
  /* ... */
#endif /* STM32F10X_CL */

  return USB_SUCCESS;
}
开发者ID:bistromath,项目名称:tach,代码行数:24,代码来源:usb_pwr.c

示例14: PowerOn

/**
  * @brief  PowerOn
  * @param  None.
  * @retval USB_SUCCESS.
  */
RESULT PowerOn(void)
{
	uint16_t wRegVal;

	USB_Cable_Config(ENABLE);	/*** cable plugged-in ? ***/
	wRegVal = CNTR_FRES;		/*** CNTR_PWDN = 0 ***/
	_SetCNTR(wRegVal);

	wInterrupt_Mask = 0;		/*** CNTR_FRES = 0 ***/
	_SetCNTR(wInterrupt_Mask);
	
	_SetISTR(0);				/*** Clear pending interrupts ***/
								/*** Set interrupt mask ***/
	wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
	_SetCNTR(wInterrupt_Mask);

	return USB_SUCCESS;
}
开发者ID:thegeek82000,项目名称:rlc-meter-balmer-1,代码行数:23,代码来源:usb_pwr.c

示例15: PowerOn

/*******************************************************************************
* Function Name  : PowerOn
* Description    :
* Input          : None.
* Output         : None.
* Return         : USB_SUCCESS.
*******************************************************************************/
RESULT PowerOn(void)
{
  u16 wRegVal;
  USB_Cable_Init();
  USB_Cable_Config(ENABLE);//使能1.5K上拉 
  /*** CNTR_PWDN = 0 ***/
  wRegVal = CNTR_FRES;
  _SetCNTR(wRegVal);	 
  /*** CNTR_FRES = 0 ***/
  wInterrupt_Mask = 0;
  _SetCNTR(wInterrupt_Mask);
  /*** Clear pending interrupts ***/
  _SetISTR(0);
  /*** Set interrupt mask ***/
  wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
  _SetCNTR(wInterrupt_Mask);	 
  return USB_SUCCESS;
}
开发者ID:blackmiaool,项目名称:cattyware,代码行数:25,代码来源:usb_pwr.c


注:本文中的USB_Cable_Config函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。