mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +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.
|
||||
pub async fn run<F: Fn(&Status)>(&self, config: &Config<'_>, reattach: F) -> Result<(), Error> {
|
||||
self.configure(config).await?;
|
||||
pub async fn run<F: Fn(&Status)>(&self, reattach: F) -> Result<(), Error> {
|
||||
let status = self.wait_attached().await?;
|
||||
let mut fd = self.control.open_raw_socket().await;
|
||||
reattach(&status);
|
||||
|
@ -56,9 +56,10 @@ async fn control_task(
|
||||
config: context::Config<'static>,
|
||||
stack: &'static Stack<embassy_net_nrf91::NetDriver<'static>>,
|
||||
) {
|
||||
unwrap!(control.configure(&config).await);
|
||||
unwrap!(
|
||||
control
|
||||
.run(&config, |status| {
|
||||
.run(|status| {
|
||||
stack.set_config_v4(status_to_config(status));
|
||||
})
|
||||
.await
|
||||
|
Loading…
Reference in New Issue
Block a user