From 9dbf745649cf09647c2d8261170bb716ed459961 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Wed, 17 Mar 2021 08:56:46 +0200 Subject: [PATCH] regulator 5V: fix battery/usb source swap --- bdk/power/regulator_5v.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bdk/power/regulator_5v.c b/bdk/power/regulator_5v.c index 31d32f6..64fd7d7 100644 --- a/bdk/power/regulator_5v.c +++ b/bdk/power/regulator_5v.c @@ -81,7 +81,13 @@ bool regulator_5v_get_dev_enabled(u8 dev) void regulator_5v_batt_src_enable(bool enable) { if (enable && !batt_src) + { gpio_write(GPIO_PORT_A, GPIO_PIN_5, GPIO_HIGH); + batt_src = true; + } else if (!enable && batt_src) + { gpio_write(GPIO_PORT_A, GPIO_PIN_5, GPIO_LOW); + batt_src = false; + } }