Community-PIO-CH32V / platform-ch32v

PlatformIO platform for CH32V RISC-V chips (CH32V003, CH32V103, CH32V20x, CH32V30x, CH32X035) and CH56x, CH57x, CH58x, CH59x
Apache License 2.0
234 stars 37 forks source link

CH32X035 PD SNK example not compiling #46

Closed RathBee closed 9 months ago

RathBee commented 9 months ago

Steps to reproduce: 1.Download CH32X035EVT.zip from WCH's website, extract EVT/EXAM/USBPD/USBPD_SNK/User 2.Create a project in pio, choose any CH32X035-based board. 3.place all source code in pio /src folder 4.pio build

Expected behavior: Code complies without any issue

Actual behavior:

Compilation fails.

Error log:

CONFIGURATION: https://docs.platformio.org/page/boards/ch32v/ch32x035f8u6_evt_r0.html
PLATFORM: WCH CH32V (1.1.0+sha.9ed15cc) > CH32X035F8U6-EVT-R0
HARDWARE: CH32X035F8U6 144MHz, 20KB RAM, 62KB Flash
DEBUG: Current (wch-link) On-board (wch-link) External (minichlink)
PACKAGES: 
 - framework-wch-noneos-sdk @ 2.20000.0+sha.cdf2322 
 - tool-openocd-riscv-wch @ 2.1100.230329 (11.0) 
 - toolchain-riscv @ 1.80200.190731+sha.e8e7ba9
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/ch32x035f8u6_evt_r0/src/PD_Process.o
Compiling .pio/build/ch32x035f8u6_evt_r0/src/main.o
In file included from src/PD_Process.c:15:
src/PD_Process.h:23:8: error: unknown type name 'UINT8'
 extern UINT8  Tmr_Ms_Cnt_Last;
        ^~~~~
src/PD_Process.h:24:8: error: unknown type name 'UINT8'
 extern UINT8  Tmr_Ms_Dlt;
        ^~~~~
src/PD_Process.h:25:8: error: unknown type name 'UINT8'
 extern UINT8  Tim_Ms_Cnt;
        ^~~~~
src/PD_Process.h:27:8: error: unknown type name 'UINT8'
 extern UINT8  PDO_Len;
        ^~~~~
src/PD_Process.h:28:8: error: unknown type name 'PD_CONTROL'
 extern PD_CONTROL PD_Ctl;
        ^~~~~~~~~~
src/PD_Process.h:30:8: error: unknown type name 'UINT8'
 extern UINT8 send_data[ ];
        ^~~~~
src/PD_Process.h:31:8: error: unknown type name 'UINT8'
 extern UINT8 PD_Ack_Buf[ ];
        ^~~~~
src/PD_Process.h:33:37: error: unknown type name 'UINT8'
 extern __attribute__ ((aligned(4))) UINT8 PD_Rx_Buf[ 34 ];
                                     ^~~~~
src/PD_Process.h:34:37: error: unknown type name 'UINT8'
 extern __attribute__ ((aligned(4))) UINT8 PD_Tx_Buf[ 34 ];
                                     ^~~~~
src/PD_Process.h:44:8: error: unknown type name 'UINT8'
 extern UINT8 PD_Detect( void );
        ^~~~~
src/PD_Process.h:46:29: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Load_Header( UINT8 ex, UINT8 msg_type );
                             ^~~~~
                             UINT8_C
src/PD_Process.h:46:39: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Load_Header( UINT8 ex, UINT8 msg_type );
                                       ^~~~~
                                       UINT8_C
src/PD_Process.h:47:8: error: unknown type name 'UINT8'
 extern UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len );
        ^~~~~
src/PD_Process.h:47:30: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len );
                              ^~~~~
                              UINT8_C
src/PD_Process.h:47:43: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len );
                                           ^~~~~
                                           UINT8_C
src/PD_Process.h:48:30: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                              ^~~~~
                              UINT8_C
src/PD_Process.h:48:42: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                                          ^~~~~
                                          UINT8_C
src/PD_Process.h:48:55: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                                                       ^~~~~
                                                       UINT8_C
src/PD_Process.h:48:66: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                                                                  ^~~~~
                                                                  UINT8_C
src/PD_Process.h:50:29: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                             ^~~~~
                             UINT8_C
src/PD_Process.h:50:44: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                                            ^~~~~
                                            UINT8_C
src/PD_Process.h:50:59: error: unknown type name 'UINT16'; did you mean 'UINT16_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                                                           ^~~~~~
                                                           UINT16_C
src/PD_Process.h:50:76: error: unknown type name 'UINT16'; did you mean 'UINT16_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                                                                            ^~~~~~
                                                                            UINT16_C
src/PD_Process.c:19:38: error: conflicting types for 'PD_Rx_Buf'
 __attribute__ ((aligned(4))) uint8_t PD_Rx_Buf[ 34 ];                           /* PD receive buffer */
                                      ^~~~~~~~~
In file included from src/PD_Process.c:15:
src/PD_Process.h:33:43: note: previous declaration of 'PD_Rx_Buf' was here
 extern __attribute__ ((aligned(4))) UINT8 PD_Rx_Buf[ 34 ];
                                           ^~~~~~~~~
src/PD_Process.c:20:38: error: conflicting types for 'PD_Tx_Buf'
 __attribute__ ((aligned(4))) uint8_t PD_Tx_Buf[ 34 ];                           /* PD send buffer */
                                      ^~~~~~~~~
In file included from src/PD_Process.c:15:
src/PD_Process.h:34:43: note: previous declaration of 'PD_Tx_Buf' was here
 extern __attribute__ ((aligned(4))) UINT8 PD_Tx_Buf[ 34 ];
                                           ^~~~~~~~~
