1
0
forked from me/IronOS

Merge pull request #1215 from Ralim/pinecil-mod-detect

Pinecil mod detection
This commit is contained in:
Ben V. Brown
2022-02-06 16:04:50 +11:00
committed by GitHub
4 changed files with 14 additions and 6 deletions

View File

@@ -147,7 +147,8 @@ def get_power_source_list() -> List[str]:
return [
"DC",
"QC",
"PD",
"PD W. VBus",
"PD No VBus",
]

View File

@@ -67,6 +67,8 @@ bool USBPowerDelivery::fusbPresent() {
return detectionState == 1;
}
bool USBPowerDelivery::isVBUSConnected() { return fusb.isVBUSConnected(); }
bool pdbs_dpm_evaluate_capability(const pd_msg *capabilities, pd_msg *request) {
/* Get the number of PDOs */

View File

@@ -16,9 +16,9 @@ public:
static void PPSTimerCallback(); // PPS Timer
static void IRQOccured(); // Thread callback that an irq occured
static void step(); // Iterate the step machine
static bool negotiationHasWorked(); //
static uint8_t getStateNumber(); //
static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract)
static uint8_t getStateNumber(); // Debugging - Get the internal state number
static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302
private:
//
static int detectionState;

View File

@@ -733,18 +733,23 @@ void showDebugMenu(void) {
sourceNumber = 0;
} else {
// We are not powered via DC, so want to display the appropriate state for PD or QC
bool poweredbyPD = false;
bool poweredbyPD = false;
bool pdHasVBUSConnected = true;
#if POW_PD
if (USBPowerDelivery::fusbPresent()) {
// We are PD capable
if (USBPowerDelivery::negotiationComplete()) {
// We are powered via PD
poweredbyPD = true;
poweredbyPD = true;
pdHasVBUSConnected = USBPowerDelivery::isVBUSConnected();
}
}
#endif
if (poweredbyPD) {
sourceNumber = 2;
if (!pdHasVBUSConnected) {
sourceNumber = 3;
}
} else {
sourceNumber = 1;
}