parent
4fb8a3fdc6
commit
1a6767a76b
|
@ -20,7 +20,10 @@ void loop() {
|
|||
|
||||
if(usbpd_sink_get_ready())
|
||||
{
|
||||
usbpd_sink_set_request_fixed_voltage(setVoltage);
|
||||
if(usbpd_sink_set_request_fixed_voltage(setVoltage) == false)
|
||||
{
|
||||
Serial.printf("unsupported voltage\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
// button, myIndex++
|
||||
|
|
|
@ -38,7 +38,7 @@ void usbpd_sink_clear_ready(void)
|
|||
pdControl_g.cc_USBPD_READY = 0;
|
||||
}
|
||||
|
||||
void usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage)
|
||||
bool usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage)
|
||||
{
|
||||
uint16_t targetVoltage;
|
||||
switch (requestVoltage)
|
||||
|
@ -73,11 +73,12 @@ void usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage)
|
|||
if(pdControl_g.cc_FixedSourceCap[i].Voltage == targetVoltage)
|
||||
{
|
||||
pdControl_g.cc_SetPDONum = i+1;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
pdControl_g.cc_SetPDONum = (pdControl_g.cc_SourcePDONum - pdControl_g.cc_SourcePPSNum);
|
||||
|
||||
// unsupported voltage
|
||||
return false;
|
||||
}
|
||||
|
||||
void timer3_init(uint16_t arr, uint16_t psc)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
extern "C" {
|
||||
#endif /* end of __cplusplus */
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "usbpd_def.h"
|
||||
|
||||
// Register Bit Definition
|
||||
|
@ -201,7 +202,7 @@ void usbpd_sink_process(void);
|
|||
uint8_t usbpd_sink_get_ready(void);
|
||||
void usbpd_sink_clear_ready(void);
|
||||
|
||||
void usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage);
|
||||
bool usbpd_sink_set_request_fixed_voltage(Request_voltage_t requestVoltage);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in New Issue