Struct SubDevicePdi

Source
pub struct SubDevicePdi<'group, const MAX_PDI: usize> { /* private fields */ }
Expand description

Process Data Image (PDI) segments for a given SubDevice.

Used in conjunction with SubDeviceRef.

Methods from Deref<Target = SubDevice>§

Source

pub fn name(&self) -> &str

Get the SubDevice’s human readable short name.

To get a longer, more descriptive name, use SubDevice::description.

Source

pub async fn description( &self, maindevice: &MainDevice<'_>, ) -> Result<Option<String<128>>, Error>

Get the long name of the SubDevice.

Using the EK1100 as an example, SubDevice::name will return "EK1100" whereas this method will return "EK1100 EtherCAT-Koppler (2A E-Bus)".

In the case that a SubDevice does not have a description, this method will return Ok(None).

Source

pub async fn eeprom_size( &self, maindevice: &MainDevice<'_>, ) -> Result<usize, Error>

Get the SubDevice’s EEPROM size in bytes.

Source

pub async fn eeprom_read_raw( &self, maindevice: &MainDevice<'_>, start_word: u16, buf: &mut [u8], ) -> Result<usize, Error>

Read raw bytes from the SubDevice’s EEPROM, starting at the given word address.

The given start address is in words NOT bytes. To address the EEPROM using a byte address, divide the given byte address by two.

To read individual typed values including fixed size chunks of [u8; N], see eeprom_read.

Source

pub async fn eeprom_read<T>( &self, maindevice: &MainDevice<'_>, start_word: u16, ) -> Result<T, Error>

Read a value from the SubDevice’s EEPROM at the given word address.

The given start address is in words NOT bytes. To address the EEPROM using a byte address, divide the given byte address by two.

To read raw bytes, see eeprom_read_raw.

Source

pub async fn eeprom_write_dangerously<T>( &self, maindevice: &MainDevice<'_>, start_word: u16, value: T, ) -> Result<(), Error>

Write a value to the SubDevice’s EEPROM at the given word address.

Warning: This method is safe in the Rust sense, but can cause EEPROM corruption if mishandled. Be very careful when writing data to a SubDevice’s EEPROM.

The given start address is in words NOT bytes. To address the EEPROM using a byte address, divide the given byte address by two.

Source

pub fn identity(&self) -> SubDeviceIdentity

Get additional identifying details for the SubDevice.

Source

pub fn configured_address(&self) -> u16

Get the configured station address of the SubDevice.

Source

pub fn alias_address(&self) -> u16

Get alias address for the SubDevice.

Source

pub fn propagation_delay(&self) -> u32

Get the network propagation delay of this device in nanoseconds.

Note that before MainDevice::init is called, this method will always return 0.

Source

pub fn dc_support(&self) -> DcSupport

Distributed Clock (DC) support.

Trait Implementations§

Source§

impl<'group, const MAX_PDI: usize> Deref for SubDevicePdi<'group, MAX_PDI>

Source§

type Target = SubDevice

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'group, const MAX_PDI: usize> Send for SubDevicePdi<'group, MAX_PDI>

Source§

impl<'group, const MAX_PDI: usize> Sync for SubDevicePdi<'group, MAX_PDI>

Auto Trait Implementations§

§

impl<'group, const MAX_PDI: usize> Freeze for SubDevicePdi<'group, MAX_PDI>

§

impl<'group, const MAX_PDI: usize> !RefUnwindSafe for SubDevicePdi<'group, MAX_PDI>

§

impl<'group, const MAX_PDI: usize> Unpin for SubDevicePdi<'group, MAX_PDI>

§

impl<'group, const MAX_PDI: usize> !UnwindSafe for SubDevicePdi<'group, MAX_PDI>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more