mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 14:53:03 +00:00
Move configure out of run
This commit is contained in:
parent
836e8add1b
commit
5d0ed24640
@ -284,8 +284,7 @@ impl<'a> Control<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Run a control loop for this context, ensuring that reaattach is handled.
|
/// Run a control loop for this context, ensuring that reaattach is handled.
|
||||||
pub async fn run<F: Fn(&Status)>(&self, config: &Config<'_>, reattach: F) -> Result<(), Error> {
|
pub async fn run<F: Fn(&Status)>(&self, reattach: F) -> Result<(), Error> {
|
||||||
self.configure(config).await?;
|
|
||||||
let status = self.wait_attached().await?;
|
let status = self.wait_attached().await?;
|
||||||
let mut fd = self.control.open_raw_socket().await;
|
let mut fd = self.control.open_raw_socket().await;
|
||||||
reattach(&status);
|
reattach(&status);
|
||||||
|
@ -56,9 +56,10 @@ async fn control_task(
|
|||||||
config: context::Config<'static>,
|
config: context::Config<'static>,
|
||||||
stack: &'static Stack<embassy_net_nrf91::NetDriver<'static>>,
|
stack: &'static Stack<embassy_net_nrf91::NetDriver<'static>>,
|
||||||
) {
|
) {
|
||||||
|
unwrap!(control.configure(&config).await);
|
||||||
unwrap!(
|
unwrap!(
|
||||||
control
|
control
|
||||||
.run(&config, |status| {
|
.run(|status| {
|
||||||
stack.set_config_v4(status_to_config(status));
|
stack.set_config_v4(status_to_config(status));
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
Loading…
Reference in New Issue
Block a user