예제 #1
0
파일: usb_device.c 프로젝트: itxs/STM32F7
void USB_Init()
{
	USBD_Init(&hUsbDeviceHS, &HS_Desc, DEVICE_HS);
	USBD_RegisterClass(&hUsbDeviceHS, &USBD_CUSTOM_HID);
	USBD_CUSTOM_HID_RegisterInterface(&hUsbDeviceHS, &USBD_CustomHID_fops_HS);
	USBD_Start(&hUsbDeviceHS);
}
예제 #2
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Global MSP (MCU Support Package) initialization
     */
  HAL_Init();
  
  /* Configure the system clock to 168 MHz */
  SystemClock_Config();

  /* Init Device Library */
  USBD_Init(&USBD_Device, &HID_Desc, 0);
  
  /* Add Supported Class */
  USBD_RegisterClass(&USBD_Device, &USBD_CUSTOM_HID);
  
  /* Add Custom HID callbacks */
  USBD_CUSTOM_HID_RegisterInterface(&USBD_Device, &USBD_CustomHID_fops);
  
  /* Start Device Process */
  USBD_Start(&USBD_Device);
  
  /* Run Application (Interrupt mode) */
  while (1)
  {
  }
}
예제 #3
0
파일: main.c 프로젝트: apeng2012/mi_ma_bao
int main(void)
{
    HAL_Init();

    led_gpio_init();

    SystemClock_Config();

    mima_init();

    usbKB_init();

    USBD_Init(&USBD_Device, &HID_Desc, 0);

    USBD_RegisterClass(&USBD_Device, USBD_HID_CLASS);

    USBD_CUSTOM_HID_RegisterInterface(&USBD_Device, &USBD_CustomHID_fops);

    USBD_Start(&USBD_Device);

    HAL_Delay(1000);
    USB_KB_type("Hello world", 11);

    while(1) {
        HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_7);
        mima_loop();
    }
}
예제 #4
0
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* STM32F0xx HAL library initialization:
       - Configure the Flash prefetch, Flash preread and Buffer caches
       - Systick timer is configured by default as source of time base, but user 
             can eventually implement his proper time base source (a general purpose 
             timer for example or other time source), keeping in mind that Time base 
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
             handled in milliseconds basis.
       - Low Level Initialization
     */
  HAL_Init();
  
  /* Configure the system clock to get correspondent USB clock source */
  SystemClock_Config();
  
  /* Init Device Library */
  USBD_Init(&USBD_Device, &HID_Desc, 0);
  
  /* Register the Custom HID class */
  USBD_RegisterClass(&USBD_Device, &USBD_CUSTOM_HID);
  
  /* Add Custom HID callbacks */
  USBD_CUSTOM_HID_RegisterInterface(&USBD_Device, &USBD_CustomHID_fops);
  
  /* Start Device Process */
  USBD_Start(&USBD_Device);
  
  while (1)
  {
  }
}
예제 #5
0
int main(void)
{

  HAL_Init();
  SystemClock_Config();

  MX_GPIO_Init();
  MX_CAN_Init();
  MX_I2C1_Init();
  MX_USART3_UART_Init();
  MX_USART2_UART_Init();
  MX_USART1_UART_Init();
  MX_TIM1_Init();
  USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);
  USBD_RegisterClass(&hUsbDeviceFS, &USBD_CUSTOM_HID);
  USBD_CUSTOM_HID_RegisterInterface(&hUsbDeviceFS, &USBD_CustomHID_fops_FS);
  USBD_Start(&hUsbDeviceFS);

  while (1)
  {

  /* USER CODE END WHILE */


  /* USER CODE BEGIN 3 */
	  HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_1);
	  HAL_Delay(blinkingDelay);
  }
  /* USER CODE END 3 */

}
예제 #6
0
CHidReport::CHidReport() {
	/* Init Device Library,Add Supported Class and Start the library*/
	USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);

	USBD_RegisterClass(&hUsbDeviceFS, &USBD_CUSTOM_HID);

	USBD_CUSTOM_HID_RegisterInterface(&hUsbDeviceFS, &USBD_CustomHID_fops_FS);

	USBD_Start(&hUsbDeviceFS);
}
예제 #7
0
void io_usb_enable(unsigned char enabled) {
  if (enabled) {
    os_memset(&USBD_Device, 0, sizeof(USBD_Device));
    /* Init Device Library */
    USBD_Init(&USBD_Device, &HID_Desc, 0);
    
    /* Register the HID class */
    USBD_RegisterClass(&USBD_Device, &USBD_CUSTOM_HID);

    USBD_CUSTOM_HID_RegisterInterface(&USBD_Device, &USBD_CustomHID_template_fops);
    
    /* Start Device Process */
    USBD_Start(&USBD_Device);
  }
  else {
    USBD_DeInit(&USBD_Device);
  }
}
예제 #8
0
파일: main.c 프로젝트: vlsi1217/STM32F7Cube
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /* Enable the CPU Cache */
  CPU_CACHE_Enable();
  
  /* STM32F7xx HAL library initialization:
       - Configure the Flash ART accelerator on ITCM interface
       - Configure the Systick to generate an interrupt each 1 msec
       - Set NVIC Group Priority to 4
       - Low Level Initialization
     */
  HAL_Init();
  
  /* Configure the System clock to have a frequency of 216 MHz */
  SystemClock_Config();
    
  /* Initialize IO expander */
  BSP_IO_Init();

  /* Init Device Library */
  USBD_Init(&USBD_Device, &HID_Desc, 0);
  
  /* Add Supported Class */
  USBD_RegisterClass(&USBD_Device, &USBD_CUSTOM_HID);
  
  /* Add Custom HID callbacks */
  USBD_CUSTOM_HID_RegisterInterface(&USBD_Device, &USBD_CustomHID_fops);
  
  /* Start Device Process */
  USBD_Start(&USBD_Device);
  
  /* Run Application (Interrupt mode) */
  while (1)
  {
  }
}