src/PD_Process.c:23:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 PD_Ack_Buf[ 2 ];                                                          /* PD-ACK buffer */
 ^~~~~
 UINT8_C
src/PD_Process.c:25:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8  Tmr_Ms_Cnt_Last;                                                         /* System timer millisecond timing final value */
 ^~~~~
 UINT8_C
src/PD_Process.c:26:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8  Tmr_Ms_Dlt;                                                              /* System timer millisecond timing this interval value */
 ^~~~~
 UINT8_C
src/PD_Process.c:28:1: error: unknown type name 'PD_CONTROL'; did you mean 'ADC_CONT'?
 PD_CONTROL PD_Ctl;                                                              /* PD Control Related Structures */
 ^~~~~~~~~~
 ADC_CONT
src/PD_Process.c:30:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8  Adapter_SrcCap[ 30 ];                                                    /* SrcCap message from the adapter */
 ^~~~~
 UINT8_C
src/PD_Process.c:32:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8  PDO_Len;
 ^~~~~
 UINT8_C
src/PD_Process.c:35:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 SrcCap_5V3A_Tab[ 4 ]  = { 0X2C, 0X91, 0X01, 0X3E };
 ^~~~~
 UINT8_C
src/PD_Process.c:36:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 SrcCap_5V2A_Tab[ 4 ]  = { 0XC8, 0X90, 0X01, 0X3E };
 ^~~~~
 UINT8_C
src/PD_Process.c:37:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 SinkCap_5V1A_Tab[ 4 ] = { 0X64, 0X90, 0X01, 0X36 };
 ^~~~~
 UINT8_C
src/PD_Process.c:40:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 SrcCap_Ext_Tab[ 28 ] =
 ^~~~~
 UINT8_C
In file included from src/main.c:38:
src/PD_Process.h:23:8: error: unknown type name 'UINT8'
 extern UINT8  Tmr_Ms_Cnt_Last;
        ^~~~~
src/PD_Process.h:24:8: error: unknown type name 'UINT8'
 extern UINT8  Tmr_Ms_Dlt;
        ^~~~~
src/PD_Process.h:25:8: error: unknown type name 'UINT8'
 extern UINT8  Tim_Ms_Cnt;
        ^~~~~
src/PD_Process.h:27:8: error: unknown type name 'UINT8'
 extern UINT8  PDO_Len;
        ^~~~~
src/PD_Process.h:28:8: error: unknown type name 'PD_CONTROL'
 extern PD_CONTROL PD_Ctl;
        ^~~~~~~~~~
src/PD_Process.c:51:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 Status_Ext_Tab[ 8 ] =
 ^~~~~
 UINT8_C
src/PD_Process.h:30:8: error: unknown type name 'UINT8'
 extern UINT8 send_data[ ];
        ^~~~~
src/PD_Process.h:31:8: error: unknown type name 'UINT8'
 extern UINT8 PD_Ack_Buf[ ];
        ^~~~~
src/PD_Process.h:33:37: error: unknown type name 'UINT8'
 extern __attribute__ ((aligned(4))) UINT8 PD_Rx_Buf[ 34 ];
                                     ^~~~~
src/PD_Process.h:34:37: error: unknown type name 'UINT8'
 extern __attribute__ ((aligned(4))) UINT8 PD_Tx_Buf[ 34 ];
                                     ^~~~~
src/PD_Process.h:44:8: error: unknown type name 'UINT8'
 extern UINT8 PD_Detect( void );
        ^~~~~
src/PD_Process.h:46:29: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Load_Header( UINT8 ex, UINT8 msg_type );
                             ^~~~~
                             UINT8_C
src/PD_Process.h:46:39: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Load_Header( UINT8 ex, UINT8 msg_type );
                                       ^~~~~
                                       UINT8_C
src/PD_Process.h:47:8: error: unknown type name 'UINT8'
 extern UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len );
        ^~~~~
src/PD_Process.c: In function 'USBPD_IRQHandler':
src/PD_Process.h:47:30: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len );
                              ^~~~~
                              UINT8_C
src/PD_Process.c:67:24: error: 'IF_RX_ACT' undeclared (first use in this function)
     if(USBPD->STATUS & IF_RX_ACT)
                        ^~~~~~~~~
src/PD_Process.c:67:24: note: each undeclared identifier is reported only once for each function it appears in
src/PD_Process.h:47:43: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len );
                                           ^~~~~
                                           UINT8_C
src/PD_Process.h:48:30: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                              ^~~~~
                              UINT8_C
src/PD_Process.h:48:42: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                                          ^~~~~
                                          UINT8_C
src/PD_Process.h:48:55: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                                                       ^~~~~
                                                       UINT8_C
src/PD_Process.h:48:66: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop );
                                                                  ^~~~~
                                                                  UINT8_C
src/PD_Process.h:50:29: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                             ^~~~~
                             UINT8_C
src/PD_Process.h:50:44: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                                            ^~~~~
                                            UINT8_C
src/PD_Process.c:70:31: error: 'MASK_PD_STAT' undeclared (first use in this function)
         if( ( USBPD->STATUS & MASK_PD_STAT ) == PD_RX_SOP0 )
                               ^~~~~~~~~~~~
src/PD_Process.h:50:59: error: unknown type name 'UINT16'; did you mean 'UINT16_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                                                           ^~~~~~
                                                           UINT16_C
src/PD_Process.h:50:76: error: unknown type name 'UINT16'; did you mean 'UINT16_C'?
 extern void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage );
                                                                            ^~~~~~
                                                                            UINT16_C
src/main.c:42:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8  Tim_Ms_Cnt = 0x00;
 ^~~~~
 UINT8_C
src/PD_Process.c:70:49: error: 'PD_RX_SOP0' undeclared (first use in this function); did you mean 'PD_Rx_Buf'?
         if( ( USBPD->STATUS & MASK_PD_STAT ) == PD_RX_SOP0 )
                                                 ^~~~~~~~~~
                                                 PD_Rx_Buf
src/main.c: In function 'main':
src/main.c:85:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
     printf( "SystemClk:%d\r\n", SystemCoreClock );
                        ~^       ~~~~~~~~~~~~~~~
                        %ld
src/main.c:86:24: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
     printf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID() );
                     ~~~^       ~~~~~~~~~~~~~~~~~~
                     %08lx
src/main.c:97:15: error: request for member 'Det_Timer' in something not a structure or union
         PD_Ctl.Det_Timer += Tmr_Ms_Dlt;
               ^
src/main.c:98:19: error: request for member 'Det_Timer' in something not a structure or union
         if( PD_Ctl.Det_Timer > 4 )
                   ^
src/main.c:100:19: error: request for member 'Det_Timer' in something not a structure or union
             PD_Ctl.Det_Timer = 0;
                   ^
src/PD_Process.c:75:84: error: 'DEF_TYPE_GOODCRC' undeclared (first use in this function)
                 if( ( USBPD->BMC_BYTE_CNT != 6 ) || ( ( PD_Rx_Buf[ 0 ] & 0x1F ) != DEF_TYPE_GOODCRC ) )
                                                                                    ^~~~~~~~~~~~~~~~
src/PD_Process.c:79:73: error: request for member 'Flag' in something not a structure or union
                     PD_Ack_Buf[ 1 ] = ( PD_Rx_Buf[ 1 ] & 0x0E ) | PD_Ctl.Flag.Bit.Auto_Ack_PRRole;
                                                                         ^
src/PD_Process.c:80:38: error: 'IE_TX_END' undeclared (first use in this function); did you mean 'SEEK_END'?
                     USBPD->CONFIG |= IE_TX_END ;
                                      ^~~~~~~~~
                                      SEEK_END
src/PD_Process.c:81:21: warning: implicit declaration of function 'PD_Phy_SendPack'; did you mean 'SPI_I2S_SendData'? [-Wimplicit-function-declaration]
                     PD_Phy_SendPack( 0, PD_Ack_Buf, 2, UPD_SOP0 );
                     ^~~~~~~~~~~~~~~
                     SPI_I2S_SendData
src/PD_Process.c:81:56: error: 'UPD_SOP0' undeclared (first use in this function); did you mean 'ADC_SMP0'?
                     PD_Phy_SendPack( 0, PD_Ack_Buf, 2, UPD_SOP0 );
                                                        ^~~~~~~~
                                                        ADC_SMP0
src/PD_Process.c:86:24: error: 'IF_TX_END' undeclared (first use in this function)
     if(USBPD->STATUS & IF_TX_END)
                        ^~~~~~~~~
src/PD_Process.c:89:29: error: 'CC_LVE' undeclared (first use in this function)
         USBPD->PORT_CC1 &= ~CC_LVE;
                             ^~~~~~
src/PD_Process.c:95:15: error: request for member 'Flag' in something not a structure or union
         PD_Ctl.Flag.Bit.Msg_Recvd = 1;                                          /* Packet received flag */
               ^
src/PD_Process.c:98:24: error: 'IF_RX_RESET' undeclared (first use in this function); did you mean 'Bit_RESET'?
     if(USBPD->STATUS & IF_RX_RESET)
                        ^~~~~~~~~~~
                        Bit_RESET
src/PD_Process.c: In function 'PD_Rx_Mode':
src/PD_Process.c:115:22: error: 'PD_ALL_CLR' undeclared (first use in this function); did you mean 'PD_Ack_Buf'?
Compiling .pio/build/ch32x035f8u6_evt_r0/FrameworkNoneOSVariant/ch32x035_usart.o
     USBPD->CONFIG |= PD_ALL_CLR;
                      ^~~~~~~~~~
                      PD_Ack_Buf
src/PD_Process.c:117:22: error: 'IE_RX_ACT' undeclared (first use in this function)
     USBPD->CONFIG |= IE_RX_ACT | IE_RX_RESET|PD_DMA_EN;
                      ^~~~~~~~~
src/PD_Process.c:117:34: error: 'IE_RX_RESET' undeclared (first use in this function); did you mean 'Bit_RESET'?
     USBPD->CONFIG |= IE_RX_ACT | IE_RX_RESET|PD_DMA_EN;
                                  ^~~~~~~~~~~
                                  Bit_RESET
src/PD_Process.c:117:46: error: 'PD_DMA_EN' undeclared (first use in this function); did you mean 'RCC_DMA1EN'?
     USBPD->CONFIG |= IE_RX_ACT | IE_RX_RESET|PD_DMA_EN;
                                              ^~~~~~~~~
                                              RCC_DMA1EN
src/PD_Process.c:118:19: error: 'UINT32' undeclared (first use in this function); did you mean 'UINT32_C'?
     USBPD->DMA = (UINT32)(UINT8 *)PD_Rx_Buf;
                   ^~~~~~
                   UINT32_C
src/PD_Process.c:118:27: error: 'UINT8' undeclared (first use in this function); did you mean 'UINT8_C'?
     USBPD->DMA = (UINT32)(UINT8 *)PD_Rx_Buf;
                           ^~~~~
                           UINT8_C
