Skip to content

Commit

Permalink
native/platform: flash error led using morse subsystem to indicate no…
Browse files Browse the repository at this point in the history
… USB host present.
  • Loading branch information
krogozinski committed Sep 2, 2023
1 parent 78b327d commit 86c7233
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/platforms/native/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

static void adc_init(void);
static void setup_vbus_irq(void);
static void wait_for_usb_host_config_request(void);

/* This is defined by the linker script */
extern char vector_table;
Expand Down Expand Up @@ -240,6 +241,7 @@ void platform_init(void)
aux_serial_init();

setup_vbus_irq();
wait_for_usb_host_config_request();
}

void platform_nrst_set_val(bool assert)
Expand Down Expand Up @@ -485,3 +487,16 @@ static void setup_vbus_irq(void)

exti15_10_isr();
}

static void wait_for_usb_host_config_request(void)
{
if (usb_get_config() == 0) {
morse("NO USB HOST.", true);
}

/* Wait for completion of USB serial or DFU configuration */
while (usb_get_config() == 0) {
}

morse(NULL, false);
}

0 comments on commit 86c7233

Please sign in to comment.