etherage/
lib.rs

1/*!
2    Etherage is a crate implementing an ethercat master, with an API as close as possible to the concepts of the ethercat protocol.
3
4	The following scheme shows the ethernet topology of an ethercat bus. It is a ring considering directional arrows (which is the way data transits over the bus). And it is a tree considering bilateral links (which is the way the network is wired).
5
6	![ethercat network topology](https://raw.githubusercontent.com/jimy-byerley/etherage/master/schemes/ethercat-network.svg)
7
8	Each slave only has a very short time and very limited ressources to react & alter the datagrams transiting from one of its port to the next one, resulting in a realtime communcation bus. This library and the ethercat protocol are designed in this spirit. The idea is for the master to send datagrams and for the slaves to react and fill them, few bytes each slave. In order to control a vast amount of slaves concurrently in the same datagram, this library is deeply `async`.
9
10    ## It mainly features
11
12    - [Master] for protocol-safe and memory-safe access to the functions of the master
13    - [Slave] for protocol-safe and memory-safe access to the functions of slaves
14    - [RawMaster] and other structures based on it for memory-safe but protocol-unsafe access to lower level features of the protocol
15
16    ## Complete feature list
17
18    - [x] master over different sockets
19        + [x] raw ethernet
20        + [x] UDP
21    - [x] minimalistic features
22        - [x] PDU commands
23        - [x] access to logical & physical memories
24        - [x] slave information access
25    - [x] mailbox
26        + generic messaging
27        + [x] COE
28            - [x] SDO read/write
29            - [ ] PDO read/write
30            - [ ] informations
31            - [x] tools for mapping
32        + [ ] EOE
33        + [ ] FOE
34    - [x] distributed clock
35        + [x] static drift
36        + [x] dynamic drift
37    - convenience
38        + [x] logical memory & slave group management tools
39        + [x] mapping tools
40    - optimization features
41        + [x] multiple PDUs per ethercat frame (speed up and compress transmissions)
42        + [x] tasks for different slaves or for same slave are parallelized whenever possible
43        + [x] no dynamic allocation in transmission and realtime functions
44        + [x] async API and implementation to avoid threads context switches
45*/
46
47#![doc(html_favicon_url = "https://raw.githubusercontent.com/jimy-byerley/etherage/master/logo/etherage.svg")]
48#![doc(html_logo_url = "https://raw.githubusercontent.com/jimy-byerley/etherage/master/logo/ethercotic.svg")]
49
50pub mod data;
51pub mod error;
52
53#[allow(non_upper_case_globals)] 
54#[allow(unused)]
55pub mod registers;
56#[allow(non_upper_case_globals)]
57#[allow(unused)]
58pub mod sdo;
59#[allow(non_upper_case_globals)] 
60#[allow(unused)]
61pub mod eeprom;
62
63pub mod socket;
64pub mod rawmaster;
65pub mod sii;
66pub mod mailbox;
67pub mod can;
68pub mod master;
69pub mod clock;
70pub mod slave;
71pub mod mapping;
72
73
74pub use crate::data::{PduData, Field, BitField};
75pub use crate::sdo::Sdo;
76pub use crate::socket::*;
77pub use crate::rawmaster::{RawMaster, SlaveAddress};
78pub use crate::master::Master;
79pub use crate::slave::{Slave, CommunicationState};
80pub use crate::mapping::{Mapping, Group, Config};
81pub use crate::error::{EthercatError, EthercatResult};