src/PD_Process.c:118:34: error: expected expression before ')' token
     USBPD->DMA = (UINT32)(UINT8 *)PD_Rx_Buf;
                                  ^
*** [.pio/build/ch32x035f8u6_evt_r0/src/main.o] Error 1
src/PD_Process.c:119:24: error: 'PD_TX_EN' undeclared (first use in this function); did you mean 'PD_Tx_Buf'?
     USBPD->CONTROL &= ~PD_TX_EN;
Compiling .pio/build/ch32x035f8u6_evt_r0/FrameworkNoneOSVariant/ch32x035_wwdg.o
                        ^~~~~~~~
                        PD_Tx_Buf
src/PD_Process.c:120:26: error: 'UPD_TMR_RX_48M' undeclared (first use in this function)
     USBPD->BMC_CLK_CNT = UPD_TMR_RX_48M;
                          ^~~~~~~~~~~~~~
src/PD_Process.c:121:23: error: 'BMC_START' undeclared (first use in this function); did you mean 'ADC_STRT'?
     USBPD->CONTROL |= BMC_START ;
                       ^~~~~~~~~
                       ADC_STRT
src/PD_Process.c: In function 'PD_SRC_Init':
src/PD_Process.c:134:11: error: request for member 'Flag' in something not a structure or union
     PD_Ctl.Flag.Bit.PR_Role = 1;                                          /* SRC mode */
           ^
src/PD_Process.c:135:11: error: request for member 'Flag' in something not a structure or union
     PD_Ctl.Flag.Bit.Auto_Ack_PRRole = 1;                                  /* Default auto-responder role is SRC */
           ^
src/PD_Process.c:136:23: error: 'CC_CMP_66' undeclared (first use in this function)
     USBPD->PORT_CC1 = CC_CMP_66 | CC_PU_330;
                       ^~~~~~~~~
src/PD_Process.c:136:35: error: 'CC_PU_330' undeclared (first use in this function)
     USBPD->PORT_CC1 = CC_CMP_66 | CC_PU_330;
                                   ^~~~~~~~~
src/PD_Process.c: In function 'PD_SINK_Init':
src/PD_Process.c:149:11: error: request for member 'Flag' in something not a structure or union
     PD_Ctl.Flag.Bit.PR_Role = 0;                                          /* SINK mode */
           ^
src/PD_Process.c:150:11: error: request for member 'Flag' in something not a structure or union
     PD_Ctl.Flag.Bit.Auto_Ack_PRRole = 0;                                  /* Default auto-responder role is SINK */
           ^
src/PD_Process.c:151:23: error: 'CC_CMP_66' undeclared (first use in this function)
     USBPD->PORT_CC1 = CC_CMP_66 | CC_PD;
                       ^~~~~~~~~
src/PD_Process.c:151:35: error: 'CC_PD' undeclared (first use in this function)
     USBPD->PORT_CC1 = CC_CMP_66 | CC_PD;
                                   ^~~~~
src/PD_Process.c: In function 'PD_PHY_Reset':
src/PD_Process.c:165:11: error: request for member 'Flag' in something not a structure or union
     PD_Ctl.Flag.Bit.Stop_Det_Chk = 0;                                     /* PD disconnection detection is enabled by default */
           ^
src/PD_Process.c:166:11: error: request for member 'PD_State' in something not a structure or union
     PD_Ctl.PD_State = STA_IDLE;                                           /* Set idle state */
           ^
src/PD_Process.c:166:23: error: 'STA_IDLE' undeclared (first use in this function)
     PD_Ctl.PD_State = STA_IDLE;                                           /* Set idle state */
                       ^~~~~~~~
src/PD_Process.c:167:11: error: request for member 'Flag' in something not a structure or union
     PD_Ctl.Flag.Bit.PD_Comm_Succ = 0;
           ^
src/PD_Process.c: In function 'PD_Init':
src/PD_Process.c:187:19: error: 'USBPD_IN_HVT' undeclared (first use in this function); did you mean 'USBPD_IRQn'?
     AFIO->CTLR |= USBPD_IN_HVT | USBPD_PHY_V33;
                   ^~~~~~~~~~~~
                   USBPD_IRQn
src/PD_Process.c:187:34: error: 'USBPD_PHY_V33' undeclared (first use in this function)
     AFIO->CTLR |= USBPD_IN_HVT | USBPD_PHY_V33;
                                  ^~~~~~~~~~~~~
src/PD_Process.c:188:21: error: 'PD_DMA_EN' undeclared (first use in this function); did you mean 'RCC_DMA1EN'?
     USBPD->CONFIG = PD_DMA_EN;
                     ^~~~~~~~~
                     RCC_DMA1EN
src/PD_Process.c:189:21: error: 'BUF_ERR' undeclared (first use in this function)
     USBPD->STATUS = BUF_ERR | IF_RX_BIT | IF_RX_BYTE | IF_RX_ACT | IF_RX_RESET | IF_TX_END;
                     ^~~~~~~
src/PD_Process.c:189:31: error: 'IF_RX_BIT' undeclared (first use in this function)
     USBPD->STATUS = BUF_ERR | IF_RX_BIT | IF_RX_BYTE | IF_RX_ACT | IF_RX_RESET | IF_TX_END;
                               ^~~~~~~~~
src/PD_Process.c:189:43: error: 'IF_RX_BYTE' undeclared (first use in this function)
     USBPD->STATUS = BUF_ERR | IF_RX_BIT | IF_RX_BYTE | IF_RX_ACT | IF_RX_RESET | IF_TX_END;
                                           ^~~~~~~~~~
