Cache FUSB polls
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "int_n.h"
|
||||
#include "policy_engine.h"
|
||||
bool FUSB302_present = false;
|
||||
bool FUSB302_probed = false;
|
||||
|
||||
void power_check() {
|
||||
#ifdef POW_PD
|
||||
@@ -28,8 +29,12 @@ void power_check() {
|
||||
}
|
||||
uint8_t usb_pd_detect() {
|
||||
#ifdef POW_PD
|
||||
FUSB302_present = fusb302_detect();
|
||||
|
||||
if (FUSB302_probed) {
|
||||
return FUSB302_present;
|
||||
} else {
|
||||
FUSB302_present = fusb302_detect();
|
||||
FUSB302_probed = true;
|
||||
}
|
||||
return FUSB302_present;
|
||||
#endif
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user