Skip to content

Commit

Permalink
Reset internal state on configuration (usb)
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualabs committed Dec 17, 2020
1 parent 3e0449b commit 356ae67
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kb-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ do_work(void)

events = usb_get_global_events();
if(events & USB_EVENT_CONFIG) {


/* Force state once the device is configured. */
g_state = KBS_IDLE;
ptr = 0;

/* Enable endpoints */
enabled = 1;
usb_setup_bulk_endpoint(EPIN);
Expand Down Expand Up @@ -284,7 +288,10 @@ PROCESS_THREAD(kb_usb_process, ev, data)

void kb_usb_init(void)
{
/* Initialize state. */
g_state = KBS_IDLE;
ptr = 0;

leds_off(LEDS_REDLEDS_GREEN);
process_start(&kb_usb_process, NULL);
}

0 comments on commit 356ae67

Please sign in to comment.