Merge pull request #1215 from Ralim/pinecil-mod-detect
Pinecil mod detection
This commit is contained in:
@@ -147,7 +147,8 @@ def get_power_source_list() -> List[str]:
|
|||||||
return [
|
return [
|
||||||
"DC",
|
"DC",
|
||||||
"QC",
|
"QC",
|
||||||
"PD",
|
"PD W. VBus",
|
||||||
|
"PD No VBus",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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 */
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user