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 [ return [
"DC", "DC",
"QC", "QC",
"PD", "PD W. VBus",
"PD No VBus",
] ]

View File

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

View File

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

View File

@@ -734,17 +734,22 @@ void showDebugMenu(void) {
} else { } else {
// We are not powered via DC, so want to display the appropriate state for PD or QC // 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 POW_PD
if (USBPowerDelivery::fusbPresent()) { if (USBPowerDelivery::fusbPresent()) {
// We are PD capable // We are PD capable
if (USBPowerDelivery::negotiationComplete()) { if (USBPowerDelivery::negotiationComplete()) {
// We are powered via PD // We are powered via PD
poweredbyPD = true; poweredbyPD = true;
pdHasVBUSConnected = USBPowerDelivery::isVBUSConnected();
} }
} }
#endif #endif
if (poweredbyPD) { if (poweredbyPD) {
sourceNumber = 2; sourceNumber = 2;
if (!pdHasVBUSConnected) {
sourceNumber = 3;
}
} else { } else {
sourceNumber = 1; sourceNumber = 1;
} }