1
0
forked from me/IronOS

USB PD timeout added

This commit is contained in:
Varga Zsolt
2021-06-06 18:45:00 +02:00
parent 9ed1c1fc04
commit 81de60e1e4
36 changed files with 252 additions and 0 deletions

View File

@@ -21,6 +21,8 @@
#include "int_n.h"
#include <pd.h>
#include <stdbool.h>
#include "Settings.h"
bool PolicyEngine::pdNegotiationComplete;
int PolicyEngine::current_voltage_mv;
int PolicyEngine::_requested_voltage;
@@ -617,6 +619,18 @@ void PolicyEngine::PPSTimerCallback() {
}
}
bool PolicyEngine::NegotiationTimeoutReached() {
if (systemSettings.PDNegTimeout == 0){
return false;
}
if (xTaskGetTickCount() > (TICKS_SECOND/10 * systemSettings.PDNegTimeout)) {
return true;
}
return false;
}
EventBits_t PolicyEngine::pushMessage(union pd_msg *msg) {
if (PD_MSGTYPE_GET(msg) == PD_MSGTYPE_SOFT_RESET && PD_NUMOBJ_GET(msg) == 0) {
/* Clear MessageIDCounter */