diff --git a/exercise-book/src/nrf52-usb-usb-events.md b/exercise-book/src/nrf52-usb-usb-events.md index 7d7634d..dbdba6f 100644 --- a/exercise-book/src/nrf52-usb-usb-events.md +++ b/exercise-book/src/nrf52-usb-usb-events.md @@ -4,7 +4,7 @@ The `USBD` peripheral on the nRF52840 contains a series of registers, called `EV ✅ Open the [`nrf52-code/usb-app/src/bin/usb-1.rs`][usb_1] file. -In this starter code the `USBD` peripheral is initialized in `init` and a task, named `main`, is bound to the interrupt signal called `USBD`. This task will be called every time a new `USBD` event needs to be handled. The `main` task uses `usbd::next_event()` to check all the event registers; if any event is set (i.e. that event just occurred) then the function returns the event, represented by the `Event` enum, wrapped in the `Some` variant. This `Event` is then passed to the `on_event` function for further processing. +In this starter code the `USBD` peripheral is initialized in `init` and a task, named `handle_usb_interrupt`, is bound to the interrupt signal called `USBD`. This task will be called every time a new `USBD` event needs to be handled. The `handle_usb_interrupt` task uses `usbd::next_event()` to check all the event registers; if any event is set (i.e. that event just occurred) then the function returns the event, represented by the `Event` enum, wrapped in the `Some` variant. This `Event` is then passed to the `on_event` function for further processing. ✅ Connect the USB cable to the port J3 then run the starter code. diff --git a/nrf52-code/usb-app-solutions/src/bin/usb-1.rs b/nrf52-code/usb-app-solutions/src/bin/usb-1.rs index 9e549df..1d20993 100644 --- a/nrf52-code/usb-app-solutions/src/bin/usb-1.rs +++ b/nrf52-code/usb-app-solutions/src/bin/usb-1.rs @@ -37,7 +37,7 @@ mod app { } #[task(binds = USBD, local = [usbd])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; while let Some(event) = usbd::next_event(usbd) { diff --git a/nrf52-code/usb-app-solutions/src/bin/usb-2.rs b/nrf52-code/usb-app-solutions/src/bin/usb-2.rs index 07a6b30..ab3845d 100644 --- a/nrf52-code/usb-app-solutions/src/bin/usb-2.rs +++ b/nrf52-code/usb-app-solutions/src/bin/usb-2.rs @@ -35,7 +35,7 @@ mod app { } #[task(binds = USBD, local = [usbd])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; while let Some(event) = usbd::next_event(usbd) { diff --git a/nrf52-code/usb-app-solutions/src/bin/usb-3.rs b/nrf52-code/usb-app-solutions/src/bin/usb-3.rs index 726c92c..22709c6 100644 --- a/nrf52-code/usb-app-solutions/src/bin/usb-3.rs +++ b/nrf52-code/usb-app-solutions/src/bin/usb-3.rs @@ -38,7 +38,7 @@ mod app { } #[task(binds = USBD, local = [usbd, ep0in])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; let ep0in = cx.local.ep0in; diff --git a/nrf52-code/usb-app-solutions/src/bin/usb-4.rs b/nrf52-code/usb-app-solutions/src/bin/usb-4.rs index 12b4911..3ae099e 100644 --- a/nrf52-code/usb-app-solutions/src/bin/usb-4.rs +++ b/nrf52-code/usb-app-solutions/src/bin/usb-4.rs @@ -43,7 +43,7 @@ mod app { } #[task(binds = USBD, local = [usbd, ep0in, state])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; let ep0in = cx.local.ep0in; let state = cx.local.state; diff --git a/nrf52-code/usb-app-solutions/src/bin/usb-5.rs b/nrf52-code/usb-app-solutions/src/bin/usb-5.rs index 996df45..7da1ac5 100644 --- a/nrf52-code/usb-app-solutions/src/bin/usb-5.rs +++ b/nrf52-code/usb-app-solutions/src/bin/usb-5.rs @@ -43,7 +43,7 @@ mod app { } #[task(binds = USBD, local = [usbd, ep0in, state])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; let ep0in = cx.local.ep0in; let state = cx.local.state; diff --git a/nrf52-code/usb-app/src/bin/usb-1.rs b/nrf52-code/usb-app/src/bin/usb-1.rs index 48ede92..1d6662a 100644 --- a/nrf52-code/usb-app/src/bin/usb-1.rs +++ b/nrf52-code/usb-app/src/bin/usb-1.rs @@ -37,7 +37,7 @@ mod app { } #[task(binds = USBD, local = [usbd])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; while let Some(event) = usbd::next_event(usbd) { diff --git a/nrf52-code/usb-app/src/bin/usb-2.rs b/nrf52-code/usb-app/src/bin/usb-2.rs index b7c937d..1b9d0a4 100644 --- a/nrf52-code/usb-app/src/bin/usb-2.rs +++ b/nrf52-code/usb-app/src/bin/usb-2.rs @@ -35,7 +35,7 @@ mod app { } #[task(binds = USBD, local = [usbd])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; while let Some(event) = usbd::next_event(usbd) { diff --git a/nrf52-code/usb-app/src/bin/usb-3.rs b/nrf52-code/usb-app/src/bin/usb-3.rs index c44f14b..fc11b0d 100644 --- a/nrf52-code/usb-app/src/bin/usb-3.rs +++ b/nrf52-code/usb-app/src/bin/usb-3.rs @@ -38,7 +38,7 @@ mod app { } #[task(binds = USBD, local = [usbd, ep0in])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; let ep0in = cx.local.ep0in; diff --git a/nrf52-code/usb-app/src/bin/usb-4.rs b/nrf52-code/usb-app/src/bin/usb-4.rs index 85a7c21..63c0415 100644 --- a/nrf52-code/usb-app/src/bin/usb-4.rs +++ b/nrf52-code/usb-app/src/bin/usb-4.rs @@ -44,7 +44,7 @@ mod app { } #[task(binds = USBD, local = [usbd, ep0in, state])] - fn main(cx: main::Context) { + fn handle_usb_interrupt(cx: handle_usb_interrupt::Context) { let usbd = cx.local.usbd; let ep0in = cx.local.ep0in; let state = cx.local.state;