| [59] | 1 | /* USER CODE BEGIN Header */
|
|---|
| 2 | /**
|
|---|
| 3 | ******************************************************************************
|
|---|
| 4 | * @file usbpd_devices_conf.h
|
|---|
| 5 | * @author MCD Application Team
|
|---|
| 6 | * @brief This file contains the device define.
|
|---|
| 7 | ******************************************************************************
|
|---|
| 8 | * @attention
|
|---|
| 9 | *
|
|---|
| 10 | * Copyright (c) 2026 STMicroelectronics.
|
|---|
| 11 | * All rights reserved.
|
|---|
| 12 | *
|
|---|
| 13 | * This software is licensed under terms that can be found in the LICENSE file
|
|---|
| 14 | * in the root directory of this software component.
|
|---|
| 15 | * If no LICENSE file comes with this software, it is provided AS-IS.
|
|---|
| 16 | *
|
|---|
| 17 | ******************************************************************************
|
|---|
| 18 | */
|
|---|
| 19 | /* USER CODE END Header */
|
|---|
| 20 |
|
|---|
| 21 | /* CubeMX Generated */
|
|---|
| 22 | #define CUBEMX_GENERATED
|
|---|
| 23 |
|
|---|
| 24 | #ifndef USBPD_DEVICE_CONF_H
|
|---|
| 25 | #define USBPD_DEVICE_CONF_H
|
|---|
| 26 |
|
|---|
| 27 | #ifdef __cplusplus
|
|---|
| 28 | extern "C" {
|
|---|
| 29 | #endif
|
|---|
| 30 |
|
|---|
| 31 | /* Includes ------------------------------------------------------------------*/
|
|---|
| 32 | #include "stm32g4xx_ll_bus.h"
|
|---|
| 33 | #include "stm32g4xx_ll_dma.h"
|
|---|
| 34 | #include "stm32g4xx_ll_gpio.h"
|
|---|
| 35 | #include "stm32g4xx_ll_rcc.h"
|
|---|
| 36 | #include "stm32g4xx_ll_ucpd.h"
|
|---|
| 37 | #include "stm32g4xx_ll_pwr.h"
|
|---|
| 38 | #include "stm32g4xx_ll_tim.h"
|
|---|
| 39 | #include "usbpd_pwr_user.h"
|
|---|
| 40 | #include "usbpd_pwr_if.h"
|
|---|
| 41 |
|
|---|
| 42 | /* USER CODE BEGIN Includes */
|
|---|
| 43 |
|
|---|
| 44 | /* USER CODE END Includes */
|
|---|
| 45 |
|
|---|
| 46 | /* Private typedef -----------------------------------------------------------*/
|
|---|
| 47 | /* Private function prototypes -----------------------------------------------*/
|
|---|
| 48 | /* Private functions ---------------------------------------------------------*/
|
|---|
| 49 | /* Private define ------------------------------------------------------------*/
|
|---|
| 50 |
|
|---|
| 51 | /* -----------------------------------------------------------------------------
|
|---|
| 52 | usbpd_hw.c
|
|---|
| 53 | -------------------------------------------------------------------------------*/
|
|---|
| 54 |
|
|---|
| 55 | /* defined used to configure function : BSP_USBPD_GetUSPDInstance */
|
|---|
| 56 | #define UCPD_INSTANCE0 UCPD1
|
|---|
| 57 |
|
|---|
| 58 | /* defined used to configure function : BSP_USBPD_Init_DMARxInstance,BSP_USBPD_DeInit_DMARxInstance */
|
|---|
| 59 | #define UCPDDMA_INSTANCE0_CLOCKENABLE_RX LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1)
|
|---|
| 60 |
|
|---|
| 61 | #define UCPDDMA_INSTANCE0_DMA_RX DMA1
|
|---|
| 62 |
|
|---|
| 63 | #define UCPDDMA_INSTANCE0_REQUEST_RX DMA_REQUEST_UCPD1_RX
|
|---|
| 64 |
|
|---|
| 65 | #define UCPDDMA_INSTANCE0_LL_CHANNEL_RX LL_DMA_CHANNEL_8
|
|---|
| 66 |
|
|---|
| 67 | #define UCPDDMA_INSTANCE0_CHANNEL_RX DMA1_Channel8
|
|---|
| 68 |
|
|---|
| 69 | /* defined used to configure function : BSP_USBPD_Init_DMATxInstance, BSP_USBPD_DeInit_DMATxInstance */
|
|---|
| 70 | #define UCPDDMA_INSTANCE0_CLOCKENABLE_TX LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1)
|
|---|
| 71 |
|
|---|
| 72 | #define UCPDDMA_INSTANCE0_DMA_TX DMA2
|
|---|
| 73 |
|
|---|
| 74 | #define UCPDDMA_INSTANCE0_REQUEST_TX DMA_REQUEST_UCPD1_TX
|
|---|
| 75 |
|
|---|
| 76 | #define UCPDDMA_INSTANCE0_LL_CHANNEL_TX LL_DMA_CHANNEL_1
|
|---|
| 77 |
|
|---|
| 78 | #define UCPDDMA_INSTANCE0_CHANNEL_TX DMA2_Channel1
|
|---|
| 79 | /* defined used to configure BSP_USBPD_SetFRSSignalling */
|
|---|
| 80 | #define UCPDFRS_INSTANCE0_FRSCC1
|
|---|
| 81 | #define UCPDFRS_INSTANCE0_FRSCC2
|
|---|
| 82 |
|
|---|
| 83 | #define UCPD_INSTANCE0_ENABLEIRQ do{ \
|
|---|
| 84 | NVIC_SetPriority(UCPD1_IRQn,4); \
|
|---|
| 85 | NVIC_EnableIRQ(UCPD1_IRQn); \
|
|---|
| 86 | } while(0)
|
|---|
| 87 |
|
|---|
| 88 | /* -----------------------------------------------------------------------------
|
|---|
| 89 | Definitions for timer service feature
|
|---|
| 90 | -------------------------------------------------------------------------------*/
|
|---|
| 91 |
|
|---|
| 92 | #define TIMX TIM1
|
|---|
| 93 | #define TIMX_CLK_ENABLE LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1)
|
|---|
| 94 | #define TIMX_CLK_DISABLE LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_TIM1)
|
|---|
| 95 | #define TIMX_CHANNEL_CH1 LL_TIM_CHANNEL_CH1
|
|---|
| 96 | #define TIMX_CHANNEL_CH2 LL_TIM_CHANNEL_CH2
|
|---|
| 97 | #define TIMX_CHANNEL_CH3 LL_TIM_CHANNEL_CH3
|
|---|
| 98 | #define TIMX_CHANNEL_CH4 LL_TIM_CHANNEL_CH4
|
|---|
| 99 | #define TIMX_CHANNEL1_SETEVENT do{ \
|
|---|
| 100 | LL_TIM_OC_SetCompareCH1(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
|---|
| 101 | LL_TIM_ClearFlag_CC1(TIMX); \
|
|---|
| 102 | }while(0)
|
|---|
| 103 | #define TIMX_CHANNEL2_SETEVENT do{ \
|
|---|
| 104 | LL_TIM_OC_SetCompareCH2(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
|---|
| 105 | LL_TIM_ClearFlag_CC2(TIMX); \
|
|---|
| 106 | }while(0)
|
|---|
| 107 | #define TIMX_CHANNEL3_SETEVENT do{ \
|
|---|
| 108 | LL_TIM_OC_SetCompareCH3(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
|---|
| 109 | LL_TIM_ClearFlag_CC3(TIMX); \
|
|---|
| 110 | }while(0)
|
|---|
| 111 | #define TIMX_CHANNEL4_SETEVENT do{ \
|
|---|
| 112 | LL_TIM_OC_SetCompareCH4(TIMX, (TimeUs + TIMX->CNT) % TIM_MAX_TIME);\
|
|---|
| 113 | LL_TIM_ClearFlag_CC4(TIMX); \
|
|---|
| 114 | }while(0)
|
|---|
| 115 | #define TIMX_CHANNEL1_GETFLAG LL_TIM_IsActiveFlag_CC1
|
|---|
| 116 | #define TIMX_CHANNEL2_GETFLAG LL_TIM_IsActiveFlag_CC2
|
|---|
| 117 | #define TIMX_CHANNEL3_GETFLAG LL_TIM_IsActiveFlag_CC3
|
|---|
| 118 | #define TIMX_CHANNEL4_GETFLAG LL_TIM_IsActiveFlag_CC4
|
|---|
| 119 |
|
|---|
| 120 | #ifdef __cplusplus
|
|---|
| 121 | }
|
|---|
| 122 | #endif
|
|---|
| 123 |
|
|---|
| 124 | #endif /* USBPD_DEVICE_CONF_H */
|
|---|
| 125 |
|
|---|