Testing and Validation:
bool determine_correct_polarity() {
LowPowerRequestConfig test_config = {
.enable = true,
.override = LowPowerRequestOutputOverride::NOT_FORCED
};
test_config.polarity = LowPowerRequestPinPolarity::LOW_TRUE_POLARITY;
configure_low_power_request(&test_config);
if (test_external_circuit_response_to_low_active()) {
log_info("External circuit responds to active-low LPR signaling");
return true;
}
test_config.polarity = LowPowerRequestPinPolarity::HIGH_TRUE_POLARITY;
configure_low_power_request(&test_config);
if (test_external_circuit_response_to_high_active()) {
log_info("External circuit responds to active-high LPR signaling");
return true;
}
log_error("External circuit does not respond to either polarity");
return false;
}