src/PD_Process.c:189:56: error: 'IF_RX_ACT' undeclared (first use in this function)
     USBPD->STATUS = BUF_ERR | IF_RX_BIT | IF_RX_BYTE | IF_RX_ACT | IF_RX_RESET | IF_TX_END;
                                                        ^~~~~~~~~
src/PD_Process.c:189:68: error: 'IF_RX_RESET' undeclared (first use in this function); did you mean 'Bit_RESET'?
     USBPD->STATUS = BUF_ERR | IF_RX_BIT | IF_RX_BYTE | IF_RX_ACT | IF_RX_RESET | IF_TX_END;
                                                                    ^~~~~~~~~~~
                                                                    Bit_RESET
src/PD_Process.c:189:82: error: 'IF_TX_END' undeclared (first use in this function)
     USBPD->STATUS = BUF_ERR | IF_RX_BIT | IF_RX_BYTE | IF_RX_ACT | IF_RX_RESET | IF_TX_END;
                                                                                  ^~~~~~~~~
src/PD_Process.c:191:20: error: request for member 'PD_State' in something not a structure or union
     memset( &PD_Ctl.PD_State, 0x00, sizeof( PD_CONTROL ) );
                    ^
src/PD_Process.c:191:45: error: 'PD_CONTROL' undeclared (first use in this function); did you mean 'ADC_CONT'?
     memset( &PD_Ctl.PD_State, 0x00, sizeof( PD_CONTROL ) );
                                             ^~~~~~~~~~
                                             ADC_CONT
src/PD_Process.c: At top level:
src/PD_Process.c:205:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 PD_Detect( void )
 ^~~~~
 UINT8_C
src/PD_Process.c: In function 'PD_Detect':
src/PD_Process.c:207:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8  ret = 0;
     ^~~~~
     UINT8_C
src/PD_Process.c:208:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8  cmp_cc1 = 0;
     ^~~~~
     UINT8_C
src/PD_Process.c:209:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8  cmp_cc2 = 0;
     ^~~~~
     UINT8_C
src/PD_Process.c:211:14: error: request for member 'Flag' in something not a structure or union
     if(PD_Ctl.Flag.Bit.Connected)                                       /* Detect disconnection */
              ^
src/PD_Process.c:220:31: error: 'CC_CMP_Mask' undeclared (first use in this function)
         USBPD->PORT_CC1 &= ~( CC_CMP_Mask|PA_CC_AI );
                               ^~~~~~~~~~~
src/PD_Process.c:220:43: error: 'PA_CC_AI' undeclared (first use in this function)
         USBPD->PORT_CC1 &= ~( CC_CMP_Mask|PA_CC_AI );
                                           ^~~~~~~~
src/PD_Process.c:221:28: error: 'CC_CMP_22' undeclared (first use in this function); did you mean 'ADC_SMP8_2'?
         USBPD->PORT_CC1 |= CC_CMP_22;
                            ^~~~~~~~~
                            ADC_SMP8_2
src/PD_Process.c:225:24: error: 'bCC_CMP_22' undeclared (first use in this function); did you mean 'ADC_SMP8_2'?
             cmp_cc1 |= bCC_CMP_22;
                        ^~~~~~~~~~
                        ADC_SMP8_2
src/PD_Process.c:228:28: error: 'CC_CMP_66' undeclared (first use in this function)
         USBPD->PORT_CC1 |= CC_CMP_66;
                            ^~~~~~~~~
src/PD_Process.c:242:31: error: 'CC_PD' undeclared (first use in this function)
         if (USBPD->PORT_CC1 & CC_PD)
                               ^~~~~
src/PD_Process.c: In function 'PD_Det_Proc':
src/PD_Process.c:277:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8  status;
     ^~~~~
     UINT8_C
src/PD_Process.c:279:15: error: request for member 'Flag' in something not a structure or union
     if( PD_Ctl.Flag.Bit.Connected )
               ^
src/PD_Process.c:296:19: error: request for member 'Det_Cnt' in something not a structure or union
             PD_Ctl.Det_Cnt = 0;
                   ^
src/PD_Process.c:300:19: error: request for member 'Det_Cnt' in something not a structure or union
             PD_Ctl.Det_Cnt++;
                   ^
src/PD_Process.c:302:19: error: request for member 'Det_Cnt' in something not a structure or union
         if( PD_Ctl.Det_Cnt >= 5 )
                   ^
src/PD_Process.c:304:19: error: request for member 'Det_Cnt' in something not a structure or union
             PD_Ctl.Det_Cnt = 0;
                   ^
src/PD_Process.c:305:19: error: request for member 'Flag' in something not a structure or union
             PD_Ctl.Flag.Bit.Connected = 1;
                   ^
src/PD_Process.c:306:23: error: request for member 'Flag' in something not a structure or union
             if( PD_Ctl.Flag.Bit.Stop_Det_Chk == 0 )
                       ^
src/PD_Process.c:308:40: error: 'CC_PD' undeclared (first use in this function)
                 if( (USBPD->PORT_CC1 & CC_PD) || (USBPD->PORT_CC2 & CC_PD) )
                                        ^~~~~
src/PD_Process.c:313:43: error: 'CC_SEL' undeclared (first use in this function); did you mean 'FD_SET'?
                         USBPD->CONFIG &= ~CC_SEL;
                                           ^~~~~~
                                           FD_SET
src/PD_Process.c:319:27: error: request for member 'PD_State' in something not a structure or union
                     PD_Ctl.PD_State = STA_SRC_CONNECT;
                           ^
