mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
PPS 测试OK,动态调压OK
This commit is contained in:
@@ -15,12 +15,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#define PD_POLLING 100
|
#define PD_POLLING 100
|
||||||
#define TYPEC_SINK_WAIT_CAP 1500
|
#define TYPEC_SINK_WAIT_CAP 350
|
||||||
#define REQUEST_TO_PS_READY 580
|
#define REQUEST_TO_PS_READY 580
|
||||||
#define PPS_REQUEST 5000
|
#define PPS_REQUEST 5000
|
||||||
|
|
||||||
FUSB302_dev_t fusb302_dev;
|
FUSB302_dev_t fusb302_dev;
|
||||||
PD_protocol_t pd_protocol;
|
|
||||||
App_PD_t app_pd;
|
App_PD_t app_pd;
|
||||||
|
|
||||||
void fusb302_i2c_read(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data, uint8_t count)
|
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;
|
fusb302_dev.delay_ms = HAL_Delay;
|
||||||
#endif
|
#endif
|
||||||
if (FUSB302_init(&fusb302_dev) == FUSB302_SUCCESS && FUSB302_get_ID(&fusb302_dev, 0, 0) == FUSB302_SUCCESS) {
|
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 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t fusb302_run(void) {
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ typedef struct
|
|||||||
}App_PD_t;
|
}App_PD_t;
|
||||||
|
|
||||||
extern FUSB302_dev_t fusb302_dev;
|
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_dev_init(void);
|
||||||
uint8_t fusb302_test(void);
|
void handle_FUSB302_event(FUSB302_event_t events);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ void PDUFPTask(void *argument)
|
|||||||
// FUSB init
|
// FUSB init
|
||||||
fusb302_dev_init();
|
fusb302_dev_init();
|
||||||
// set
|
// set
|
||||||
PD_protocol_set_power_option(&pd_protocol, PD_POWER_OPTION_MAX_VOLTAGE);
|
PD_protocol_set_power_option(&app_pd.protocol, PD_POWER_OPTION_MAX_9V);
|
||||||
PD_protocol_set_PPS(&pd_protocol, PD_V(8.4), PD_A(2.0), false);
|
PD_protocol_set_PPS(&app_pd.protocol, PPS_V(6.0), PPS_A(2.0), false);
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
if (fusb302_timer() || HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_4) == GPIO_PIN_RESET) {
|
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);
|
handle_FUSB302_event(FUSB302_events);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
osDelay(1);
|
||||||
osDelay(50);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user