Macros no_enable_periph_rst_fn and similar
|
macro_rules! no_enable_rst_periph_fn { |
|
($fn_name:ident, $p_type:ty, $field_name:ident) => { |
|
/// Gets the specified peripheral if not already taken elsewhere. Otherwise, |
|
/// returns [`BorrowMutError`]. |
|
pub fn $fn_name(&'a self) -> Result<PeripheralHandle<$p_type>, BorrowMutError> { |
|
PeripheralHandle::new(&self.$field_name) |
|
} |
|
}; |
|
} |
|
no_enable_rst_periph_fn!(timer_0, Clock<TMR>, timer_0); |
|
no_enable_rst_periph_fn!(timer_1, Clock<TMR1>, timer_1); |
|
no_enable_rst_periph_fn!(timer_2, Clock<TMR2>, timer_2); |
|
no_enable_rst_periph_fn!(timer_3, Clock<TMR3>, timer_3); |
|
|
|
no_enable_rst_periph_fn_no_handle!(gpio0, Gpio0, gpio0); |
|
no_enable_rst_periph_fn_no_handle!(gpio1, Gpio1, gpio1); |
|
no_enable_rst_periph_fn_no_handle!(gpio2, Gpio2, gpio2); |
currently generate methods of the type &'a self -> &Periph<'a, 'a, ...>, where PeripheralManager stores all registers with the same lifetime 'a
|
pub struct PeripheralManager<'a> { |
We need to verify that this is the correct behavior.
Macros
no_enable_periph_rst_fnand similarmax78000-hal/hal/src/peripherals.rs
Lines 474 to 482 in 4d1d71d
max78000-hal/hal/src/peripherals.rs
Lines 532 to 539 in 4d1d71d
currently generate methods of the type
&'a self -> &Periph<'a, 'a, ...>, wherePeripheralManagerstores all registers with the same lifetime'amax78000-hal/hal/src/peripherals.rs
Line 509 in 4d1d71d
We need to verify that this is the correct behavior.