src/PD_Process.c:319:39: error: 'STA_SRC_CONNECT' undeclared (first use in this function)
                     PD_Ctl.PD_State = STA_SRC_CONNECT;
                                       ^~~~~~~~~~~~~~~
src/PD_Process.c:323:23: error: request for member 'PD_Comm_Timer' in something not a structure or union
                 PD_Ctl.PD_Comm_Timer = 0;
                       ^
src/PD_Process.c: At top level:
src/PD_Process.c:336:23: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop )
                       ^~~~~
                       UINT8_C
src/PD_Process.c:336:35: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop )
                                   ^~~~~
                                   UINT8_C
src/PD_Process.c:336:48: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop )
                                                ^~~~~
                                                UINT8_C
src/PD_Process.c:336:59: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_Phy_SendPack( UINT8 mode, UINT8 *pbuf, UINT8 len, UINT8 sop )
                                                           ^~~~~
                                                           UINT8_C
src/PD_Process.c:391:22: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_Load_Header( UINT8 ex, UINT8 msg_type )
                      ^~~~~
                      UINT8_C
src/PD_Process.c:391:32: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_Load_Header( UINT8 ex, UINT8 msg_type )
                                ^~~~~
                                UINT8_C
src/PD_Process.c:436:1: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len )
 ^~~~~
 UINT8_C
src/PD_Process.c:436:23: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len )
                       ^~~~~
                       UINT8_C
src/PD_Process.c:436:36: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 UINT8 PD_Send_Handle( UINT8 *pbuf, UINT8 len )
                                    ^~~~~
                                    UINT8_C
src/PD_Process.c:507:19: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PDO_Request( UINT8 pdo_index )
                   ^~~~~
                   UINT8_C
src/PD_Process.c: In function 'PD_Save_Adapter_SrcCap':
src/PD_Process.c:558:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8  i, len;
     ^~~~~
     UINT8_C
src/PD_Process.c: At top level:
src/PD_Process.c:603:22: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage )
                      ^~~~~
                      UINT8_C
src/PD_Process.c:603:37: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
 void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage )
                                     ^~~~~
                                     UINT8_C
src/PD_Process.c:603:52: error: unknown type name 'UINT16'; did you mean 'UINT16_C'?
 void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage )
                                                    ^~~~~~
                                                    UINT16_C
src/PD_Process.c:603:69: error: unknown type name 'UINT16'; did you mean 'UINT16_C'?
 void PD_PDO_Analyse( UINT8 pdo_idx, UINT8 *srccap, UINT16 *current, UINT16 *voltage )
                                                                     ^~~~~~
                                                                     UINT16_C
src/PD_Process.c: In function 'PD_Main_Proc':
src/PD_Process.c:634:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8  status;
     ^~~~~
     UINT8_C
src/PD_Process.c:635:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8  pd_header;
     ^~~~~
     UINT8_C
src/PD_Process.c:636:5: error: unknown type name 'UINT8'; did you mean 'UINT8_C'?
     UINT8 var;
     ^~~~~
     UINT8_C
src/PD_Process.c:637:5: error: unknown type name 'UINT16'; did you mean 'UINT16_C'?
     UINT16 Current,Voltage;
     ^~~~~~
     UINT16_C
src/PD_Process.c:640:11: error: request for member 'PD_BusIdle_Timer' in something not a structure or union
     PD_Ctl.PD_BusIdle_Timer += Tmr_Ms_Dlt;
           ^
src/PD_Process.c:643:19: error: request for member 'PD_State' in something not a structure or union
     switch( PD_Ctl.PD_State )
                   ^
src/PD_Process.c:645:14: error: 'STA_DISCONNECT' undeclared (first use in this function)
         case STA_DISCONNECT:
              ^~~~~~~~~~~~~~
src/PD_Process.c:651:14: error: 'STA_SRC_CONNECT' undeclared (first use in this function)
         case STA_SRC_CONNECT:
              ^~~~~~~~~~~~~~~
src/PD_Process.c:654:19: error: request for member 'PD_Comm_Timer' in something not a structure or union
             PD_Ctl.PD_Comm_Timer += Tmr_Ms_Dlt;
                   ^
src/PD_Process.c:655:23: error: request for member 'PD_Comm_Timer' in something not a structure or union
             if( PD_Ctl.PD_Comm_Timer > 999 )
                       ^
src/PD_Process.c:658:23: error: request for member 'Err_Op_Cnt' in something not a structure or union
                 PD_Ctl.Err_Op_Cnt++;
                       ^
src/PD_Process.c:659:27: error: request for member 'Err_Op_Cnt' in something not a structure or union
                 if( PD_Ctl.Err_Op_Cnt > 5 )
                           ^
src/PD_Process.c:661:27: error: request for member 'Err_Op_Cnt' in something not a structure or union
                     PD_Ctl.Err_Op_Cnt = 0;
                           ^
src/PD_Process.c:662:27: error: request for member 'PD_State' in something not a structure or union
                     PD_Ctl.PD_State = STA_IDLE;
                           ^
src/PD_Process.c:662:39: error: 'STA_IDLE' undeclared (first use in this function)
                     PD_Ctl.PD_State = STA_IDLE;
                                       ^~~~~~~~
src/PD_Process.c:671:14: error: 'STA_RX_ACCEPT_WAIT' undeclared (first use in this function)
         case STA_RX_ACCEPT_WAIT:
              ^~~~~~~~~~~~~~~~~~
src/PD_Process.c:673:14: error: 'STA_RX_PS_RDY_WAIT' undeclared (first use in this function)
         case STA_RX_PS_RDY_WAIT:
              ^~~~~~~~~~~~~~~~~~
