Struct ethercat_soem_ctx::Ctx
source · [−]Expand description
SOEM ecx_context
wrapper
Fields
io_map: [u8; 4096]
I/O map
Implementations
sourceimpl Ctx
impl Ctx
sourcepub fn init(&mut self, iface: CString) -> i32
pub fn init(&mut self, iface: CString) -> i32
Initialise lib in single NIC mode.
Return > 0 if OK.
pub fn config_init(&mut self, use_table: bool) -> i32
pub fn config_map_group(&mut self, group: u8) -> i32
pub fn config_dc(&mut self) -> u8
pub const fn slave_count(&self) -> usize
pub fn slaves(&self) -> &[Slave; 200]
pub fn slaves_mut(&mut self) -> &mut [Slave; 200]
pub const fn groups(&self) -> &[Group; 2]
sourcepub fn write_state(&mut self, slave: u16) -> i32
pub fn write_state(&mut self, slave: u16) -> i32
Write slave state, if slave = 0 then write to all slaves.
The function does not check if the actual state is changed.
It returns Workcounter or EC_NOFRAME
(= -1
),
sourcepub fn state_check(&mut self, slave: u16, state: u16, timeout: Duration) -> u16
pub fn state_check(&mut self, slave: u16, state: u16, timeout: Duration) -> u16
Check actual slave state.
This is a blocking function.
To refresh the state of all slaves read_state()
should be called.
Parameter slave
= Slave number, 0 = all slaves (only the “slavelist[0].state” is refreshed).
It returns requested state, or found state after timeout.
sourcepub fn read_state(&mut self) -> i32
pub fn read_state(&mut self) -> i32
Read all slave states in ec_slave.
It returns the lowest state found,
pub fn send_processdata(&mut self) -> i32
pub fn receive_processdata(&mut self, timeout: Duration) -> i32
pub fn read_od_list(&mut self, slave: u16, od_list: &mut OdList) -> i32
pub fn read_od_description(&mut self, item: u16, od_list: &mut OdList) -> i32
pub fn read_oe(
&mut self,
item: u16,
od_list: &mut OdList,
oe_list: &mut OeList
) -> i32
pub fn sdo_read<'t>(
&mut self,
slave: u16,
idx: u16,
sub_idx: u8,
access_complete: bool,
target: &'t mut [u8],
timeout: Duration
) -> (i32, &'t mut [u8])
pub fn sdo_write(
&mut self,
slave: u16,
idx: u16,
sub_idx: u8,
access_complete: bool,
data: &[u8],
timeout: Duration
) -> i32
pub const fn max_group(&self) -> i32
pub fn is_err(&mut self) -> bool
pub fn pop_error(&mut self) -> Option<Error>
pub const fn dc_time(&self) -> i64
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Ctx
impl !Send for Ctx
impl !Sync for Ctx
impl Unpin for Ctx
impl UnwindSafe for Ctx
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more