GCC Code Coverage Report


Directory: ./
File: src/devices/Ex1xxx.h
Date: 2026-09-23 16:22:15
Exec Total Coverage
Lines: 1 1 100.0%
Branches: 0 0 -%

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 <stdint.h>
38 #include <string>
39 #include <vector>
40
41 /****************************************************************************/
42
43 namespace EcApp {
44
45 class Master;
46 class Domain;
47
48 struct Ex1xxxType;
49
50 template <Mode mode>
51 class Ex1xxxAdapter; // Ex1xxx.cpp -- the SubDevice wrapping this class,
52 // friended below so it can reach `input` directly
53 // for pdserv publishing.
54
55 template <Mode mode>
56 1 class Ex1xxx
57 {
58 friend class Ex1xxxAdapter<mode>;
59
60 public:
61 enum Type {
62 EL1004,
63 EL1008,
64 EL1014,
65 EL1018,
66 EL1808,
67 EL1809,
68 EPP1008,
69 NumTypes
70 };
71
72 Ex1xxx(Master *, uint16_t, uint16_t, Domain *, Type);
73 Ex1xxx() = delete;
74
75 void update();
76
77 bool getInput(unsigned int) const; // Control
78 void setInput(unsigned int, bool); // Simulation
79
80 unsigned int numChannels() const;
81
82 private:
83 const Ex1xxxType &type;
84 ec_slave_config_t *sc;
85 Domain *const domain;
86
87 int off_in;
88 std::vector<uint8_t> input;
89 };
90
91 } // namespace EcApp
92
93 #endif // ECAPP_EX1XXX_H
94
95 /****************************************************************************/
96