Initial commit
This commit is contained in:
commit
66c5a26d69
1145 changed files with 938088 additions and 0 deletions
115
USB-PD_Provider_1port/Inc/FreeRTOSConfig.h
Normal file
115
USB-PD_Provider_1port/Inc/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/*
|
||||
* FreeRTOS Kernel V10.3.1
|
||||
* Portion Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Portion Copyright (C) 2019 StMicroelectronics, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* These parameters and more are described within the 'configuration' section of the
|
||||
* FreeRTOS API documentation available on the FreeRTOS.org web site.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* Section where include file can be added */
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Ensure definitions are only used by the compiler, and not by the assembler. */
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
extern uint32_t SystemCoreClock;
|
||||
void xPortSysTickHandler(void);
|
||||
#endif
|
||||
#define configENABLE_FPU 0
|
||||
#define configENABLE_MPU 0
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)5000)
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 8
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
/* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */
|
||||
/* Defaults to size_t for backward compatibility, but can be changed
|
||||
if lengths will always be less than the number of bytes in a size_t. */
|
||||
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
|
||||
/* USER CODE END MESSAGE_BUFFER_LENGTH_TYPE */
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 0
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
|
||||
/* Normal assert() semantics without relying on the provision of an assert.h
|
||||
header file. */
|
||||
/* USER CODE BEGIN 1 */
|
||||
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
|
||||
standard names. */
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
|
||||
/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,
|
||||
to prevent overwriting SysTick_Handler defined within STM32Cube HAL */
|
||||
|
||||
/* #define xPortSysTickHandler SysTick_Handler */
|
||||
|
||||
/* USER CODE BEGIN Defines */
|
||||
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
||||
/* USER CODE END Defines */
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
112
USB-PD_Provider_1port/Inc/main.h
Normal file
112
USB-PD_Provider_1port/Inc/main.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.h
|
||||
* @brief : Header for main.c file.
|
||||
* This file contains the common defines of the application.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32g0xx_hal.h"
|
||||
#include "stm32g0xx_ll_dma.h"
|
||||
#include "stm32g0xx_ll_rcc.h"
|
||||
#include "stm32g0xx_ll_bus.h"
|
||||
#include "stm32g0xx_ll_crs.h"
|
||||
#include "stm32g0xx_ll_system.h"
|
||||
#include "stm32g0xx_ll_exti.h"
|
||||
#include "stm32g0xx_ll_cortex.h"
|
||||
#include "stm32g0xx_ll_utils.h"
|
||||
#include "stm32g0xx_ll_pwr.h"
|
||||
#include "stm32g0xx_ll_ucpd.h"
|
||||
#include "stm32g0xx_ll_usart.h"
|
||||
#include "stm32g0xx_ll_gpio.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
#define USBPD_FW_VERSION 0x16092020
|
||||
#define VCONN_EN2_Pin LL_GPIO_PIN_9
|
||||
#define VCONN_EN2_GPIO_Port GPIOB
|
||||
#define V_CTL1_Pin LL_GPIO_PIN_2
|
||||
#define V_CTL1_GPIO_Port GPIOC
|
||||
#define VSENSE_2_Pin LL_GPIO_PIN_3
|
||||
#define VSENSE_2_GPIO_Port GPIOA
|
||||
#define VCONN_DISCHARGE2_Pin LL_GPIO_PIN_0
|
||||
#define VCONN_DISCHARGE2_GPIO_Port GPIOB
|
||||
#define VSENSE_1_Pin LL_GPIO_PIN_10
|
||||
#define VSENSE_1_GPIO_Port GPIOB
|
||||
#define VSENSE_DCDC_Pin LL_GPIO_PIN_11
|
||||
#define VSENSE_DCDC_GPIO_Port GPIOB
|
||||
#define ISENSE_2_Pin LL_GPIO_PIN_12
|
||||
#define ISENSE_2_GPIO_Port GPIOB
|
||||
#define VBUS_DISCHARGE1_Pin LL_GPIO_PIN_13
|
||||
#define VBUS_DISCHARGE1_GPIO_Port GPIOB
|
||||
#define VBUS_DISCHARGE2_Pin LL_GPIO_PIN_14
|
||||
#define VBUS_DISCHARGE2_GPIO_Port GPIOB
|
||||
#define SOURCE_EN_Pin LL_GPIO_PIN_3
|
||||
#define SOURCE_EN_GPIO_Port GPIOD
|
||||
#define VCONN_EN1_Pin LL_GPIO_PIN_4
|
||||
#define VCONN_EN1_GPIO_Port GPIOD
|
||||
void MX_GPIO_Init(void);
|
||||
void MX_DMA_Init(void);
|
||||
void MX_UCPD1_Init(void);
|
||||
void MX_ADC1_Init(void);
|
||||
void MX_USART3_UART_Init(void);
|
||||
void MX_LPTIM1_Init(void);
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
53
USB-PD_Provider_1port/Inc/stm32_assert.h
Normal file
53
USB-PD_Provider_1port/Inc/stm32_assert.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_assert.h
|
||||
* @brief STM32 assert file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32_ASSERT_H
|
||||
#define __STM32_ASSERT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr: If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32_ASSERT_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
352
USB-PD_Provider_1port/Inc/stm32g0xx_hal_conf.h
Normal file
352
USB-PD_Provider_1port/Inc/stm32g0xx_hal_conf.h
Normal file
|
@ -0,0 +1,352 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32g0xx_hal_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief HAL configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32G0xx_HAL_CONF_H
|
||||
#define STM32G0xx_HAL_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
#define HAL_MODULE_ENABLED
|
||||
#define HAL_ADC_MODULE_ENABLED
|
||||
/* #define HAL_CEC_MODULE_ENABLED */
|
||||
/* #define HAL_COMP_MODULE_ENABLED */
|
||||
/* #define HAL_CRC_MODULE_ENABLED */
|
||||
/* #define HAL_CRYP_MODULE_ENABLED */
|
||||
/* #define HAL_DAC_MODULE_ENABLED */
|
||||
/* #define HAL_EXTI_MODULE_ENABLED */
|
||||
/* #define HAL_FDCAN_MODULE_ENABLED */
|
||||
/* #define HAL_HCD_MODULE_ENABLED */
|
||||
/* #define HAL_I2C_MODULE_ENABLED */
|
||||
/* #define HAL_I2S_MODULE_ENABLED */
|
||||
/* #define HAL_IWDG_MODULE_ENABLED */
|
||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||
#define HAL_LPTIM_MODULE_ENABLED
|
||||
/* #define HAL_PCD_MODULE_ENABLED */
|
||||
/* #define HAL_RNG_MODULE_ENABLED */
|
||||
/* #define HAL_RTC_MODULE_ENABLED */
|
||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||
/* #define HAL_SPI_MODULE_ENABLED */
|
||||
/* #define HAL_TIM_MODULE_ENABLED */
|
||||
/* #define HAL_UART_MODULE_ENABLED */
|
||||
/* #define HAL_USART_MODULE_ENABLED */
|
||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
#define HAL_EXTI_MODULE_ENABLED
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
#define HAL_RCC_MODULE_ENABLED
|
||||
#define HAL_FLASH_MODULE_ENABLED
|
||||
#define HAL_PWR_MODULE_ENABLED
|
||||
#define HAL_CORTEX_MODULE_ENABLED
|
||||
|
||||
/* ########################## Register Callbacks selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules where register callback can be used
|
||||
*/
|
||||
#define USE_HAL_ADC_REGISTER_CALLBACKS 1u
|
||||
#define USE_HAL_CEC_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_COMP_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_DAC_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_FDCAN_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_HCD_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_I2C_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_I2S_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_PCD_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_RNG_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_RTC_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_SPI_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_TIM_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_UART_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_USART_REGISTER_CALLBACKS 0u
|
||||
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0u
|
||||
|
||||
/* ########################## Oscillator Values adaptation ####################*/
|
||||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE (8000000UL) /*!< Value of the External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||
#define HSE_STARTUP_TIMEOUT (100UL) /*!< Time out for HSE start up, in ms */
|
||||
#endif /* HSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE (16000000UL) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
#if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI48) value for USB FS, SDMMC and RNG.
|
||||
* This internal oscillator is mainly dedicated to provide a high precision clock to
|
||||
* the USB peripheral by means of a special Clock Recovery System (CRS) circuitry.
|
||||
* When the CRS is not used, the HSI48 RC oscillator runs on it default frequency
|
||||
* which is subject to manufacturing process variations.
|
||||
*/
|
||||
#if !defined (HSI48_VALUE)
|
||||
#define HSI48_VALUE 48000000U /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz.
|
||||
The real value my vary depending on manufacturing process variations.*/
|
||||
#endif /* HSI48_VALUE */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Internal Low Speed oscillator (LSI) value.
|
||||
*/
|
||||
#if !defined (LSI_VALUE)
|
||||
#define LSI_VALUE (32000UL) /*!< LSI Typical Value in Hz*/
|
||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||
The real value may vary depending on the variations
|
||||
in voltage and temperature.*/
|
||||
/**
|
||||
* @brief External Low Speed oscillator (LSE) value.
|
||||
* This value is used by the UART, RTC HAL module to compute the system frequency
|
||||
*/
|
||||
#if !defined (LSE_VALUE)
|
||||
#define LSE_VALUE (32768UL) /*!< Value of the External oscillator in Hz*/
|
||||
#endif /* LSE_VALUE */
|
||||
|
||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||
#define LSE_STARTUP_TIMEOUT (5000UL) /*!< Time out for LSE start up, in ms */
|
||||
#endif /* LSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief External clock source for I2S1 peripheral
|
||||
* This value is used by the RCC HAL module to compute the I2S1 clock source
|
||||
* frequency.
|
||||
*/
|
||||
#if !defined (EXTERNAL_I2S1_CLOCK_VALUE)
|
||||
#define EXTERNAL_I2S1_CLOCK_VALUE (48000UL) /*!< Value of the I2S1 External clock source in Hz*/
|
||||
#endif /* EXTERNAL_I2S1_CLOCK_VALUE */
|
||||
|
||||
#if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||
/**
|
||||
* @brief External clock source for I2S2 peripheral
|
||||
* This value is used by the RCC HAL module to compute the I2S2 clock source
|
||||
* frequency.
|
||||
*/
|
||||
#if !defined (EXTERNAL_I2S2_CLOCK_VALUE)
|
||||
#define EXTERNAL_I2S2_CLOCK_VALUE 48000U /*!< Value of the I2S2 External clock source in Hz*/
|
||||
#endif /* EXTERNAL_I2S2_CLOCK_VALUE */
|
||||
#endif
|
||||
|
||||
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
||||
|
||||
/* ########################### System Configuration ######################### */
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY 3U /*!< tick interrupt priority */
|
||||
#define USE_RTOS 0U
|
||||
#define PREFETCH_ENABLE 1U
|
||||
#define INSTRUCTION_CACHE_ENABLE 1U
|
||||
|
||||
/* ################## SPI peripheral configuration ########################## */
|
||||
|
||||
/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
|
||||
* Activated: CRC code is present inside driver
|
||||
* Deactivated: CRC code cleaned from driver
|
||||
*/
|
||||
|
||||
#define USE_SPI_CRC 0U
|
||||
|
||||
/* ################## CRYP peripheral configuration ########################## */
|
||||
|
||||
#define USE_HAL_CRYP_SUSPEND_RESUME 1U
|
||||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
/**
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* HAL drivers code
|
||||
*/
|
||||
/* #define USE_FULL_ASSERT 1U */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Include modules header file
|
||||
*/
|
||||
|
||||
#ifdef HAL_RCC_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_rcc.h"
|
||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_gpio.h"
|
||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_dma.h"
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_cortex.h"
|
||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ADC_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_adc.h"
|
||||
#include "stm32g0xx_hal_adc_ex.h"
|
||||
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CEC_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_cec.h"
|
||||
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_COMP_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_comp.h"
|
||||
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRC_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_crc.h"
|
||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_cryp.h"
|
||||
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_dac.h"
|
||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_exti.h"
|
||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_flash.h"
|
||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FDCAN_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_fdcan.h"
|
||||
#endif /* HAL_FDCAN_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HCD_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_hcd.h"
|
||||
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2C_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_i2c.h"
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_i2s.h"
|
||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_irda.h"
|
||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_iwdg.h"
|
||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_lptim.h"
|
||||
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PCD_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_pcd.h"
|
||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PWR_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_pwr.h"
|
||||
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RNG_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_rng.h"
|
||||
#endif /* HAL_RNG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RTC_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_rtc.h"
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_smartcard.h"
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_smbus.h"
|
||||
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPI_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_spi.h"
|
||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_TIM_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_tim.h"
|
||||
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_UART_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_uart.h"
|
||||
#endif /* HAL_UART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_USART_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_usart.h"
|
||||
#endif /* HAL_USART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||
#include "stm32g0xx_hal_wwdg.h"
|
||||
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief The assert_param macro is used for functions parameters check.
|
||||
* @param expr If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t *file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32G0xx_HAL_CONF_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
69
USB-PD_Provider_1port/Inc/stm32g0xx_it.h
Normal file
69
USB-PD_Provider_1port/Inc/stm32g0xx_it.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32g0xx_it.h
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32G0xx_IT_H
|
||||
#define __STM32G0xx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void USB_UCPD1_2_IRQHandler(void);
|
||||
void DMA1_Channel1_IRQHandler(void);
|
||||
void DMA1_Channel2_3_IRQHandler(void);
|
||||
void DMA1_Ch4_7_DMA2_Ch1_5_DMAMUX1_OVR_IRQHandler(void);
|
||||
void ADC1_COMP_IRQHandler(void);
|
||||
void USART3_4_5_6_LPUART1_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32G0xx_IT_H */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
95
USB-PD_Provider_1port/Inc/tracer_emb_conf.h
Normal file
95
USB-PD_Provider_1port/Inc/tracer_emb_conf.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tracer_emb_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the Trace HW related defines.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* CubeMX Generated */
|
||||
#define CUBEMX_GENERATED
|
||||
|
||||
#ifndef TRACER_EMB_CONF_H
|
||||
#define TRACER_EMB_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32g0xx_ll_bus.h"
|
||||
#include "stm32g0xx_ll_dma.h"
|
||||
#include "stm32g0xx_ll_gpio.h"
|
||||
#include "stm32g0xx_ll_rcc.h"
|
||||
#include "stm32g0xx_ll_usart.h"
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Definitions for TRACE feature
|
||||
-------------------------------------------------------------------------------*/
|
||||
|
||||
#define TRACER_EMB_BAUDRATE 921600UL
|
||||
|
||||
#define TRACER_EMB_DMA_MODE 1UL
|
||||
#define TRACER_EMB_IT_MODE 0UL
|
||||
|
||||
#define TRACER_EMB_BUFFER_SIZE 1024UL
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Definitions for TRACE Hw information
|
||||
-------------------------------------------------------------------------------*/
|
||||
|
||||
#define TRACER_EMB_IS_INSTANCE_LPUART_TYPE 0UL /* set to 0UL if USART is used */
|
||||
|
||||
#define TRACER_EMB_USART_INSTANCE USART3
|
||||
|
||||
#define TRACER_EMB_TX_GPIO GPIOC
|
||||
#define TRACER_EMB_TX_PIN LL_GPIO_PIN_10
|
||||
#define TRACER_EMB_TX_AF LL_GPIO_AF_0
|
||||
#define TRACER_EMB_TX_GPIO_ENABLE_CLOCK() LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC)
|
||||
#define TRACER_EMB_RX_GPIO GPIOC
|
||||
#define TRACER_EMB_RX_PIN LL_GPIO_PIN_11
|
||||
#define TRACER_EMB_RX_AF LL_GPIO_AF_0
|
||||
#define TRACER_EMB_RX_GPIO_ENABLE_CLOCK() LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC)
|
||||
|
||||
#define TRACER_EMB_ENABLE_CLK_USART() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART3)
|
||||
#define TRACER_EMB_DISABLE_CLK_USART() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USART3)
|
||||
#define TRACER_EMB_SET_CLK_SOURCE_USART() /* No need for clock source selection in case of USART3 // LL_RCC_SetUSARTClockSource(LL_RCC_USART3_CLKSOURCE_PCLK2) */
|
||||
#define TRACER_EMB_USART_IRQ USART3_4_5_6_LPUART1_IRQn
|
||||
#define TRACER_EMB_USART_IRQHANDLER USART3_4_5_6_LPUART1_IRQHandler
|
||||
#define TRACER_EMB_TX_AF_FUNCTION LL_GPIO_SetAFPin_8_15
|
||||
#define TRACER_EMB_RX_AF_FUNCTION LL_GPIO_SetAFPin_8_15
|
||||
|
||||
#define TRACER_EMB_DMA_INSTANCE DMA1
|
||||
#define TRACER_EMB_ENABLE_CLK_DMA() LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1)
|
||||
#define TRACER_EMB_TX_DMA_REQUEST LL_DMAMUX_REQ_USART3_TX
|
||||
#define TRACER_EMB_TX_DMA_CHANNEL LL_DMA_CHANNEL_7
|
||||
#define TRACER_EMB_ENABLECHANNEL LL_DMA_EnableChannel
|
||||
#define TRACER_EMB_DISABLECHANNEL LL_DMA_DisableChannel
|
||||
#define TRACER_EMB_TX_DMA_IRQ DMA1_Ch4_7_DMA2_Ch1_5_DMAMUX1_OVR_IRQn
|
||||
#define TRACER_EMB_TX_DMA_IRQHANDLER DMA1_Ch4_7_DMA2_Ch1_5_DMAMUX1_OVR_IRQHandler
|
||||
#define TRACER_EMB_TX_DMA_ACTIVE_FLAG LL_DMA_IsActiveFlag_TC7
|
||||
#define TRACER_EMB_TX_DMA_CLEAR_FLAG LL_DMA_ClearFlag_GI7
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TRACER_EMB_CONF_H */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
61
USB-PD_Provider_1port/Inc/usbpd.h
Normal file
61
USB-PD_Provider_1port/Inc/usbpd.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the device define.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __usbpd_H
|
||||
#define __usbpd_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usbpd_core.h"
|
||||
#include "usbpd_dpm_core.h"
|
||||
#include "usbpd_dpm_conf.h"
|
||||
#include "usbpd_hw_if.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* Global variables ---------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
/* USER CODE END 1 */
|
||||
|
||||
/* USBPD init function */
|
||||
void MX_USBPD_Init(void);
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
/* USER CODE END 2 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*__usbpd_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
128
USB-PD_Provider_1port/Inc/usbpd_devices_conf.h
Normal file
128
USB-PD_Provider_1port/Inc/usbpd_devices_conf.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_devices_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the device define.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* CubeMX Generated */
|
||||
#define CUBEMX_GENERATED
|
||||
|
||||
#ifndef USBPD_DEVICE_CONF_H
|
||||
#define USBPD_DEVICE_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32g0xx_ll_bus.h"
|
||||
#include "stm32g0xx_ll_dma.h"
|
||||
#include "stm32g0xx_ll_gpio.h"
|
||||
#include "stm32g0xx_ll_rcc.h"
|
||||
#include "stm32g0xx_ll_ucpd.h"
|
||||
#include "stm32g0xx_ll_pwr.h"
|
||||
#include "stm32g0xx_ll_tim.h"
|
||||
#include "usbpd_pwr_user.h"
|
||||
#include "usbpd_pwr_if.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
usbpd_hw.c
|
||||
-------------------------------------------------------------------------------*/
|
||||
|
||||
/* defined used to configure function : BSP_USBPD_GetUSPDInstance */
|
||||
#define UCPD_INSTANCE0 UCPD1
|
||||
|
||||
/* defined used to configure function : BSP_USBPD_Init_DMARxInstance,BSP_USBPD_DeInit_DMARxInstance */
|
||||
#define UCPDDMA_INSTANCE0_CLOCKENABLE_RX LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1)
|
||||
|
||||
#define UCPDDMA_INSTANCE0_DMA_RX DMA1
|
||||
|
||||
#define UCPDDMA_INSTANCE0_REQUEST_RX DMA_REQUEST_UCPD1_RX
|
||||
|
||||
#define UCPDDMA_INSTANCE0_LL_CHANNEL_RX LL_DMA_CHANNEL_4
|
||||
|
||||
#define UCPDDMA_INSTANCE0_CHANNEL_RX DMA1_Channel4
|
||||
|
||||
/* defined used to configure function : BSP_USBPD_Init_DMATxInstance, BSP_USBPD_DeInit_DMATxInstance */
|
||||
#define UCPDDMA_INSTANCE0_CLOCKENABLE_TX LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1)
|
||||
|
||||
#define UCPDDMA_INSTANCE0_DMA_TX DMA1
|
||||
|
||||
#define UCPDDMA_INSTANCE0_REQUEST_TX DMA_REQUEST_UCPD1_TX
|
||||
|
||||
#define UCPDDMA_INSTANCE0_LL_CHANNEL_TX LL_DMA_CHANNEL_2
|
||||
|
||||
#define UCPDDMA_INSTANCE0_CHANNEL_TX DMA1_Channel2
|
||||
|
||||
/* defined used to configure BSP_USBPD_SetFRSSignalling */
|
||||
#define UCPDFRS_INSTANCE0_FRSCC1
|
||||
#define UCPDFRS_INSTANCE0_FRSCC2
|
||||
|
||||
#define UCPD_INSTANCE0_ENABLEIRQ do{ \
|
||||
NVIC_SetPriority(USB_UCPD1_2_IRQn,0); \
|
||||
NVIC_EnableIRQ(USB_UCPD1_2_IRQn); \
|
||||
} while(0)
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Definitions for timer service feature
|
||||
-------------------------------------------------------------------------------*/
|
||||
|
||||
#define TIMX TIM1
|
||||
#define TIMX_CLK_ENABLE LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1)
|
||||
#define TIMX_CLK_DISABLE LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_TIM1)
|
||||
#define TIMX_IRQ TIM1_BRK_UP_TRG_COM_IRQn
|
||||
#define TIMX_CHANNEL_CH1 LL_TIM_CHANNEL_CH1
|
||||
#define TIMX_CHANNEL_CH2 LL_TIM_CHANNEL_CH2
|
||||
#define TIMX_CHANNEL_CH3 LL_TIM_CHANNEL_CH3
|
||||
#define TIMX_CHANNEL_CH4 LL_TIM_CHANNEL_CH4
|
||||
#define TIMX_CHANNEL1_SETEVENT do{ \
|
||||
LL_TIM_OC_SetCompareCH1(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
||||
LL_TIM_ClearFlag_CC1(TIMX); \
|
||||
}while(0)
|
||||
#define TIMX_CHANNEL2_SETEVENT do{ \
|
||||
LL_TIM_OC_SetCompareCH2(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
||||
LL_TIM_ClearFlag_CC2(TIMX); \
|
||||
}while(0)
|
||||
#define TIMX_CHANNEL3_SETEVENT do{ \
|
||||
LL_TIM_OC_SetCompareCH3(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
||||
LL_TIM_ClearFlag_CC3(TIMX); \
|
||||
}while(0)
|
||||
#define TIMX_CHANNEL4_SETEVENT do{ \
|
||||
LL_TIM_OC_SetCompareCH4(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
||||
LL_TIM_ClearFlag_CC4(TIMX); \
|
||||
}while(0)
|
||||
#define TIMX_CHANNEL1_GETFLAG LL_TIM_IsActiveFlag_CC1
|
||||
#define TIMX_CHANNEL2_GETFLAG LL_TIM_IsActiveFlag_CC2
|
||||
#define TIMX_CHANNEL3_GETFLAG LL_TIM_IsActiveFlag_CC3
|
||||
#define TIMX_CHANNEL4_GETFLAG LL_TIM_IsActiveFlag_CC4
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* USBPD_DEVICE_CONF_H */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
156
USB-PD_Provider_1port/Inc/usbpd_dpm_conf.h
Normal file
156
USB-PD_Provider_1port/Inc/usbpd_dpm_conf.h
Normal file
|
@ -0,0 +1,156 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_dpm_conf.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for stack/application settings file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __USBPD_DPM_CONF_H_
|
||||
#define __USBPD_DPM_CONF_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usbpd_pdo_defs.h"
|
||||
#include "usbpd_dpm_user.h"
|
||||
#include "usbpd_vdm_user.h"
|
||||
|
||||
#include "gui_api.h"
|
||||
#include "usbpd_gui_memmap.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
/* Section where include file can be added */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Define ------------------------------------------------------------------*/
|
||||
/* Define VID, PID,... manufacturer parameters */
|
||||
#define USBPD_VID (0x0483u) /*!< Vendor ID (assigned by the USB-IF) */
|
||||
#define USBPD_PID (0x0002u) /*!< Product ID (assigned by the manufacturer) */
|
||||
#define USBPD_XID (0xF0000003u) /*!< Value provided by the USB-IF assigned to the product */
|
||||
|
||||
/* USER CODE BEGIN Define */
|
||||
/* Section where Define can be added */
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Typedef */
|
||||
/* Section where Typedef can be added */
|
||||
|
||||
/* USER CODE END Typedef */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
#ifndef __USBPD_DPM_CORE_C
|
||||
extern USBPD_SettingsTypeDef DPM_Settings[USBPD_PORT_COUNT];
|
||||
extern USBPD_IdSettingsTypeDef DPM_ID_Settings[USBPD_PORT_COUNT];
|
||||
extern USBPD_USER_SettingsTypeDef DPM_USER_Settings[USBPD_PORT_COUNT];
|
||||
#else /* __USBPD_DPM_CORE_C */
|
||||
USBPD_SettingsTypeDef DPM_Settings[USBPD_PORT_COUNT] =
|
||||
{
|
||||
{
|
||||
.PE_SupportedSOP = USBPD_SUPPORTED_SOP_SOP , /* Supported SOP : SOP, SOP' SOP" SOP'Debug SOP"Debug */
|
||||
.PE_SpecRevision = USBPD_SPECIFICATION_REV3,/* spec revision value */
|
||||
.PE_DefaultRole = USBPD_PORTPOWERROLE_SRC, /* Default port role */
|
||||
.PE_RoleSwap = USBPD_FALSE, /* support port role swap */
|
||||
.PE_VDMSupport = USBPD_FALSE,
|
||||
.PE_RespondsToDiscovSOP = USBPD_FALSE, /*!< Can respond successfully to a Discover Identity */
|
||||
.PE_AttemptsDiscovSOP = USBPD_FALSE, /*!< Can send a Discover Identity */
|
||||
.PE_PingSupport = USBPD_FALSE, /* support Ping (only for PD3.0) */
|
||||
.PE_CapscounterSupport = USBPD_FALSE, /* support caps counter */
|
||||
.CAD_RoleToggle = USBPD_FALSE, /* CAD role toggle */
|
||||
.CAD_DefaultResistor = 0x00u,
|
||||
.CAD_TryFeature = 0, /* CAD try feature */
|
||||
.CAD_AccesorySupport = USBPD_FALSE, /* CAD accessory support */
|
||||
.PE_PD3_Support.d = /*!< PD3 SUPPORT FEATURE */
|
||||
{
|
||||
.PE_UnchunkSupport = USBPD_FALSE, /* support Unchunked mode (valid only spec revision 3.0) */
|
||||
.PE_FastRoleSwapSupport = USBPD_FALSE, /* support fast role swap only spec revsion 3.0 */
|
||||
.Is_GetPPSStatus_Supported = USBPD_FALSE, /*!< PPS message NOT supported by PE stack */
|
||||
.Is_SrcCapaExt_Supported = USBPD_FALSE, /*!< Source_Capabilities_Extended message supported or not by DPM */
|
||||
.Is_Alert_Supported = USBPD_FALSE, /*!< Alert message supported or not by DPM */
|
||||
.Is_GetStatus_Supported = USBPD_FALSE, /*!< Status message supported or not by DPM (Is_Alert_Supported should be enabled) */
|
||||
.Is_GetManufacturerInfo_Supported = USBPD_FALSE, /*!< Manufacturer_Info message supported or not by DPM */
|
||||
.Is_GetCountryCodes_Supported = USBPD_FALSE, /*!< Country_Codes message supported or not by DPM */
|
||||
.Is_GetCountryInfo_Supported = USBPD_FALSE, /*!< Country_Info message supported or not by DPM */
|
||||
.Is_SecurityRequest_Supported = USBPD_FALSE, /*!< Security_Response message supported or not by DPM */
|
||||
.Is_FirmUpdateRequest_Supported = USBPD_FALSE, /*!< Firmware update response message supported by PE */
|
||||
.Is_GetBattery_Supported = USBPD_FALSE, /*!< Get Battery Capabitity and Status messages supported by PE */
|
||||
},
|
||||
|
||||
.CAD_SRCToggleTime = 0, /* uint8_t CAD_SRCToggleTime; */
|
||||
.CAD_SNKToggleTime = 0, /* uint8_t CAD_SNKToggleTime; */
|
||||
}
|
||||
};
|
||||
|
||||
USBPD_IdSettingsTypeDef DPM_ID_Settings[USBPD_PORT_COUNT] =
|
||||
{
|
||||
{
|
||||
.XID = USBPD_XID, /*!< Value provided by the USB-IF assigned to the product */
|
||||
.VID = USBPD_VID, /*!< Vendor ID (assigned by the USB-IF) */
|
||||
.PID = USBPD_PID, /*!< Product ID (assigned by the manufacturer) */
|
||||
},
|
||||
};
|
||||
|
||||
USBPD_USER_SettingsTypeDef DPM_USER_Settings[USBPD_PORT_COUNT] =
|
||||
{
|
||||
{
|
||||
.PE_DataSwap = USBPD_FALSE, /* support data swap */
|
||||
.PE_VconnSwap = USBPD_FALSE, /* support VCONN swap */
|
||||
.PE_DR_Swap_To_DFP = USBPD_TRUE, /* Support of DR Swap to DFP */
|
||||
.PE_DR_Swap_To_UFP = USBPD_TRUE, /* Support of DR Swap to UFP */
|
||||
#if defined(USBPD_REV30_SUPPORT)
|
||||
#if _MANU_INFO
|
||||
.DPM_ManuInfoPort = /*!< Manufacturer information used for the port */
|
||||
{
|
||||
.VID = USBPD_VID, /*!< Vendor ID (assigned by the USB-IF) */
|
||||
.PID = USBPD_PID, /*!< Product ID (assigned by the manufacturer) */
|
||||
.ManuString = "STMicroelectronics", /*!< Vendor defined byte array */
|
||||
},
|
||||
#endif /* _MANU_INFO */
|
||||
#endif /* USBPD_REV30_SUPPORT */
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* !__USBPD_DPM_CORE_C */
|
||||
|
||||
/* USER CODE BEGIN Variable */
|
||||
/* Section where Variable can be added */
|
||||
|
||||
/* USER CODE END Variable */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Constant */
|
||||
/* Section where Constant can be added */
|
||||
|
||||
/* USER CODE END Constant */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Macro */
|
||||
/* Section where Macro can be added */
|
||||
|
||||
/* USER CODE END Macro */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_DPM_CONF_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
76
USB-PD_Provider_1port/Inc/usbpd_dpm_core.h
Normal file
76
USB-PD_Provider_1port/Inc/usbpd_dpm_core.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_dpm_core.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for usbpd_dpm_core.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __USBPD_DPM_CORE_H_
|
||||
#define __USBPD_DPM_CORE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN typedef */
|
||||
|
||||
/* USER CODE END typedef */
|
||||
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN define */
|
||||
|
||||
/* USER CODE END define */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN constants */
|
||||
|
||||
/* USER CODE END constants */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN macro */
|
||||
|
||||
/* USER CODE END macro */
|
||||
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
extern USBPD_ParamsTypeDef DPM_Params[USBPD_PORT_COUNT];
|
||||
/* USER CODE BEGIN variables */
|
||||
|
||||
/* USER CODE END variables */
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
USBPD_StatusTypeDef USBPD_DPM_InitCore(void);
|
||||
USBPD_StatusTypeDef USBPD_DPM_InitOS(void);
|
||||
void USBPD_DPM_Run(void);
|
||||
void USBPD_DPM_TimerCounter(void);
|
||||
/* USER CODE BEGIN functions */
|
||||
|
||||
/* USER CODE END functions */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_DPM_CORE_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
172
USB-PD_Provider_1port/Inc/usbpd_dpm_user.h
Normal file
172
USB-PD_Provider_1port/Inc/usbpd_dpm_user.h
Normal file
|
@ -0,0 +1,172 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_dpm_user.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for usbpd_dpm_user.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __USBPD_DPM_USER_H_
|
||||
#define __USBPD_DPM_USER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Include */
|
||||
|
||||
/* USER CODE END Include */
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION_DPM_USER
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Typedef */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t DPM_RDOPosition; /*!< RDO Position of requested DO in Source list of capabilities */
|
||||
uint32_t DPM_RDOPositionPrevious; /*!< RDO Position of requested DO in Source list of capabilities */
|
||||
uint32_t DPM_RequestedVoltage; /*!< Value of requested voltage */
|
||||
uint32_t DPM_RequestedCurrent; /*!< Value of requested current */
|
||||
uint32_t DPM_RcvRequestDOMsg;
|
||||
} USBPD_HandleTypeDef;
|
||||
/* USER CODE END Typedef */
|
||||
|
||||
typedef void (*GUI_NOTIFICATION_POST)(uint8_t PortNum, uint16_t EventVal);
|
||||
typedef uint32_t (*GUI_NOTIFICATION_FORMAT_SEND)(uint32_t PortNum, uint32_t TypeNotification, uint32_t Value);
|
||||
typedef void (*GUI_SAVE_INFO)(uint8_t PortNum, uint8_t DataId, uint8_t *Ptr, uint32_t Size);
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Define */
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Constant */
|
||||
|
||||
/* USER CODE END Constant */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Macro */
|
||||
|
||||
/* USER CODE END Macro */
|
||||
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Private_Variables */
|
||||
extern USBPD_HandleTypeDef DPM_Ports[USBPD_PORT_COUNT];
|
||||
/* USER CODE END Private_Variables */
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS
|
||||
* @{
|
||||
*/
|
||||
/** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP1
|
||||
* @{
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_DPM_UserInit(void);
|
||||
void USBPD_DPM_SetNotification_GUI(GUI_NOTIFICATION_FORMAT_SEND PtrFormatSend, GUI_NOTIFICATION_POST PtrPost, GUI_SAVE_INFO PtrSaveInfo);
|
||||
void USBPD_DPM_UserCableDetection(uint8_t PortNum, USBPD_CAD_EVENT State);
|
||||
void USBPD_DPM_UserTimerCounter(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP2
|
||||
* @{
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_DPM_SetupNewPower(uint8_t PortNum);
|
||||
void USBPD_DPM_HardReset(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole, USBPD_HR_Status_TypeDef Status);
|
||||
void USBPD_DPM_Notification(uint8_t PortNum, USBPD_NotifyEventValue_TypeDef EventVal);
|
||||
void USBPD_DPM_ExtendedMessageReceived(uint8_t PortNum, USBPD_ExtendedMsg_TypeDef MsgType, uint8_t *ptrData, uint16_t DataSize);
|
||||
void USBPD_DPM_GetDataInfo(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId , uint8_t *Ptr, uint32_t *Size);
|
||||
void USBPD_DPM_SetDataInfo(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId , uint8_t *Ptr, uint32_t Size);
|
||||
USBPD_StatusTypeDef USBPD_DPM_EvaluateRequest(uint8_t PortNum, USBPD_CORE_PDO_Type_TypeDef *PtrPowerObject);
|
||||
USBPD_StatusTypeDef USBPD_DPM_EvaluateVconnSwap(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_PE_VconnPwr(uint8_t PortNum, USBPD_FunctionalState State);
|
||||
USBPD_StatusTypeDef USBPD_DPM_EvaluateDataRoleSwap(uint8_t PortNum);
|
||||
USBPD_FunctionalState USBPD_DPM_IsPowerReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP3
|
||||
* @{
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestHardReset(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestCableReset(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGotoMin(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestPing(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapability(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapability(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestDataRoleSwap(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestPowerRoleSwap(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestVconnSwap(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestSoftReset(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestSourceCapability(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryIdentify(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoverySVID(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestVDM_EnterMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint8_t ModeIndex);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestVDM_ExitMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint8_t ModeIndex);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortStatus(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint32_t *pDPStatus);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortConfig(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint32_t *pDPConfig);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestAttention(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestAlert(uint8_t PortNum, USBPD_ADO_TypeDef Alert);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapabilityExt(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapabilityExt(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetManufacturerInfo(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint8_t* pManuInfoData);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetStatus(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestFastRoleSwap(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetPPS_Status(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryCodes(uint8_t PortNum);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryInfo(uint8_t PortNum, uint16_t CountryCode);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetBatteryCapability(uint8_t PortNum, uint8_t *pBatteryCapRef);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestGetBatteryStatus(uint8_t PortNum, uint8_t *pBatteryStatusRef);
|
||||
USBPD_StatusTypeDef USBPD_DPM_RequestSecurityRequest(uint8_t PortNum);
|
||||
/* USER CODE BEGIN Function */
|
||||
|
||||
/* USER CODE END Function */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_DPM_USER_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
106
USB-PD_Provider_1port/Inc/usbpd_gui_memmap.h
Normal file
106
USB-PD_Provider_1port/Inc/usbpd_gui_memmap.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_gui_memmap.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains memory mapping configuration to be able to run
|
||||
* Cube-Monitor-UCPD on embedded side.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __USBPD_GUI_MEMMAP_H_
|
||||
#define __USBPD_GUI_MEMMAP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32g0xx.h"
|
||||
#include "usbpd_def.h"
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION_GUI
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
|
||||
/* Following definitions should be adapted to used Flash configuration :
|
||||
INDEX_PAGE : represents the number of the page used for storing USBPD settings (usually the last page)
|
||||
ADDR_FLASH_LAST_PAGE : Flash address value of beginning of USBPD settings page
|
||||
ADDR_FLASH_PAGE_END : Flash address value of end of USBPD settings page
|
||||
*/
|
||||
|
||||
#if defined (FLASH_OPTR_DBANK)
|
||||
#define INDEX_PAGE ((FLASH_PAGE_NB * 2U) - 1U) /* Index of latest page */
|
||||
#else
|
||||
#define INDEX_PAGE (FLASH_PAGE_NB - 1U) /* Index of latest page */
|
||||
#endif /* FLASH_OPTR_DBANK */
|
||||
#define ADDR_FLASH_LAST_PAGE (FLASH_BASE + (INDEX_PAGE * FLASH_PAGE_SIZE)) /* Base @ of latest page */
|
||||
#define ADDR_FLASH_PAGE_END (ADDR_FLASH_LAST_PAGE + FLASH_PAGE_SIZE - 1U)
|
||||
|
||||
#define GUI_FLASH_MAGIC_NUMBER ADDR_FLASH_LAST_PAGE
|
||||
/* should be aligned on double word */
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SNK_P0 (GUI_FLASH_MAGIC_NUMBER + 8u)
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SRC_P0 (GUI_FLASH_ADDR_NB_PDO_SNK_P0 + 1u)
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SNK_P1 (GUI_FLASH_ADDR_NB_PDO_SRC_P0 + 1u)
|
||||
#define GUI_FLASH_ADDR_NB_PDO_SRC_P1 (GUI_FLASH_ADDR_NB_PDO_SNK_P1 + 1u)
|
||||
|
||||
/* should be aligned on double word */
|
||||
#define GUI_FLASH_ADDR_PDO_SRC_P0 (GUI_FLASH_MAGIC_NUMBER + 16u)
|
||||
/* New Address should be modulo 8 */
|
||||
/* New Address = (Previous Address + (size / 8 * 8) + ((size % 8) + 7) / 8 * 8) */
|
||||
#define GUI_FLASH_ADDR_PDO_SNK_P0 (GUI_FLASH_ADDR_PDO_SRC_P0 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
#define GUI_FLASH_ADDR_PDO_SRC_P1 (GUI_FLASH_ADDR_PDO_SNK_P0 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
#define GUI_FLASH_ADDR_PDO_SNK_P1 (GUI_FLASH_ADDR_PDO_SRC_P1 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
|
||||
#define GUI_FLASH_ADDR_DPM_SETTINGS (GUI_FLASH_ADDR_PDO_SNK_P1 + ((USBPD_MAX_NB_PDO * 4) / 8 * 8) + ((((USBPD_MAX_NB_PDO * 4) & 0x07) + 7) / 8 * 8 ))
|
||||
|
||||
#define GUI_FLASH_ADDR_DPM_USER_SETTINGS (GUI_FLASH_ADDR_DPM_SETTINGS + (sizeof(USBPD_SettingsTypeDef) * USBPD_PORT_COUNT))
|
||||
|
||||
#define GUI_FLASH_ADDR_DPM_VDM_SETTINGS (GUI_FLASH_ADDR_DPM_USER_SETTINGS + (sizeof(USBPD_USER_SettingsTypeDef) * USBPD_PORT_COUNT))
|
||||
|
||||
#define GUI_FLASH_ADDR_DPM_ID_SETTINGS (GUI_FLASH_ADDR_DPM_VDM_SETTINGS + (sizeof(USBPD_VDM_SettingsTypeDef) * USBPD_PORT_COUNT))
|
||||
|
||||
#define GUI_FLASH_ADDR_RESERVED (GUI_FLASH_ADDR_DPM_ID_SETTINGS + (sizeof(USBPD_IdSettingsTypeDef) * USBPD_PORT_COUNT))
|
||||
|
||||
#define GUI_FLASH_SIZE_RESERVED (int32_t)(ADDR_FLASH_PAGE_END - GUI_FLASH_ADDR_RESERVED)
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_GUI_MEMMAP_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
159
USB-PD_Provider_1port/Inc/usbpd_pdo_defs.h
Normal file
159
USB-PD_Provider_1port/Inc/usbpd_pdo_defs.h
Normal file
|
@ -0,0 +1,159 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_pdo_defs.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for definition of PDO/APDO values for 2 ports(DRP/SNK) configuration
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __USBPD_PDO_DEF_H_
|
||||
#define __USBPD_PDO_DEF_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
#include "usbpd_def.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Define ------------------------------------------------------------------*/
|
||||
#define PORT0_NB_SOURCEPDO 1U /* Number of Source PDOs (applicable for port 0) */
|
||||
#define PORT0_NB_SINKPDO 0U /* Number of Sink PDOs (applicable for port 0) */
|
||||
#define PORT1_NB_SOURCEPDO 0U /* Number of Source PDOs (applicable for port 1) */
|
||||
#define PORT1_NB_SINKPDO 0U /* Number of Sink PDOs (applicable for port 1) */
|
||||
|
||||
/* USER CODE BEGIN Define */
|
||||
|
||||
/* USER CODE END Define */
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN typedef */
|
||||
|
||||
/**
|
||||
* @brief USBPD Port PDO Structure definition
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t *ListOfPDO; /*!< Pointer on Power Data Objects list, defining
|
||||
port capabilities */
|
||||
|
||||
uint8_t *NumberOfPDO; /*!< Number of Power Data Objects defined in ListOfPDO
|
||||
This parameter must be set at max to @ref USBPD_MAX_NB_PDO value */
|
||||
} USBPD_PortPDO_TypeDef;
|
||||
|
||||
/**
|
||||
* @brief USBPD Port PDO Storage Structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
USBPD_PortPDO_TypeDef SourcePDO; /*!< SRC Power Data Objects */
|
||||
} USBPD_PWR_Port_PDO_Storage_TypeDef;
|
||||
/* USER CODE END typedef */
|
||||
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN Exported_Define */
|
||||
|
||||
#define USBPD_CORE_PDO_SRC_FIXED_MAX_CURRENT 3
|
||||
#define USBPD_CORE_PDO_SNK_FIXED_MAX_CURRENT 1500
|
||||
|
||||
/* USER CODE END Exported_Define */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN constants */
|
||||
|
||||
/* USER CODE END constants */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN macro */
|
||||
|
||||
/* USER CODE END macro */
|
||||
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN variables */
|
||||
|
||||
/* USER CODE END variables */
|
||||
|
||||
#ifndef __USBPD_PWR_IF_C
|
||||
extern uint8_t USBPD_NbPDO[4];
|
||||
extern uint32_t PORT0_PDO_ListSRC[USBPD_MAX_NB_PDO];
|
||||
extern uint32_t PORT0_PDO_ListSNK[USBPD_MAX_NB_PDO];
|
||||
#else
|
||||
uint8_t USBPD_NbPDO[4] = {(PORT0_NB_SINKPDO),
|
||||
(PORT0_NB_SOURCEPDO)};
|
||||
/* Definition of Source PDO for Port 0 */
|
||||
uint32_t PORT0_PDO_ListSRC[USBPD_MAX_NB_PDO] =
|
||||
{
|
||||
/* PDO 1 */
|
||||
(0x2201912CU),
|
||||
/* PDO 2 */
|
||||
(0x00000000U),
|
||||
/* PDO 3 */
|
||||
(0x00000000U),
|
||||
/* PDO 4 */
|
||||
(0x00000000U),
|
||||
/* PDO 5 */
|
||||
(0x00000000U),
|
||||
/* PDO 6 */
|
||||
(0x00000000U),
|
||||
/* PDO 7 */
|
||||
(0x00000000U)
|
||||
};
|
||||
|
||||
/* Definition of Sink PDO for Port 0 */
|
||||
uint32_t PORT0_PDO_ListSNK[USBPD_MAX_NB_PDO] =
|
||||
{
|
||||
/* PDO 1 */
|
||||
(0x00000000U),
|
||||
/* PDO 2 */
|
||||
(0x00000000U),
|
||||
/* PDO 3 */
|
||||
(0x00000000U),
|
||||
/* PDO 4 */
|
||||
(0x00000000U),
|
||||
/* PDO 5 */
|
||||
(0x00000000U),
|
||||
/* PDO 6 */
|
||||
(0x00000000U),
|
||||
/* PDO 7 */
|
||||
(0x00000000U)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN functions */
|
||||
|
||||
/* USER CODE END functions */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_PDO_DEF_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
223
USB-PD_Provider_1port/Inc/usbpd_pwr_if.h
Normal file
223
USB-PD_Provider_1port/Inc/usbpd_pwr_if.h
Normal file
|
@ -0,0 +1,223 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_pwr_if.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains the headers of usbpd_pw_if.h.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __USBPD_PW_IF_H_
|
||||
#define __USBPD_PW_IF_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usbpd_def.h"
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION_POWER_IF
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/** @defgroup USBPD_USER_PWR_IF_Exported_Macros USBPD PWR IF Exported Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* enumeration of the different power status available for VBUS */
|
||||
typedef enum{
|
||||
USBPD_PWR_BELOWVSAFE0V,
|
||||
USBPD_PWR_VSAFE5V,
|
||||
USBPD_PWR_SNKDETACH
|
||||
} USBPD_VBUSPOWER_STATUS;
|
||||
|
||||
/* Macros used to convert values into PDO representation */
|
||||
#define PWR_V_20MV(_V_) ((uint16_t)(( (_V_) * 1000) / 20)) /* From Volt to 20mV multiples */
|
||||
#define PWR_V_50MV(_V_) ((uint16_t)(( (_V_) * 1000) / 50)) /* From Volt to 50mV multiples */
|
||||
#define PWR_V_100MV(_V_) ((uint16_t)(( (_V_) * 1000) / 100)) /* From Volt to 100mV multiples */
|
||||
#define PWR_A_10MA(_A_) ((uint16_t)(( (_A_) * 1000) / 10)) /* From Ampere to 10mA multiples */
|
||||
#define PWR_A_50MA(_A_) ((uint16_t)(( (_A_) * 1000) / 50)) /* From Ampere to 50mA multiples */
|
||||
#define PWR_W(_W_) ((uint16_t)(( (_W_) * 1000) / 250)) /* From Watt to 250mW multiples */
|
||||
|
||||
/* Macros used to get values from PDO representation */
|
||||
#define PWR_DECODE_50MV(_Value_) ((uint16_t)(((_Value_) * 50))) /* From 50mV multiples to mV */
|
||||
#define PWR_DECODE_100MV(_Value_) ((uint16_t)(((_Value_) * 100))) /* From 100mV multiples to mV */
|
||||
#define PWR_DECODE_10MA(_Value_) ((uint16_t)(((_Value_) * 10))) /* From 10mA multiples to mA */
|
||||
#define PWR_DECODE_50MA(_Value_) ((uint16_t)(((_Value_) * 50))) /* From 50mA multiples to mA */
|
||||
#define PWR_DECODE_MW(_Value_) ((uint16_t)(((_Value_) * 250))) /* From 250mW multiples to mW */
|
||||
|
||||
#define USBPD_PORT_IsValid(__Port__) ((__Port__) < (USBPD_PORT_COUNT))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
/** @defgroup STM32_USBPD_APPLICATION_POWER_IF_Exported_Functions USBPD PWR IF Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Initialize structures and variables related to power board profiles
|
||||
* used by Sink and Source, for all available ports.
|
||||
* @retval USBPD status
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_Init(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the required power profile
|
||||
* @param PortNum Port number
|
||||
* @retval USBPD status
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_SetProfile(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @brief Checks if the power on a specified port is ready
|
||||
* @param PortNum Port number
|
||||
* @param Vsafe Vsafe status based on @ref USBPD_VSAFE_StatusTypeDef
|
||||
* @retval USBPD status
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_SupplyReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe);
|
||||
|
||||
/**
|
||||
* @brief Enable VBUS power on a specified port
|
||||
* @param PortNum Port number
|
||||
* @retval USBPD status
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_VBUSEnable(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @brief Disable VBUS power on a specified port
|
||||
* @param PortNum Port number
|
||||
* @retval USBPD status
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_VBUSDisable(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @brief Checks if the power on a specified port is enabled
|
||||
* @param PortNum Port number
|
||||
* @retval ENABLE or DISABLE
|
||||
*/
|
||||
USBPD_FunctionalState USBPD_PWR_IF_VBUSIsEnabled(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @brief Reads the voltage and the current on a specified port
|
||||
* @param PortNum Port number
|
||||
* @param pVoltage The Voltage in mV
|
||||
* @param pCurrent The Current in mA
|
||||
* @retval ENABLE or DISABLE
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_ReadVA(uint8_t PortNum, uint16_t *pVoltage, uint16_t *pCurrent);
|
||||
|
||||
/**
|
||||
* @brief Enables the VConn on the port.
|
||||
* @param PortNum Port number
|
||||
* @param CC Specifies the CCx to be selected based on @ref CCxPin_TypeDef structure
|
||||
* @retval USBPD Status
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_Enable_VConn(uint8_t PortNum, CCxPin_TypeDef CC);
|
||||
|
||||
/**
|
||||
* @brief Disable the VConn on the port.
|
||||
* @param PortNum Port number
|
||||
* @param CC Specifies the CCx to be selected based on @ref CCxPin_TypeDef structure
|
||||
* @retval USBPD Status
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_Disable_VConn(uint8_t PortNum, CCxPin_TypeDef CC);
|
||||
|
||||
/**
|
||||
* @brief Allow PDO data reading from PWR_IF storage.
|
||||
* @param PortNum Port number
|
||||
* @param DataId Type of data to be read from PWR_IF
|
||||
* This parameter can be one of the following values:
|
||||
* @arg @ref USBPD_CORE_DATATYPE_SRC_PDO Source PDO reading requested
|
||||
* @arg @ref USBPD_CORE_DATATYPE_SNK_PDO Sink PDO reading requested
|
||||
* @param Ptr Pointer on address where PDO values should be written (u8 pointer)
|
||||
* @param Size Pointer on nb of u32 written by PWR_IF (nb of PDOs)
|
||||
* @retval None
|
||||
*/
|
||||
void USBPD_PWR_IF_GetPortPDOs(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId, uint8_t *Ptr, uint32_t *Size);
|
||||
|
||||
/**
|
||||
* @brief Find out SRC PDO pointed out by a position provided in a Request DO (from Sink).
|
||||
* @param PortNum Port number
|
||||
* @param RdoPosition RDO Position in list of provided PDO
|
||||
* @param Pdo Pointer on PDO value pointed out by RDO position (u32 pointer)
|
||||
* @retval Status of search
|
||||
* USBPD_OK : Src PDO found for requested DO position (output Pdo parameter is set)
|
||||
* USBPD_FAIL : Position is not compliant with current Src PDO for this port (no corresponding PDO value)
|
||||
*/
|
||||
USBPD_StatusTypeDef USBPD_PWR_IF_SearchRequestedPDO(uint8_t PortNum, uint32_t RdoPosition, uint32_t *Pdo);
|
||||
|
||||
/**
|
||||
* @brief the function is called in case of critical issue is detected to switch in safety mode.
|
||||
* @retval None
|
||||
*/
|
||||
void USBPD_PWR_IF_Alarm(void);
|
||||
|
||||
/**
|
||||
* @brief Function is called to get VBUS power status.
|
||||
* @param PortNum Port number
|
||||
* @param PowerTypeStatus Power type status based on @ref USBPD_VBUSPOWER_STATUS
|
||||
* @retval UBBPD_TRUE or USBPD_FALSE
|
||||
*/
|
||||
uint8_t USBPD_PWR_IF_GetVBUSStatus(uint8_t PortNum, USBPD_VBUSPOWER_STATUS PowerTypeStatus);
|
||||
|
||||
/**
|
||||
* @brief Function is called to set the VBUS threshold when a request has been accepted.
|
||||
* @param PortNum Port number
|
||||
* @retval None
|
||||
*/
|
||||
void USBPD_PWR_IF_UpdateVbusThreshold(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @brief Function is called to reset the VBUS threshold when there is a power reset.
|
||||
* @param PortNum Port number
|
||||
* @retval None
|
||||
*/
|
||||
void USBPD_PWR_IF_ResetVbusThreshold(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_PW_IF_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
412
USB-PD_Provider_1port/Inc/usbpd_pwr_user.h
Normal file
412
USB-PD_Provider_1port/Inc/usbpd_pwr_user.h
Normal file
|
@ -0,0 +1,412 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_pwr_user.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for usbpd_pwr_user.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USBPD_PWR_USER_H_
|
||||
#define __USBPD_PWR_USER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32g0xx.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup POWER
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup POWER_Exported_Types Exported Types (BSP V1)
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief POWER Status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
PWR_OK = 0,
|
||||
PWR_ERROR
|
||||
} PWR_StatusTypeDef;
|
||||
|
||||
/**
|
||||
* @brief Power role
|
||||
*/
|
||||
#define PWR_PowerRoleTypeDef USBPD_PWR_PowerRoleTypeDef
|
||||
|
||||
/**
|
||||
* @brief Voltage control mode
|
||||
*/
|
||||
#define PWR_DCDCCtrlModeTypeDef USBPD_PWR_DCDCCtrlModeTypeDef
|
||||
|
||||
/**
|
||||
* @brief VBUS connection status
|
||||
*/
|
||||
#define PWR_VBUSConnectionStatusTypeDef USBPD_PWR_VBUSConnectionStatusTypeDef
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup POWER_Exported_Types2 Exported Types based on BSP V2 specification
|
||||
*@{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Power role
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
POWER_ROLE_SOURCE = 0,
|
||||
POWER_ROLE_SINK,
|
||||
POWER_ROLE_DUAL
|
||||
} USBPD_PWR_PowerRoleTypeDef;
|
||||
|
||||
/**
|
||||
* @brief Voltage control mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DCDC_CTRL_MODE_UNKNOWN = 0,
|
||||
DCDC_CTRL_MODE_GPIO,
|
||||
DCDC_CTRL_MODE_PWM,
|
||||
} USBPD_PWR_DCDCCtrlModeTypeDef;
|
||||
|
||||
/**
|
||||
* @brief VBUS connection status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
VBUS_CONNECTED = 0,
|
||||
VBUS_NOT_CONNECTED
|
||||
} USBPD_PWR_VBUSConnectionStatusTypeDef;
|
||||
|
||||
/* Keep for Legacy BSP V1 */
|
||||
/**
|
||||
* @brief VBUS Detection Callback
|
||||
*/
|
||||
typedef void PWR_VBUSDetectCallbackFunc(uint32_t Instance,
|
||||
PWR_VBUSConnectionStatusTypeDef VBUSConnectionStatus);
|
||||
|
||||
/**
|
||||
* @brief VBUS Detection Callback
|
||||
*/
|
||||
typedef void USBPD_PWR_VBUSDetectCallbackFunc(uint32_t Instance,
|
||||
USBPD_PWR_VBUSConnectionStatusTypeDef VBUSConnectionStatus);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup POWER_Exported_Constants Exported Constants (BSP V1)
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Number of TypeC ports
|
||||
*/
|
||||
#define PWR_TYPEC_PORT_NB USBPD_PWR_INSTANCES_NBR
|
||||
|
||||
/**
|
||||
* @brief Type-C port identifier
|
||||
*/
|
||||
#define TYPE_C_PORT_1 USBPD_PWR_TYPE_C_PORT_1
|
||||
#define TYPE_C_PORT_2 USBPD_PWR_TYPE_C_PORT_2
|
||||
|
||||
/**
|
||||
* @brief CC pin identifier
|
||||
*/
|
||||
#define TYPE_C_CC1 USBPD_PWR_TYPE_C_CC1
|
||||
#define TYPE_C_CC2 USBPD_PWR_TYPE_C_CC2
|
||||
|
||||
/**
|
||||
* @brief VBUS disconnection threshold values (in mV)
|
||||
*/
|
||||
#define BSP_PWR_HIGH_VBUS_THRESHOLD USBPD_PWR_HIGH_VBUS_THRESHOLD
|
||||
#define BSP_PWR_LOW_VBUS_THRESHOLD USBPD_PWR_LOW_VBUS_THRESHOLD
|
||||
|
||||
/**
|
||||
* @brief VBUS discharge parameters
|
||||
*/
|
||||
#define BSP_PWR_DISCHARGE_MARGIN USBPD_PWR_DISCHARGE_MARGIN
|
||||
#define BSP_PWR_DISCHARGE_TIME USBPD_PWR_DISCHARGE_TIME
|
||||
|
||||
/**
|
||||
* @brief Calibration settings
|
||||
*/
|
||||
#define BSP_PWR_DCDC_PRECISION USBPD_PWR_DCDC_PRECISION
|
||||
#define BSP_PWR_CALIBRATION_ENABLED USBPD_PWR_CALIBRATION_ENABLED
|
||||
#define BSP_PWR_CALIBRATION_DISABLED USBPD_PWR_CALIBRATION_DISABLED
|
||||
|
||||
/**
|
||||
* @brief Standard VBUS voltage levels
|
||||
*/
|
||||
#define BSP_PWR_VBUS_5V 5000
|
||||
#define BSP_PWR_VBUS_9V 9000
|
||||
#define BSP_PWR_VBUS_15V 15000
|
||||
|
||||
/**
|
||||
* @brief power timeout
|
||||
*/
|
||||
#define BSP_PWR_TIMEOUT_PDO USBPD_PWR_TIMEOUT_PDO
|
||||
#define BSP_PWR_TIMEOUT_APDO USBPD_PWR_TIMEOUT_APDO
|
||||
|
||||
/**
|
||||
* @brief Invalid value set during issue with voltage setting
|
||||
*/
|
||||
#define BSP_PWR_INVALID_VALUE USBPD_PWR_INVALID_VALUE
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup POWER_Exported_Constants2 Exported Constants (BSP V2)
|
||||
* @{
|
||||
*/
|
||||
/* Common Error codes */
|
||||
#define BSP_ERROR_NONE 0
|
||||
#define BSP_ERROR_NO_INIT -1
|
||||
#define BSP_ERROR_WRONG_PARAM -2
|
||||
#define BSP_ERROR_BUSY -3
|
||||
#define BSP_ERROR_PERIPH_FAILURE -4
|
||||
#define BSP_ERROR_COMPONENT_FAILURE -5
|
||||
#define BSP_ERROR_UNKNOWN_FAILURE -6
|
||||
#define BSP_ERROR_UNKNOWN_COMPONENT -7
|
||||
#define BSP_ERROR_BUS_FAILURE -8
|
||||
#define BSP_ERROR_CLOCK_FAILURE -9
|
||||
#define BSP_ERROR_MSP_FAILURE -10
|
||||
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
|
||||
|
||||
/**
|
||||
* @brief Number of TypeC ports
|
||||
*/
|
||||
#define USBPD_PWR_INSTANCES_NBR 2u
|
||||
|
||||
/**
|
||||
* @brief Type-C port identifier
|
||||
*/
|
||||
#define USBPD_PWR_TYPE_C_PORT_1 0u
|
||||
#define USBPD_PWR_TYPE_C_PORT_2 1u
|
||||
|
||||
/**
|
||||
* @brief CC pin identifier
|
||||
*/
|
||||
#define USBPD_PWR_TYPE_C_CC1 1U
|
||||
#define USBPD_PWR_TYPE_C_CC2 2U
|
||||
|
||||
/**
|
||||
* @brief VBUS disconnection threshold values (in mV)
|
||||
*/
|
||||
#define USBPD_PWR_HIGH_VBUS_THRESHOLD (2800U)
|
||||
#define USBPD_PWR_LOW_VBUS_THRESHOLD (750U)
|
||||
#define USBPD_PWR_VBUS_THRESHOLD_5V (3900U)
|
||||
#define USBPD_PWR_VBUS_THRESHOLD_9V (7000U)
|
||||
#define USBPD_PWR_VBUS_THRESHOLD_15V (12500U)
|
||||
#define USBPD_PWR_VBUS_THRESHOLD_20V (17000U)
|
||||
#define USBPD_PWR_VBUS_THRESHOLD_APDO (2150U)
|
||||
|
||||
/**
|
||||
* @brief VBUS discharge parameters
|
||||
*/
|
||||
#define USBPD_PWR_DISCHARGE_MARGIN (500U)
|
||||
#define USBPD_PWR_DISCHARGE_TIME (6U)
|
||||
|
||||
/**
|
||||
* @brief Calibration settings
|
||||
*/
|
||||
#define USBPD_PWR_DCDC_PRECISION (20U) /* DCDC output precision set to 20mV (Noise)*/
|
||||
#define USBPD_PWR_CALIBRATION_ENABLED (1U)
|
||||
#define USBPD_PWR_CALIBRATION_DISABLED (0U)
|
||||
|
||||
/**
|
||||
* @brief Standard VBUS voltage levels
|
||||
*/
|
||||
#define USBPD_PWR_VBUS_5V 5000U
|
||||
#define USBPD_PWR_VBUS_9V 9000U
|
||||
#define USBPD_PWR_VBUS_15V 15000U
|
||||
|
||||
/**
|
||||
* @brief power timeout
|
||||
*/
|
||||
#define USBPD_PWR_TIMEOUT_PDO 250U /* Timeout for PDO to PDO or PDO to APDO at 250ms*/
|
||||
#define USBPD_PWR_TIMEOUT_APDO 25U /* Timeout for APDO to APDO at 25ms*/
|
||||
|
||||
/**
|
||||
* @brief Invalid value set during issue with voltage setting
|
||||
*/
|
||||
#define USBPD_PWR_INVALID_VALUE 0xFFFFFFFFU
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup POWER_Exported_Functions Exported Functions (BSP V1)
|
||||
* @{
|
||||
*/
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSInit(uint32_t PortId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSDeInit(uint32_t PortId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSOn(uint32_t PortId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSOff(uint32_t PortId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSSetVoltage_Fixed(uint32_t PortNum,
|
||||
uint32_t VbusTargetInmv,
|
||||
uint32_t OperatingCurrent,
|
||||
uint32_t MaxOperatingCurrent);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSSetVoltage_Variable(uint32_t PortNum,
|
||||
uint32_t VbusTargetMaxInmv,
|
||||
uint32_t VbusTargetMinInmv,
|
||||
uint32_t OperatingCurrent,
|
||||
uint32_t MaxOperatingCurrent);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSSetVoltage_Battery(uint32_t PortId,
|
||||
uint32_t VbusTargetMin,
|
||||
uint32_t VbusTargetMax,
|
||||
uint32_t OperatingPower,
|
||||
uint32_t MaxOperatingPower);
|
||||
PWR_StatusTypeDef BSP_PWR_VBUSSetVoltage_APDO(uint32_t PortId,
|
||||
uint32_t VbusTargetInmv,
|
||||
uint32_t OperatingCurrent,
|
||||
int32_t Delta);
|
||||
uint32_t BSP_PWR_VBUSGetVoltage(uint32_t PortId);
|
||||
|
||||
int32_t BSP_PWR_VBUSGetCurrent(uint32_t PortId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VCONNInit(uint32_t PortId,
|
||||
uint32_t CCPinId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VCONNDeInit(uint32_t PortId,
|
||||
uint32_t CCPinId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VCONNOn(uint32_t PortId,
|
||||
uint32_t CCPinId);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_VCONNOff(uint32_t PortId,
|
||||
uint32_t CCPinId);
|
||||
|
||||
void BSP_PWR_SetVBUSDisconnectionThreshold(uint32_t PortId,
|
||||
uint32_t VoltageThreshold);
|
||||
|
||||
PWR_StatusTypeDef BSP_PWR_RegisterVBUSDetectCallback(uint32_t PortId,
|
||||
PWR_VBUSDetectCallbackFunc * pfnVBUSDetectCallback);
|
||||
|
||||
uint8_t BSP_PWR_VBUSIsOn(uint32_t PortId);
|
||||
|
||||
uint8_t BSP_PWR_VCONNIsOn(uint32_t PortId,
|
||||
uint32_t CCPinId);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup POWER_Exported_Functions2 Exported Functions (BSP V2)
|
||||
* @{
|
||||
*/
|
||||
/* Common functions */
|
||||
int32_t BSP_USBPD_PWR_Init(uint32_t Instance);
|
||||
|
||||
int32_t BSP_USBPD_PWR_Deinit(uint32_t Instance);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSInit(uint32_t Instance);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSDeInit(uint32_t Instance);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSOn(uint32_t Instance);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSOff(uint32_t Instance);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSSetVoltage_Fixed(uint32_t Instance,
|
||||
uint32_t VbusTargetInmv,
|
||||
uint32_t OperatingCurrent,
|
||||
uint32_t MaxOperatingCurrent);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSSetVoltage_Variable(uint32_t Instance,
|
||||
uint32_t VbusTargetMaxInmv,
|
||||
uint32_t VbusTargetMinInmv,
|
||||
uint32_t OperatingCurrent,
|
||||
uint32_t MaxOperatingCurrent);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSSetVoltage_Battery(uint32_t Instance,
|
||||
uint32_t VbusTargetMin,
|
||||
uint32_t VbusTargetMax,
|
||||
uint32_t OperatingPower,
|
||||
uint32_t MaxOperatingPower);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSSetVoltage_APDO(uint32_t Instance,
|
||||
uint32_t VbusTargetInmv,
|
||||
uint32_t OperatingCurrent,
|
||||
int32_t Delta);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSGetVoltage(uint32_t Instance, uint32_t *pVoltage);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSGetCurrent(uint32_t Instance, int32_t *pCurrent);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VCONNInit(uint32_t Instance,
|
||||
uint32_t CCPinId);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VCONNDeInit(uint32_t Instance,
|
||||
uint32_t CCPinId);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VCONNOn(uint32_t Instance,
|
||||
uint32_t CCPinId);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VCONNOff(uint32_t Instance,
|
||||
uint32_t CCPinId);
|
||||
|
||||
int32_t BSP_USBPD_PWR_SetVBUSDisconnectionThreshold(uint32_t Instance,
|
||||
uint32_t VoltageThreshold);
|
||||
|
||||
int32_t BSP_USBPD_PWR_RegisterVBUSDetectCallback(uint32_t Instance,
|
||||
USBPD_PWR_VBUSDetectCallbackFunc *pfnVBUSDetectCallback);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VBUSIsOn(uint32_t Instance, uint8_t *pState);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VCONNIsOn(uint32_t Instance,
|
||||
uint32_t CCPinId, uint8_t *pState);
|
||||
|
||||
int32_t BSP_USBPD_PWR_VCCSetState(uint32_t Instance, uint32_t State);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_PWR_USER_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
62
USB-PD_Provider_1port/Inc/usbpd_vdm_user.h
Normal file
62
USB-PD_Provider_1port/Inc/usbpd_vdm_user.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usbpd_vdm_user.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header file for usbpd_vdm_user.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under Ultimate Liberty license
|
||||
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at:
|
||||
* www.st.com/SLA0044
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#ifndef __USBPD_VDM_USER_H_
|
||||
#define __USBPD_VDM_USER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/** @addtogroup STM32_USBPD_APPLICATION
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_USBPD_APPLICATION_VDM_USER
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported typedef ----------------------------------------------------------*/
|
||||
|
||||
/* Exported define -----------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported variables --------------------------------------------------------*/
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
USBPD_StatusTypeDef USBPD_VDM_UserInit(uint8_t PortNum);
|
||||
void USBPD_VDM_UserReset(uint8_t PortNum);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USBPD_VDM_USER_H_ */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
Loading…
Add table
Add a link
Reference in a new issue