From 868efce68d224070f6d77f86522c5fb08a9dce77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=90=83=E6=B2=B9=E7=82=B8=E9=B8=A1?= <1425962791@qq.com> Date: Sun, 26 Oct 2025 15:20:04 +0800 Subject: [PATCH] =?UTF-8?q?PPS=20=E6=B5=8B=E8=AF=95OK=EF=BC=8C=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E8=B0=83=E5=8E=8BOK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Power_Pico/BSP/PD/fusb302_dev.c | 10 ++-------- Power_Pico/BSP/PD/fusb302_dev.h | 4 ++-- Power_Pico/User/Tasks/Src/user_PDUFPTask.c | 7 +++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Power_Pico/BSP/PD/fusb302_dev.c b/Power_Pico/BSP/PD/fusb302_dev.c index de52824..e64f7d2 100644 --- a/Power_Pico/BSP/PD/fusb302_dev.c +++ b/Power_Pico/BSP/PD/fusb302_dev.c @@ -15,12 +15,11 @@ #define PD_POLLING 100 -#define TYPEC_SINK_WAIT_CAP 1500 +#define TYPEC_SINK_WAIT_CAP 350 #define REQUEST_TO_PS_READY 580 #define PPS_REQUEST 5000 FUSB302_dev_t fusb302_dev; -PD_protocol_t pd_protocol; App_PD_t app_pd; void fusb302_i2c_read(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data, uint8_t count) @@ -184,13 +183,8 @@ uint8_t fusb302_dev_init(void) { fusb302_dev.delay_ms = HAL_Delay; #endif if (FUSB302_init(&fusb302_dev) == FUSB302_SUCCESS && FUSB302_get_ID(&fusb302_dev, 0, 0) == FUSB302_SUCCESS) { - PD_protocol_init(&pd_protocol); + PD_protocol_init(&app_pd.protocol); return 0; } return 1; } - -uint8_t fusb302_run(void) { - - return 0; -} diff --git a/Power_Pico/BSP/PD/fusb302_dev.h b/Power_Pico/BSP/PD/fusb302_dev.h index 8bf8ede..24c4383 100644 --- a/Power_Pico/BSP/PD/fusb302_dev.h +++ b/Power_Pico/BSP/PD/fusb302_dev.h @@ -73,10 +73,10 @@ typedef struct }App_PD_t; extern FUSB302_dev_t fusb302_dev; -extern PD_protocol_t pd_protocol; +extern App_PD_t app_pd; uint8_t fusb302_dev_init(void); -uint8_t fusb302_test(void); +void handle_FUSB302_event(FUSB302_event_t events); #ifdef __cplusplus } diff --git a/Power_Pico/User/Tasks/Src/user_PDUFPTask.c b/Power_Pico/User/Tasks/Src/user_PDUFPTask.c index 0b75737..0bffa87 100644 --- a/Power_Pico/User/Tasks/Src/user_PDUFPTask.c +++ b/Power_Pico/User/Tasks/Src/user_PDUFPTask.c @@ -22,8 +22,8 @@ void PDUFPTask(void *argument) // FUSB init fusb302_dev_init(); // set - PD_protocol_set_power_option(&pd_protocol, PD_POWER_OPTION_MAX_VOLTAGE); - PD_protocol_set_PPS(&pd_protocol, PD_V(8.4), PD_A(2.0), false); + PD_protocol_set_power_option(&app_pd.protocol, PD_POWER_OPTION_MAX_9V); + PD_protocol_set_PPS(&app_pd.protocol, PPS_V(6.0), PPS_A(2.0), false); while(1) { if (fusb302_timer() || HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_4) == GPIO_PIN_RESET) { @@ -33,7 +33,6 @@ void PDUFPTask(void *argument) handle_FUSB302_event(FUSB302_events); } } - - osDelay(50); + osDelay(1); } }