mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
rename LateResourceValues to LateResources
This commit is contained in:
parent
e78ca98c42
commit
79e2b7dc2e
4 changed files with 9 additions and 9 deletions
|
@ -55,7 +55,7 @@ app! {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The signature of `init` is now required to have a specific return type.
|
// The signature of `init` is now required to have a specific return type.
|
||||||
fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues {
|
fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResources {
|
||||||
// `init::Resources` does not contain `IP_ADDRESS`, since it is not yet
|
// `init::Resources` does not contain `IP_ADDRESS`, since it is not yet
|
||||||
// initialized.
|
// initialized.
|
||||||
//_r.IP_ADDRESS; // doesn't compile
|
//_r.IP_ADDRESS; // doesn't compile
|
||||||
|
@ -63,7 +63,7 @@ fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues
|
||||||
// ...obtain value for IP_ADDRESS from EEPROM/DHCP...
|
// ...obtain value for IP_ADDRESS from EEPROM/DHCP...
|
||||||
let ip_address = 0x7f000001;
|
let ip_address = 0x7f000001;
|
||||||
|
|
||||||
init::LateResourceValues {
|
init::LateResources {
|
||||||
// This struct will contain fields for all resources with omitted
|
// This struct will contain fields for all resources with omitted
|
||||||
// initializers.
|
// initializers.
|
||||||
IP_ADDRESS: ip_address,
|
IP_ADDRESS: ip_address,
|
||||||
|
|
|
@ -234,17 +234,17 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub struct _initLateResourceValues {
|
pub struct _initLateResources {
|
||||||
#(#fields)*
|
#(#fields)*
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mod_items.push(quote! {
|
mod_items.push(quote! {
|
||||||
pub use ::_initLateResourceValues as LateResourceValues;
|
pub use ::_initLateResources as LateResources;
|
||||||
});
|
});
|
||||||
|
|
||||||
// `init` must return the initialized resources
|
// `init` must return the initialized resources
|
||||||
ret = Some(quote!( -> ::init::LateResourceValues));
|
ret = Some(quote!( -> ::init::LateResources));
|
||||||
}
|
}
|
||||||
|
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
//! // The signature of `init` is now required to have a specific return type.
|
//! // The signature of `init` is now required to have a specific return type.
|
||||||
//! fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResourceValues {
|
//! fn init(_p: init::Peripherals, _r: init::Resources) -> init::LateResources {
|
||||||
//! // `init::Resources` does not contain `IP_ADDRESS`, since it is not yet
|
//! // `init::Resources` does not contain `IP_ADDRESS`, since it is not yet
|
||||||
//! // initialized.
|
//! // initialized.
|
||||||
//! //_r.IP_ADDRESS; // doesn't compile
|
//! //_r.IP_ADDRESS; // doesn't compile
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
//! // ...obtain value for IP_ADDRESS from EEPROM/DHCP...
|
//! // ...obtain value for IP_ADDRESS from EEPROM/DHCP...
|
||||||
//! let ip_address = 0x7f000001;
|
//! let ip_address = 0x7f000001;
|
||||||
//!
|
//!
|
||||||
//! init::LateResourceValues {
|
//! init::LateResources {
|
||||||
//! // This struct will contain fields for all resources with omitted
|
//! // This struct will contain fields for all resources with omitted
|
||||||
//! // initializers.
|
//! // initializers.
|
||||||
//! IP_ADDRESS: ip_address,
|
//! IP_ADDRESS: ip_address,
|
||||||
|
|
|
@ -30,12 +30,12 @@ app! {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResourceValues {
|
fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResources {
|
||||||
// Try to use a resource that's not yet initialized:
|
// Try to use a resource that's not yet initialized:
|
||||||
r.LATE;
|
r.LATE;
|
||||||
//~^ error: no field `LATE`
|
//~^ error: no field `LATE`
|
||||||
|
|
||||||
init::LateResourceValues {
|
init::LateResources {
|
||||||
LATE: 0,
|
LATE: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue