fix idle::Resources::new

it assumed that all resources were "early" resources
This commit is contained in:
Jorge Aparicio 2017-10-02 14:49:40 +02:00
parent a190da3e3f
commit 2415a640af
2 changed files with 13 additions and 2 deletions

View file

@ -32,6 +32,11 @@ app! {
static PORT: u16;
},
idle: {
// Test that late resources can be used in idle
resources: [IP_ADDRESS],
}
tasks: {
SYS_TICK: {
priority: 1,

View file

@ -74,8 +74,14 @@ fn idle(
});
let _name = Ident::new(format!("_{}", name.as_ref()));
rexprs.push(quote! {
rexprs.push(if resource.expr.is_some() {
quote! {
#name: &mut #super_::#_name,
}
} else {
quote! {
#name: #super_::#_name.as_mut(),
}
});
} else {
rfields.push(quote! {