src/PD_Process.c:675:19: error: request for member 'PD_Comm_Timer' in something not a structure or union
             PD_Ctl.PD_Comm_Timer += Tmr_Ms_Dlt;
                   ^
src/PD_Process.c:676:23: error: request for member 'PD_Comm_Timer' in something not a structure or union
             if( PD_Ctl.PD_Comm_Timer > 499 )
                       ^
src/PD_Process.c:678:23: error: request for member 'Flag' in something not a structure or union
                 PD_Ctl.Flag.Bit.Stop_Det_Chk = 0;                         /* Enable connection detection*/
                       ^
src/PD_Process.c:679:23: error: request for member 'PD_State' in something not a structure or union
                 PD_Ctl.PD_State = STA_TX_SOFTRST;
                       ^
src/PD_Process.c:679:35: error: 'STA_TX_SOFTRST' undeclared (first use in this function)
                 PD_Ctl.PD_State = STA_TX_SOFTRST;
                                   ^~~~~~~~~~~~~~
src/PD_Process.c:680:23: error: request for member 'PD_Comm_Timer' in something not a structure or union
                 PD_Ctl.PD_Comm_Timer = 0;
                       ^
src/PD_Process.c:684:14: error: 'STA_RX_PS_RDY' undeclared (first use in this function)
         case STA_RX_PS_RDY:
              ^~~~~~~~~~~~~
src/PD_Process.c:686:19: error: request for member 'PD_State' in something not a structure or union
             PD_Ctl.PD_State = STA_IDLE;
                   ^
src/PD_Process.c:687:23: error: request for member 'PD_State' in something not a structure or union
             if( PD_Ctl.PD_State == STA_RX_APD_PS_RDY_WAIT )
                       ^
src/PD_Process.c:687:36: error: 'STA_RX_APD_PS_RDY_WAIT' undeclared (first use in this function)
             if( PD_Ctl.PD_State == STA_RX_APD_PS_RDY_WAIT )
                                    ^~~~~~~~~~~~~~~~~~~~~~
src/PD_Process.c:689:23: error: request for member 'PD_State' in something not a structure or union
                 PD_Ctl.PD_State = STA_RX_APD_PS_RDY;
                       ^
src/PD_Process.c:689:35: error: 'STA_RX_APD_PS_RDY' undeclared (first use in this function)
                 PD_Ctl.PD_State = STA_RX_APD_PS_RDY;
                                   ^~~~~~~~~~~~~~~~~
src/PD_Process.c:696:13: warning: implicit declaration of function 'PD_Load_Header' [-Wimplicit-function-declaration]
             PD_Load_Header( 0x00, DEF_TYPE_SOFT_RESET );
             ^~~~~~~~~~~~~~
src/PD_Process.c:696:35: error: 'DEF_TYPE_SOFT_RESET' undeclared (first use in this function)
             PD_Load_Header( 0x00, DEF_TYPE_SOFT_RESET );
                                   ^~~~~~~~~~~~~~~~~~~
src/PD_Process.c:697:22: warning: implicit declaration of function 'PD_Send_Handle' [-Wimplicit-function-declaration]
             status = PD_Send_Handle( NULL, 0 );
                      ^~~~~~~~~~~~~~
src/PD_Process.c:698:27: error: 'DEF_PD_TX_OK' undeclared (first use in this function)
             if( status == DEF_PD_TX_OK )
                           ^~~~~~~~~~~~
src/PD_Process.c:701:23: error: request for member 'PD_State' in something not a structure or union
                 PD_Ctl.PD_State = STA_IDLE;
                       ^
src/PD_Process.c:705:23: error: request for member 'PD_State' in something not a structure or union
                 PD_Ctl.PD_State = STA_TX_HRST;
                       ^
src/PD_Process.c:705:35: error: 'STA_TX_HRST' undeclared (first use in this function)
                 PD_Ctl.PD_State = STA_TX_HRST;
                                   ^~~~~~~~~~~
src/PD_Process.c:707:19: error: request for member 'PD_Comm_Timer' in something not a structure or union
             PD_Ctl.PD_Comm_Timer = 0;
                   ^
src/PD_Process.c:713:19: error: request for member 'Flag' in something not a structure or union
             PD_Ctl.Flag.Bit.Stop_Det_Chk = 1;
                   ^
src/PD_Process.c:714:45: error: 'UPD_HARD_RESET' undeclared (first use in this function)
             PD_Phy_SendPack( 0x01, NULL, 0, UPD_HARD_RESET );                   /* send HRST */
                                             ^~~~~~~~~~~~~~
src/PD_Process.c:716:19: error: request for member 'PD_State' in something not a structure or union
             PD_Ctl.PD_State = STA_IDLE;
                   ^
src/PD_Process.c:717:19: error: request for member 'PD_Comm_Timer' in something not a structure or union
             PD_Ctl.PD_Comm_Timer = 0;
                   ^
src/PD_Process.c:725:15: error: request for member 'Flag' in something not a structure or union
     if( PD_Ctl.Flag.Bit.Msg_Recvd )
               ^
src/PD_Process.c:728:15: error: request for member 'Adapter_Idle_Cnt' in something not a structure or union
         PD_Ctl.Adapter_Idle_Cnt = 0x00;
               ^
src/PD_Process.c:732:18: error: 'DEF_TYPE_SRC_CAP' undeclared (first use in this function)
             case DEF_TYPE_SRC_CAP:
                  ^~~~~~~~~~~~~~~~
src/PD_Process.c:734:23: error: request for member 'Flag' in something not a structure or union
                 PD_Ctl.Flag.Bit.Stop_Det_Chk = 0;                         /* Enable PD disconnection detection */
                       ^
