diff --git a/src/command.c b/src/command.c index e817197..c13fa9f 100644 --- a/src/command.c +++ b/src/command.c @@ -234,7 +234,7 @@ static bool cmd_target_power(target *t, int argc, const char **argv) (void)t; if (argc == 1) gdb_outf("Target Power: %s\n", - !platform_target_get_power() ? "enabled" : "disabled"); + platform_target_get_power() ? "enabled" : "disabled"); else platform_target_set_power(!strncmp(argv[1], "enable", strlen(argv[1]))); return true; diff --git a/src/platforms/native/platform.c b/src/platforms/native/platform.c index 2789d8c..5e5c78c 100644 --- a/src/platforms/native/platform.c +++ b/src/platforms/native/platform.c @@ -158,12 +158,15 @@ void platform_srst_set_val(bool assert) gpio_set_val(SRST_PORT, SRST_PIN, !assert); } } -bool platform_target_get_power(void) { + +bool platform_target_get_power(void) +{ if (platform_hwversion() > 0) { - return gpio_get(PWR_BR_PORT, PWR_BR_PIN); + return !gpio_get(PWR_BR_PORT, PWR_BR_PIN); } - return 1; /* 1 = Unpowered */ + return 0; } + void platform_target_set_power(bool power) { if (platform_hwversion() > 0) {