gpio: update config to use only one gpio for ATX PSU
All checks were successful
Build ESP32 BMC Firmware / build (push) Successful in 59s
All checks were successful
Build ESP32 BMC Firmware / build (push) Successful in 59s
This commit is contained in:
@@ -218,61 +218,29 @@ esp_err_t gpio_toggle(gpio_num_t pin) {
|
||||
|
||||
esp_err_t gpio_power_on(void) {
|
||||
ESP_LOGI(TAG, "Power ON sequence initiated");
|
||||
|
||||
// Pulse the POWER_ON signal
|
||||
gpio_write(BMC_GPIO_POWER_ON, 1);
|
||||
vTaskDelay(pdMS_TO_TICKS(BMC_POWER_ON_PULSE_MS));
|
||||
gpio_write(BMC_GPIO_POWER_ON, 0);
|
||||
|
||||
// Wait for power good signal
|
||||
vTaskDelay(pdMS_TO_TICKS(BMC_POWER_GOOD_DELAY_MS));
|
||||
|
||||
if (gpio_is_power_good()) {
|
||||
ESP_LOGI(TAG, "Power ON successful - power good detected");
|
||||
gpio_set_status_led(true);
|
||||
return ESP_OK;
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Power ON completed - no power good signal");
|
||||
return ESP_OK; // Still return OK, just no confirmation
|
||||
}
|
||||
gpio_write(BMC_GPIO_POWER, 1);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t gpio_power_off(void) {
|
||||
ESP_LOGI(TAG, "Power OFF sequence initiated");
|
||||
|
||||
// Pulse the POWER_OFF signal
|
||||
gpio_write(BMC_GPIO_POWER_OFF, 1);
|
||||
vTaskDelay(pdMS_TO_TICKS(BMC_POWER_OFF_PULSE_MS));
|
||||
gpio_write(BMC_GPIO_POWER_OFF, 0);
|
||||
|
||||
gpio_set_status_led(false);
|
||||
ESP_LOGI(TAG, "Power OFF completed");
|
||||
|
||||
gpio_write(BMC_GPIO_POWER, 0);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t gpio_reset(void) {
|
||||
ESP_LOGI(TAG, "Reset sequence initiated");
|
||||
|
||||
// Pulse the RESET signal (active-low)
|
||||
gpio_write(BMC_GPIO_RESET, 0); // Assert reset (active-low)
|
||||
// Pulse the POWER signal
|
||||
gpio_write(BMC_GPIO_POWER, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(BMC_RESET_PULSE_MS));
|
||||
gpio_write(BMC_GPIO_RESET, 1); // De-assert reset
|
||||
gpio_write(BMC_GPIO_POWER, 1);
|
||||
|
||||
ESP_LOGI(TAG, "Reset completed");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
bool gpio_is_power_good(void) {
|
||||
int idx = gpio_find_index(BMC_GPIO_PWR_GOOD);
|
||||
if (idx < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int level = gpio_get_level(BMC_GPIO_PWR_GOOD);
|
||||
bool gpio_power_status(void) {
|
||||
int level = gpio_get_level(BMC_GPIO_POWER);
|
||||
return (level == 1);
|
||||
}
|
||||
|
||||
esp_err_t gpio_set_status_led(bool on) {
|
||||
return gpio_write(BMC_GPIO_STATUS_LED, on ? 1 : 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user