mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2024-10-31 22:28:49 +00:00
run cargo fmt
This commit is contained in:
parent
83f92ab02b
commit
cc0d844024
3 changed files with 10 additions and 9 deletions
|
@ -20,9 +20,7 @@ const APP: () = {
|
||||||
|
|
||||||
usbd::init(board.power, &board.usbd);
|
usbd::init(board.power, &board.usbd);
|
||||||
|
|
||||||
init::LateResources {
|
init::LateResources { usbd: board.usbd }
|
||||||
usbd: board.usbd,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task(binds = USBD, resources = [usbd])]
|
#[task(binds = USBD, resources = [usbd])]
|
||||||
|
@ -79,7 +77,7 @@ fn on_event(usbd: &USBD, event: Event) {
|
||||||
// On Mac OS you'll get this request before the GET_DESCRIPTOR request so we
|
// On Mac OS you'll get this request before the GET_DESCRIPTOR request so we
|
||||||
// need to catch it here. We'll properly handle this request later
|
// need to catch it here. We'll properly handle this request later
|
||||||
// but for now it's OK to do nothing.
|
// but for now it's OK to do nothing.
|
||||||
},
|
}
|
||||||
_ => unreachable!(), // we don't handle any other Requests
|
_ => unreachable!(), // we don't handle any other Requests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,8 +86,7 @@ fn on_event(usbd: &USBD, ep0in: &mut Ep0In, event: Event) {
|
||||||
idVendor: consts::VID,
|
idVendor: consts::VID,
|
||||||
};
|
};
|
||||||
let desc_bytes = desc.bytes();
|
let desc_bytes = desc.bytes();
|
||||||
let resp =
|
let resp = &desc_bytes[..core::cmp::min(desc_bytes.len(), usize::from(length))];
|
||||||
&desc_bytes[..core::cmp::min(desc_bytes.len(), usize::from(length))];
|
|
||||||
ep0in.start(&resp, usbd);
|
ep0in.start(&resp, usbd);
|
||||||
}
|
}
|
||||||
Request::SetAddress { .. } => {
|
Request::SetAddress { .. } => {
|
||||||
|
@ -96,7 +95,9 @@ fn on_event(usbd: &USBD, ep0in: &mut Ep0In, event: Event) {
|
||||||
// but for now it's OK to do nothing.
|
// but for now it's OK to do nothing.
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("unknown request (goal achieved if GET_DESCRIPTOR Device was handled)");
|
log::error!(
|
||||||
|
"unknown request (goal achieved if GET_DESCRIPTOR Device was handled)"
|
||||||
|
);
|
||||||
dk::exit()
|
dk::exit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,11 @@ fn on_event(usbd: &USBD, ep0in: &mut Ep0In, event: Event) {
|
||||||
// On Mac OS you'll get this request before the GET_DESCRIPTOR request so we
|
// On Mac OS you'll get this request before the GET_DESCRIPTOR request so we
|
||||||
// need to catch it here. We'll properly handle this request later
|
// need to catch it here. We'll properly handle this request later
|
||||||
// but for now it's OK to do nothing.
|
// but for now it's OK to do nothing.
|
||||||
},
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("unknown request (goal achieved if GET_DESCRIPTOR Device was handled)");
|
log::error!(
|
||||||
|
"unknown request (goal achieved if GET_DESCRIPTOR Device was handled)"
|
||||||
|
);
|
||||||
dk::exit()
|
dk::exit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue