diff --git a/boot/zephyr/include/io/io.h b/boot/zephyr/include/io/io.h index 332eefbd..145530bb 100644 --- a/boot/zephyr/include/io/io.h +++ b/boot/zephyr/include/io/io.h @@ -34,6 +34,11 @@ extern "C" { */ void io_led_init(void); +/* + * Sets value of the configured LED. + */ +void io_led_set(int value); + /* * Checks if GPIO is set in the required way to remain in serial recovery mode * diff --git a/boot/zephyr/io.c b/boot/zephyr/io.c index e6d54d3c..309f1ab9 100644 --- a/boot/zephyr/io.c +++ b/boot/zephyr/io.c @@ -91,6 +91,11 @@ void io_led_init(void) gpio_pin_configure_dt(&led0, GPIO_OUTPUT); gpio_pin_set_dt(&led0, 0); } + +void io_led_set(int value) +{ + gpio_pin_set_dt(&led0, value); +} #endif /* CONFIG_MCUBOOT_INDICATION_LED */ #if defined(CONFIG_BOOT_SERIAL_ENTRANCE_GPIO) || defined(CONFIG_BOOT_USB_DFU_GPIO) || \ diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c index 91c9b9b9..c6a0f74a 100644 --- a/boot/zephyr/main.c +++ b/boot/zephyr/main.c @@ -377,7 +377,7 @@ static void boot_serial_enter() int rc; #ifdef CONFIG_MCUBOOT_INDICATION_LED - gpio_pin_set_dt(&led0, 1); + io_led_set(1); #endif mcuboot_status_change(MCUBOOT_STATUS_SERIAL_DFU_ENTERED); @@ -434,7 +434,7 @@ int main(void) #if defined(CONFIG_BOOT_USB_DFU_GPIO) if (io_detect_pin()) { #ifdef CONFIG_MCUBOOT_INDICATION_LED - gpio_pin_set_dt(&led0, 1); + io_led_set(1); #endif mcuboot_status_change(MCUBOOT_STATUS_USB_DFU_ENTERED); @@ -475,7 +475,7 @@ int main(void) uint32_t start = k_uptime_get_32(); #ifdef CONFIG_MCUBOOT_INDICATION_LED - gpio_pin_set_dt(&led0, 1); + io_led_set(1); #endif #endif @@ -499,7 +499,7 @@ int main(void) boot_serial_check_start(&boot_funcs,timeout_in_ms); #ifdef CONFIG_MCUBOOT_INDICATION_LED - gpio_pin_set_dt(&led0, 0); + io_led_set(0); #endif #endif