xref: /btstack/port/stm32-f4discovery-usb/USB_HOST/Target/usbh_platform.c (revision a8f7f3fcbcd51f8d2e92aca076b6a9f812db358c)
1*a8f7f3fcSMatthias Ringwald /* USER CODE BEGIN Header */
2*a8f7f3fcSMatthias Ringwald /**
3*a8f7f3fcSMatthias Ringwald   ******************************************************************************
4*a8f7f3fcSMatthias Ringwald   * @file           : usbh_platform.c
5*a8f7f3fcSMatthias Ringwald 
6*a8f7f3fcSMatthias Ringwald   * @brief          : This file implements the USB platform
7*a8f7f3fcSMatthias Ringwald   ******************************************************************************
8*a8f7f3fcSMatthias Ringwald   * @attention
9*a8f7f3fcSMatthias Ringwald   *
10*a8f7f3fcSMatthias Ringwald   * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
11*a8f7f3fcSMatthias Ringwald   * All rights reserved.</center></h2>
12*a8f7f3fcSMatthias Ringwald   *
13*a8f7f3fcSMatthias Ringwald   * This software component is licensed by ST under Ultimate Liberty license
14*a8f7f3fcSMatthias Ringwald   * SLA0044, the "License"; You may not use this file except in compliance with
15*a8f7f3fcSMatthias Ringwald   * the License. You may obtain a copy of the License at:
16*a8f7f3fcSMatthias Ringwald   *                             www.st.com/SLA0044
17*a8f7f3fcSMatthias Ringwald   *
18*a8f7f3fcSMatthias Ringwald   ******************************************************************************
19*a8f7f3fcSMatthias Ringwald   */
20*a8f7f3fcSMatthias Ringwald /* USER CODE END Header */
21*a8f7f3fcSMatthias Ringwald 
22*a8f7f3fcSMatthias Ringwald /* Includes ------------------------------------------------------------------*/
23*a8f7f3fcSMatthias Ringwald #include "usbh_platform.h"
24*a8f7f3fcSMatthias Ringwald 
25*a8f7f3fcSMatthias Ringwald /* USER CODE BEGIN INCLUDE */
26*a8f7f3fcSMatthias Ringwald 
27*a8f7f3fcSMatthias Ringwald /* USER CODE END INCLUDE */
28*a8f7f3fcSMatthias Ringwald 
29*a8f7f3fcSMatthias Ringwald /**
30*a8f7f3fcSMatthias Ringwald   * @brief  Drive VBUS.
31*a8f7f3fcSMatthias Ringwald   * @param  state : VBUS state
32*a8f7f3fcSMatthias Ringwald   *          This parameter can be one of the these values:
33*a8f7f3fcSMatthias Ringwald   *           - 1 : VBUS Active
34*a8f7f3fcSMatthias Ringwald   *           - 0 : VBUS Inactive
35*a8f7f3fcSMatthias Ringwald   */
MX_DriverVbusFS(uint8_t state)36*a8f7f3fcSMatthias Ringwald void MX_DriverVbusFS(uint8_t state)
37*a8f7f3fcSMatthias Ringwald {
38*a8f7f3fcSMatthias Ringwald   uint8_t data = state;
39*a8f7f3fcSMatthias Ringwald   /* USER CODE BEGIN PREPARE_GPIO_DATA_VBUS_FS */
40*a8f7f3fcSMatthias Ringwald   if(state == 0)
41*a8f7f3fcSMatthias Ringwald   {
42*a8f7f3fcSMatthias Ringwald     /* Drive high Charge pump */
43*a8f7f3fcSMatthias Ringwald     data = GPIO_PIN_SET;
44*a8f7f3fcSMatthias Ringwald   }
45*a8f7f3fcSMatthias Ringwald   else
46*a8f7f3fcSMatthias Ringwald   {
47*a8f7f3fcSMatthias Ringwald     /* Drive low Charge pump */
48*a8f7f3fcSMatthias Ringwald     data = GPIO_PIN_RESET;
49*a8f7f3fcSMatthias Ringwald   }
50*a8f7f3fcSMatthias Ringwald   /* USER CODE END PREPARE_GPIO_DATA_VBUS_FS */
51*a8f7f3fcSMatthias Ringwald   HAL_GPIO_WritePin(GPIOC,GPIO_PIN_0,(GPIO_PinState)data);
52*a8f7f3fcSMatthias Ringwald }
53*a8f7f3fcSMatthias Ringwald 
54*a8f7f3fcSMatthias Ringwald /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
55