fork
This commit is contained in:
40
source/Core/BSP/Magic/Power.cpp
Normal file
40
source/Core/BSP/Magic/Power.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "BSP.h"
|
||||
#include "BSP_Power.h"
|
||||
#include "Pins.h"
|
||||
#include "QC3.h"
|
||||
#include "Settings.h"
|
||||
#include "USBPD.h"
|
||||
#include "configuration.h"
|
||||
|
||||
void power_check() {
|
||||
#if POW_PD
|
||||
// Cant start QC until either PD works or fails
|
||||
if (!USBPowerDelivery::negotiationComplete()) {
|
||||
return;
|
||||
}
|
||||
if (USBPowerDelivery::negotiationHasWorked()) {
|
||||
return; // We are using PD
|
||||
}
|
||||
#endif
|
||||
#ifdef POW_QC
|
||||
QC_resync();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool getIsPoweredByDCIN() {
|
||||
#if POW_PD
|
||||
if (!USBPowerDelivery::negotiationComplete()) {
|
||||
return false; // We are assuming not dc while negotiating
|
||||
}
|
||||
if (USBPowerDelivery::negotiationHasWorked()) {
|
||||
return false; // We are using PD
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef POW_QC
|
||||
if (hasQCNegotiated()) {
|
||||
return false; // We are using QC
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user