1
0
forked from me/IronOS

Update QC to allow 20V theoretically + allow query for power source

This commit is contained in:
Ben V. Brown
2020-11-01 14:43:49 +11:00
parent 3146343bbb
commit f5644a090f
5 changed files with 51 additions and 25 deletions

View File

@@ -68,6 +68,8 @@ bool getHallSensorFitted();
// If the sensor is single polarity (or polarity insensitive) just return 0..32768
int16_t getRawHallEffect();
//Returns true if power is from dumb "DC" input rather than "smart" QC or PD
bool getIsPoweredByDCIN();
#ifdef __cplusplus
}

View File

@@ -119,7 +119,7 @@ uint8_t getButtonB() {
}
void reboot() {
// TODO
//Spin for watchdog
for (;;) {
}
}
@@ -127,3 +127,4 @@ void reboot() {
void delay_ms(uint16_t count) {
delay_1ms(count);
}

View File

@@ -34,3 +34,16 @@ uint8_t usb_pd_detect() {
return false;
}
bool getIsPoweredByDCIN() {
//We return false until we are sure we are not using PD
if (PolicyEngine::setupCompleteOrTimedOut() == false) {
return false;
}
if (PolicyEngine::pdHasNegotiated()) {
return false; // We are using PD
}
if (hasQCNegotiated()) {
return false; // We are using QC
}
return true;
}