From 0126db2f9316eaed256d2d8e1ec698226681b9cd 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: Fri, 5 Dec 2025 15:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Power_Pico/BSP/PD/fusb302_dev.c | 2 +- Power_Pico/BSP/PD/fusb302_dev.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Power_Pico/BSP/PD/fusb302_dev.c b/Power_Pico/BSP/PD/fusb302_dev.c index e64f7d2..0cfc8b0 100644 --- a/Power_Pico/BSP/PD/fusb302_dev.c +++ b/Power_Pico/BSP/PD/fusb302_dev.c @@ -171,7 +171,7 @@ bool fusb302_timer(void) bool is_power_ready(void) { return app_pd.status_power == STATUS_POWER_TYP; } bool is_PPS_ready(void) { return app_pd.status_power == STATUS_POWER_PPS; } - +void send_power_request(void) { app_pd.send_request = 1; } uint8_t fusb302_dev_init(void) { fusb302_dev.i2c_address = 0x22<<1; // FUSB302 I2C address diff --git a/Power_Pico/BSP/PD/fusb302_dev.h b/Power_Pico/BSP/PD/fusb302_dev.h index 24c4383..026c418 100644 --- a/Power_Pico/BSP/PD/fusb302_dev.h +++ b/Power_Pico/BSP/PD/fusb302_dev.h @@ -38,10 +38,15 @@ enum { }; typedef uint8_t status_power_t; +enum { + PD_SYS_STATE_INIT = 0, + PD_SYS_STATE_READY, + PD_SYS_STATE_ERROR +}; +typedef uint8_t PD_user_state_t; + typedef struct { - uint8_t state; - //uint8_t pd_ic_initial; PD_protocol_t protocol; // Power ready power @@ -77,6 +82,9 @@ extern App_PD_t app_pd; uint8_t fusb302_dev_init(void); void handle_FUSB302_event(FUSB302_event_t events); +bool is_power_ready(void); +bool is_PPS_ready(void); +void send_power_request(void); #ifdef __cplusplus }