Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename USB interrupt handler. #134

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercise-book/src/nrf52-usb-usb-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app-solutions/src/bin/usb-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app-solutions/src/bin/usb-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app-solutions/src/bin/usb-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app-solutions/src/bin/usb-4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app-solutions/src/bin/usb-5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app/src/bin/usb-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app/src/bin/usb-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app/src/bin/usb-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion nrf52-code/usb-app/src/bin/usb-4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down