src/PD_Process.c:741:21: warning: implicit declaration of function 'PD_PDO_Analyse' [-Wimplicit-function-declaration]
                     PD_PDO_Analyse( var, &PD_Rx_Buf[ 2 ], &Current, &Voltage );
                     ^~~~~~~~~~~~~~
src/PD_Process.c:747:17: warning: implicit declaration of function 'PDO_Request'; did you mean 'PD_Detect'? [-Wimplicit-function-declaration]
                 PDO_Request( PDO_INDEX_1 );
                 ^~~~~~~~~~~
                 PD_Detect
src/PD_Process.c:747:30: error: 'PDO_INDEX_1' undeclared (first use in this function)
                 PDO_Request( PDO_INDEX_1 );
                              ^~~~~~~~~~~
src/PD_Process.c:750:18: error: 'DEF_TYPE_ACCEPT' undeclared (first use in this function)
             case DEF_TYPE_ACCEPT:
                  ^~~~~~~~~~~~~~~
src/PD_Process.c:752:23: error: request for member 'PD_State' in something not a structure or union
                 PD_Ctl.PD_State = STA_RX_PS_RDY_WAIT;
                       ^
src/PD_Process.c:753:23: error: request for member 'PD_Comm_Timer' in something not a structure or union
                 PD_Ctl.PD_Comm_Timer = 0;
                       ^
src/PD_Process.c:756:18: error: 'DEF_TYPE_PS_RDY' undeclared (first use in this function)
             case DEF_TYPE_PS_RDY:
                  ^~~~~~~~~~~~~~~
src/PD_Process.c:759:23: error: request for member 'PD_State' in something not a structure or union
                 PD_Ctl.PD_State = STA_RX_PS_RDY;
                       ^
src/PD_Process.c:762:18: error: 'DEF_TYPE_WAIT' undeclared (first use in this function)
             case DEF_TYPE_WAIT:
                  ^~~~~~~~~~~~~
src/PD_Process.c:766:18: error: 'DEF_TYPE_GET_SNK_CAP' undeclared (first use in this function)
             case DEF_TYPE_GET_SNK_CAP:
                  ^~~~~~~~~~~~~~~~~~~~
src/PD_Process.c:768:39: error: 'DEF_TYPE_SNK_CAP' undeclared (first use in this function)
                 PD_Load_Header( 0x00, DEF_TYPE_SNK_CAP );
                                       ^~~~~~~~~~~~~~~~
src/PD_Process.c:778:18: error: 'DEF_TYPE_GET_SRC_CAP_EX' undeclared (first use in this function)
             case DEF_TYPE_GET_SRC_CAP_EX:
                  ^~~~~~~~~~~~~~~~~~~~~~~
src/PD_Process.c:784:18: error: 'DEF_TYPE_GET_STATUS' undeclared (first use in this function)
             case DEF_TYPE_GET_STATUS:
                  ^~~~~~~~~~~~~~~~~~~
src/PD_Process.c:786:39: error: 'DEF_TYPE_GET_STATUS_R' undeclared (first use in this function)
                 PD_Load_Header( 0x01, DEF_TYPE_GET_STATUS_R );
                                       ^~~~~~~~~~~~~~~~~~~~~
src/PD_Process.c:790:18: error: 'DEF_TYPE_VCONN_SWAP' undeclared (first use in this function)
             case DEF_TYPE_VCONN_SWAP:
                  ^~~~~~~~~~~~~~~~~~~
src/PD_Process.c:792:39: error: 'DEF_TYPE_REJECT' undeclared (first use in this function)
                 PD_Load_Header( 0x00, DEF_TYPE_REJECT );
                                       ^~~~~~~~~~~~~~~
src/PD_Process.c:796:18: error: 'DEF_TYPE_VENDOR_DEFINED' undeclared (first use in this function)
             case DEF_TYPE_VENDOR_DEFINED:
                  ^~~~~~~~~~~~~~~~~~~~~~~
src/PD_Process.c:809:31: error: request for member 'Flag' in something not a structure or union
                         PD_Ctl.Flag.Bit.VDM_Version = 0;
                               ^
src/PD_Process.c:813:31: error: request for member 'Flag' in something not a structure or union
                         PD_Ctl.Flag.Bit.VDM_Version = 1;
                               ^
src/PD_Process.c:827:15: error: request for member 'Flag' in something not a structure or union
         PD_Ctl.Flag.Bit.Msg_Recvd = 0;                                    /* Clear the received flag */
               ^
src/PD_Process.c:828:15: error: request for member 'PD_BusIdle_Timer' in something not a structure or union
         PD_Ctl.PD_BusIdle_Timer = 0;                                      /* Idle time cleared */
               ^
*** [.pio/build/ch32x035f8u6_evt_r0/src/PD_Process.o] Error 1
maxgerhardt commented 9 months ago

You are right, this does not work in this platform currently because we are using V1.0.0 of the CH32X035 SPL, while the latest one is V1.0.1 and has the USB-PD header and code. I will update the base package shortly.

maxgerhardt commented 9 months ago

Fixed in https://github.com/Community-PIO-CH32V/framework-wch-noneos-sdk/commit/1ee8c787bcda01cf5130f878b01022437404c4f2. This added USB-PD support to the SPL.

I've also added the USBPD-SINK project into our examples, test-compiling them in the CI works fine (https://github.com/Community-PIO-CH32V/platform-ch32v/commit/693fb7a5381e7f0e75dcba9a7a141161b4655031).

Just update your platform and you should be fine (CLI -> pio pkg update -g -p ch32v)