For the Type-C voltage and current:
>> There are two difference understanding/requirements based on this:
1. Voltage and current is the voltage and current on power negotiation contract. The API and code example is:
const dpm_status_t *dpm_stat = dpm_get_info(0);
if(dpm_stat -> contract_exist == true)
voltage = dpm_stat->contract.max_volt / 100;
current = dpm_stat->contract.cur_pwr / 5;
2. If the voltage and current you are looking for is real time voltage and current. The API and code example is:
Voltage = pd_hal_measure_vbus(0);
Current = pd_hal_measure_vbus_cur(0);
For the Type-A voltage and current.
1. If the voltage and current is based on the charging protocol, the current value cannot be read out from QC charging protocol, for others, we can get it from the API:
Voltage: type_a_set_voltage(uint16_t volt_mV);
And you also could insert the code when the voltage or current setting have been changed, the hit of marco define is defined in @file battery_charging.h.
2. For the real time voltage and current.
You need add additional hardware to achieve that, for example, wired Type-A voltage to VBUS_C_MON pin for VBUS voltage monitor, you could read out the voltage from API pd_hal_measure_vbus(1) after switch the ADC internal correctly.
And current read back, the gl_type_a_status.cur_vbus_a is the one you could read back, but this is based on CY4532 hardware. If you changed hardware or design difference hardware, this define is faked.
thanks for the elaborate information
my application run on CYPD3175 - CCG3PA Power Adapter with Direct Feedback Control
1) the measurement of voltage and current of device to be charge are the same answer ?
2) maybe i miss understood QC type on TYPE A devices to be charged possible get info when they are plugin ?
3) Voltage: type_a_set_voltage(uint16_t volt_mV); this is set function not get ?
two additional questions :
i didn't find any API regardless to pin VBUS_C_MON_DISCHARGE is there any functionality ?
i didn't find any API regardless to pin VBUS_P_CTRL it is possible to control it mean change logic level with API from SDK ?