| 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 |
|
|
* Beckhoff/Wago-style digital input terminals with a uniform PDO shape |
| 22 |
|
|
* (one bit per channel, no diagnosis): EL1004, EL1008, EL1014, EL1018, |
| 23 |
|
|
* EL1808, EL1809, EPP1008. This grouping is an implementation detail -- |
| 24 |
|
|
* application code never names Ex1xxx directly, it goes through |
| 25 |
|
|
* createSubDevice("EL1008") and gets an EcApp::SubDevice back. |
| 26 |
|
|
* |
| 27 |
|
|
****************************************************************************/ |
| 28 |
|
|
|
| 29 |
|
|
#ifndef ECAPP_EX1XXX_H |
| 30 |
|
|
#define ECAPP_EX1XXX_H |
| 31 |
|
|
|
| 32 |
|
|
/****************************************************************************/ |
| 33 |
|
|
|
| 34 |
|
|
#include "ecapp/Mode.h" |
| 35 |
|
|
|
| 36 |
|
|
#include <ecrt.h> // EtherCAT realtime interface |
| 37 |
|
|
#include <pdserv.h> |
| 38 |
|
|
#include <stdint.h> |
| 39 |
|
|
#include <string> |
| 40 |
|
|
#include <vector> |
| 41 |
|
|
|
| 42 |
|
|
/****************************************************************************/ |
| 43 |
|
|
|
| 44 |
|
|
namespace EcApp { |
| 45 |
|
|
|
| 46 |
|
|
class Master; |
| 47 |
|
|
class Domain; |
| 48 |
|
|
|
| 49 |
|
|
struct Ex1xxxType; |
| 50 |
|
|
|
| 51 |
|
|
template <Mode mode> |
| 52 |
|
1 |
class Ex1xxx |
| 53 |
|
|
{ |
| 54 |
|
|
public: |
| 55 |
|
|
enum Type { |
| 56 |
|
|
EL1004, |
| 57 |
|
|
EL1008, |
| 58 |
|
|
EL1014, |
| 59 |
|
|
EL1018, |
| 60 |
|
|
EL1808, |
| 61 |
|
|
EL1809, |
| 62 |
|
|
EPP1008, |
| 63 |
|
|
NumTypes |
| 64 |
|
|
}; |
| 65 |
|
|
|
| 66 |
|
|
Ex1xxx(pdserv *, |
| 67 |
|
|
pdtask *, |
| 68 |
|
|
const std::string &, |
| 69 |
|
|
Master *, |
| 70 |
|
|
uint16_t, |
| 71 |
|
|
uint16_t, |
| 72 |
|
|
Domain *, |
| 73 |
|
|
Type); |
| 74 |
|
|
Ex1xxx() = delete; |
| 75 |
|
|
|
| 76 |
|
|
void update(); |
| 77 |
|
|
|
| 78 |
|
|
bool getInput(unsigned int) const; // Control |
| 79 |
|
|
void setInput(unsigned int, bool); // Simulation |
| 80 |
|
|
|
| 81 |
|
|
unsigned int numChannels() const; |
| 82 |
|
|
|
| 83 |
|
|
private: |
| 84 |
|
|
const Ex1xxxType &type; |
| 85 |
|
|
ec_slave_config_t *sc; |
| 86 |
|
|
Domain *const domain; |
| 87 |
|
|
|
| 88 |
|
|
int off_in; |
| 89 |
|
|
std::vector<uint8_t> input; |
| 90 |
|
|
}; |
| 91 |
|
|
|
| 92 |
|
|
} // namespace EcApp |
| 93 |
|
|
|
| 94 |
|
|
#endif // ECAPP_EX1XXX_H |
| 95 |
|
|
|
| 96 |
|
|
/****************************************************************************/ |
| 97 |
|
|
|