| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/***************************************************************************** |
| 2 |
|
|
* |
| 3 |
|
|
* This file is part of the ecapp library (EtherCAT application devices). |
| 4 |
|
|
* |
| 5 |
|
|
* Copyright (C) 2026 Florian Pose <fp@igh.de> |
| 6 |
|
|
* |
| 7 |
|
|
* The ecapp library is free software: you can redistribute it and/or |
| 8 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
| 9 |
|
|
* as published by the Free Software Foundation, version 3 of the |
| 10 |
|
|
* License. |
| 11 |
|
|
* |
| 12 |
|
|
* The ecapp library is distributed in the hope that it will be useful, |
| 13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
|
|
* Lesser General Public License for more details. |
| 16 |
|
|
* |
| 17 |
|
|
* You should have received a copy of the GNU Lesser General Public |
| 18 |
|
|
* License along with the ecapp library. If not, see |
| 19 |
|
|
* <https://www.gnu.org/licenses/>. |
| 20 |
|
|
* |
| 21 |
|
|
****************************************************************************/ |
| 22 |
|
|
|
| 23 |
|
|
#ifndef ECAPP_PULSETRAINOUTPUT_H |
| 24 |
|
|
#define ECAPP_PULSETRAINOUTPUT_H |
| 25 |
|
|
|
| 26 |
|
|
/****************************************************************************/ |
| 27 |
|
|
|
| 28 |
|
|
#include "ecapp/Capability.h" |
| 29 |
|
|
#include "ecapp_export.h" |
| 30 |
|
|
|
| 31 |
|
|
/****************************************************************************/ |
| 32 |
|
|
|
| 33 |
|
|
namespace EcApp { |
| 34 |
|
|
|
| 35 |
|
|
/** How a pulse-train output channel's A/(B)/(C) signals are generated |
| 36 |
|
|
* from its Frequency value / direction bits -- CoE "Operating mode" |
| 37 |
|
|
* (e.g. 0x8010:0E on the EL2521-xxxx, 0x8pp0:0E per channel on the |
| 38 |
|
|
* EL2522). */ |
| 39 |
|
|
enum class PulseTrainOutputMode { |
| 40 |
|
|
FrequencyModulation, // pulses on channel A only, direction implicit |
| 41 |
|
|
PulseDirection, // pulses on A, direction level on B |
| 42 |
|
|
EncoderSimulation // quadrature A/B (+ C zero pulse, if wired) |
| 43 |
|
|
}; |
| 44 |
|
|
|
| 45 |
|
|
/** Capability interface for Beckhoff-style pulse-train output terminals |
| 46 |
|
|
* (EL2521-xxxx, EL2522): one-shot, pre-activation CoE configuration of |
| 47 |
|
|
* how the output pattern is generated, its polarity, and whether |
| 48 |
|
|
* travel-distance control (the terminal running its own ramp down to |
| 49 |
|
|
* exactly a target counter value, rather than free-running at a |
| 50 |
|
|
* commanded frequency) is active. Not every SubDevice implements this -- |
| 51 |
|
|
* use EcApp::capability<PulseTrainOutput>(device), which throws |
| 52 |
|
|
* UnsupportedCapability for a device that doesn't. */ |
| 53 |
|
2 |
class ECAPP_EXPORT PulseTrainOutput |
| 54 |
|
|
{ |
| 55 |
|
|
public: |
| 56 |
|
2 |
virtual ~PulseTrainOutput() = default; |
| 57 |
|
|
|
| 58 |
|
|
/** Pushes operating mode, output polarity and travel-distance-control |
| 59 |
|
|
* enable to the slave via SDO immediately. Must be called before the |
| 60 |
|
|
* master is activated, and at most once per channel: the EtherCAT |
| 61 |
|
|
* master queues every SDO download rather than replacing an earlier |
| 62 |
|
|
* one for the same object, so a second call would not be an |
| 63 |
|
|
* overwrite but an extra (wasted) download at activation time. */ |
| 64 |
|
|
virtual void configure( |
| 65 |
|
|
unsigned int channel, |
| 66 |
|
|
PulseTrainOutputMode mode, |
| 67 |
|
|
bool negativeLogic = false, |
| 68 |
|
|
bool travelDistanceControl = false) = 0; |
| 69 |
|
|
}; |
| 70 |
|
|
|
| 71 |
|
|
} // namespace EcApp |
| 72 |
|
|
|
| 73 |
|
|
#endif // ECAPP_PULSETRAINOUTPUT_H |
| 74 |
|
|
|
| 75 |
|
|
/****************************************************************************/ |
| 76 |
|
|
|