GCC Code Coverage Report


Directory: ./
File: src/devices/Ex4xxx.h
Date: 2026-09-03 16:05:57
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-style analog output terminals with a scaled double-value
22 * channel per output: EL4002, EL4012, EL4022, EL4028, EL4034, EL4102,
23 * EL4134. This grouping is an implementation detail -- application
24 * code never names Ex4xxx directly, it goes through
25 * createSubDevice("EL4022") and gets an Ecapp::SubDevice back.
26 *
27 ****************************************************************************/
28
29 #ifndef ECAPP_EX4XXX_H
30 #define ECAPP_EX4XXX_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 Ex4xxxType;
50
51 template <Mode mode>
52 1 class Ex4xxx
53 {
54 public:
55 enum Type {
56 EL4002,
57 EL4012,
58 EL4022,
59 EL4028,
60 EL4034,
61 EL4102,
62 EL4134,
63 NumTypes
64 };
65
66 Ex4xxx(pdserv *,
67 pdtask *,
68 const std::string &,
69 Master *,
70 uint16_t,
71 uint16_t,
72 Domain *,
73 Type);
74
75 void setFullScale(unsigned int, double);
76
77 void update(); // forcing logic, writes scaled output
78
79 void setOutput(unsigned int, double); // Control
80 double getOutput(unsigned int); // Simulation
81
82 unsigned int numChannels() const;
83
84 private:
85 const Ex4xxxType &type;
86 ec_slave_config_t *sc;
87 Domain *const domainOut;
88
89 std::vector<int> off_out;
90 std::vector<double> fullScale;
91 std::vector<double> input;
92 std::vector<uint8_t> enableForcing; // not vector<bool>: pdserv
93 // needs a contiguous array
94 std::vector<double> forcedValue;
95 std::vector<double> output;
96 };
97
98 } // namespace EcApp
99
100 #endif // ECAPP_EX4XXX_H
101
102 /****************************************************************************/
103