Struct profirust::fdl::ParametersBuilder
source · pub struct ParametersBuilder(/* private fields */);
Expand description
Builder for the parameters of an FDL master
Implementations§
source§impl ParametersBuilder
impl ParametersBuilder
sourcepub fn new(address: u8, baudrate: Baudrate) -> Self
pub fn new(address: u8, baudrate: Baudrate) -> Self
Start building parameters for an FDL master with the given address
.
address
must be a valid PROFIBUS address (<= 125).baudrate
is the baudrate the is used for this PROFIBUS network.
sourcepub fn slot_bits(&mut self, slot_bits: u16) -> &mut Self
pub fn slot_bits(&mut self, slot_bits: u16) -> &mut Self
Configure non-standard TSL (slot time in bits)
The slot time must be larger than the maximum TSDR of all peripherals.
build_verified()
will check that this is the case.
The slot time must be creater than the default slot time:
Baudrate | Minimum Slot Time (in Bits) |
---|---|
<=187500 | 100 |
500000 | 200 |
1500000 | 300 |
3000000 | 400 |
6000000 | 600 |
12000000 | 1000 |
sourcepub fn highest_station_address(&mut self, hsa: u8) -> &mut Self
pub fn highest_station_address(&mut self, hsa: u8) -> &mut Self
Set the highest projected station address.
The HSA is used when scanning for other FDL masters who want to participate on the bus.
The HSA also affects what addresses will appear in the live list recorded by this master.
By default, all addresses are scanned (HSA = 126). This means all masters will be found but it also means that the time until a master can join the token ring is rather long. It is advisable to choose low addresses for all masters and then set the HSA accordingly to optimize recovery time after a master drops from the bus.
sourcepub fn token_rotation_bits(&mut self, ttr: u32) -> &mut Self
pub fn token_rotation_bits(&mut self, ttr: u32) -> &mut Self
Set the projected token rotation time (in bits).
The TTR is used to ensure each FDL master gets a chance to communicate with its peripherals in deterministic time.
It is important that the TTR is not too small as this unnecessarily slows down communication. Defaults to 32436.
sourcepub fn gap_wait_rotations(&mut self, gap_wait: u8) -> &mut Self
pub fn gap_wait_rotations(&mut self, gap_wait: u8) -> &mut Self
Set how many token rotations to wait before restarting the GAP scan.
The GAP scan is used to detect other FDL masters who want to communicate on the bus.
This factor is the wait time between scan cycles. A low value means stations are found very quickly but the tradeoff is a higher average cycle time.
sourcepub fn max_retry_limit(&mut self, max_retry_limit: u8) -> &mut Self
pub fn max_retry_limit(&mut self, max_retry_limit: u8) -> &mut Self
Set the maximum number of retries when communication with a peripheral fails.
After this amount of retries, the peripheral is considered offline and will need to be reconfigured once it appears again.
On a bus that is electrically sound, no retries should ever be necessary. When you have to increase the retry count to keep your bus working, it is recommended to check for electrical and/or noise problems.
Default value is 1, meaning a telegram is retried once when no response was received.
sourcepub fn min_tsdr(&mut self, min_tsdr_bits: u8) -> &mut Self
pub fn min_tsdr(&mut self, min_tsdr_bits: u8) -> &mut Self
Set the minimum response time that peripherals should adhere to.
This value can be increased when peripherals responding after 11 bits is too fast for the bus to settle.
sourcepub fn watchdog_timeout(&mut self, wdg: Duration) -> &mut Self
pub fn watchdog_timeout(&mut self, wdg: Duration) -> &mut Self
Set the watchdog timeout that peripherals should use to fail-safe after loosing communication.
sourcepub fn build(&self) -> Parameters
pub fn build(&self) -> Parameters
Build the parameters struct.
sourcepub fn build_verified(&self, dp_master: &DpMaster<'_>) -> Parameters
pub fn build_verified(&self, dp_master: &DpMaster<'_>) -> Parameters
Build the parameters struct and verify it against the given DP master.
This ensures that, for example, the selected TSL is greater than the max Tsdr of all peripherals currently tracked by the DP master.
Auto Trait Implementations§
impl Freeze for ParametersBuilder
impl RefUnwindSafe for ParametersBuilder
impl Send for ParametersBuilder
impl Sync for ParametersBuilder
impl Unpin for ParametersBuilder
impl UnwindSafe for ParametersBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.