1
0
forked from me/IronOS

Cache FUSB polls

This commit is contained in:
Ben V. Brown
2021-04-05 15:53:29 +10:00
parent 6b67137420
commit f12ed98991
2 changed files with 14 additions and 3 deletions

View File

@@ -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,7 +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;

View File

@@ -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;