5 #include "EcSlaveFactory.h"
11 #include <soem/ethercattype.h>
12 #include <soem/ethercatbase.h>
13 #include <soem/ethercatmain.h>
14 #include <soem/ethercatconfig.h>
15 #include <soem/ethercatdc.h>
16 #include <soem/ethercatcoe.h>
17 #include <soem/ethercatsoe.h>
18 #include <soem/ethercatprint.h>
19 #include <soem/nicdrv.h>
33 #define NSEC_PER_SEC 1000000000
64 EcMaster(std::string ecPort,
unsigned long cycleTime = 1000000,
bool useDC =
false);
76 void setPort(std::string ecPort) {ethPort=ecPort;}
83 void setCycleTime(
unsigned long cycleTime) {m_cycleTime = cycleTime;}
90 void setDC(
bool useDC) {m_useDC = useDC;}
127 bool start() throw(EcError);
134 bool stop() throw(EcError);
141 bool reset() throw(EcError);
182 unsigned long m_cycleTime;
185 std::vector<
EcSlave*> m_drivers;
186 #if defined(HRT) || defined(NRT)
189 int inputSize, outputSize;
194 bool switchState (ec_state state);
198 char * devnameOutput;
200 int fdOutput,fdInput;
202 #if defined(HRT) || defined(NRT)
204 std::thread updateThread;
206 void update_EcSlaves(
void) throw(EcError);
210 bool slaveInformation;
218 void slaveInfo(
void);
219 char* dtype2string(uint16 dtype);
220 char* SDO2string(uint16 slave, uint16 index, uint8 subidx, uint16 dtype);
221 int si_PDOassign(uint16 slave, uint16 PDOassign,
int mapoffset,
int bitoffset);
222 int si_siiPDO(uint16 slave, uint8 t,
int mapoffset,
int bitoffset);
223 int si_map_sdo(
int slave);
224 int si_map_sii(
int slave);
225 void si_sdo(
int cnt);
EcMaster()
Default Constructor.
Definition: EcNRTMaster.cpp:24
Class EcSlave.
Definition: EcSlave.h:53
bool start()
Starts comunication.
Definition: EcNRTMaster.cpp:186
void update(void)
Update the outputs.
Definition: EcNRTMaster.cpp:200
void setSync0Shift(int Shift)
Set Sync0 Shift.
Definition: EcMaster.h:97
std::vector< EcSlave * > getSlaves()
Get slaves vector.
Definition: EcMaster.h:148
Class EcError.
Definition: EcError.h:13
void setPort(std::string ecPort)
Set the ethercat port.
Definition: EcMaster.h:76
bool preconfigure()
Preconfiguration.
Definition: EcNRTMaster.cpp:63
void setSlaveInfo(bool slaveInfo)
Set slave information.
Definition: EcMaster.h:104
bool configure()
Configuration.
Definition: EcNRTMaster.cpp:125
void setCycleTime(unsigned long cycleTime)
Set the cycle time of the PDO thread.
Definition: EcMaster.h:83
bool stop()
Stops communication.
Definition: EcNRTMaster.cpp:236
~EcMaster()
Destructor.
Definition: EcNRTMaster.cpp:58
bool reset()
Resets configuration.
Definition: EcNRTMaster.cpp:248
Class EcMaster.
Definition: EcMaster.h:46
void setDC(bool useDC)
Set Distributed clocks.
Definition: EcMaster.h:90
Definition: EcMaster.h:37