liblightmodbus 3.0
A lightweight, header-only, hardware-agnostic Modbus RTU/TCP library
Loading...
Searching...
No Matches
lightmodbus.h
Go to the documentation of this file.
1/*
2 liblightmodbus - a lightweight, header-only, cross-platform Modbus RTU/TCP library
3 Copyright (C) 2021 Jacek Wieczorek <mrjjot@gmail.com>
4
5 This file is part of liblightmodbus.
6
7 Liblightmodbus is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 Liblightmodbus 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
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
26// For C++
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#ifndef LIGHTMODBUS_H
32#define LIGHTMODBUS_H
33
34/*
35 Optionally include a configuration file here
36*/
37#ifdef LIGHTMODBUS_USE_CONFIG_FILE
38 #ifdef LIGHTMODBUS_CONFIG_FILE
39 #include LIGHTMODBUS_CONFIG_FILE
40 #else
41 #include "config.h"
42 #endif
43#endif
44
49#ifdef LIGHTMODBUS_FULL
50 #ifndef LIGHTMODBUS_SLAVE_FULL
51 #define LIGHTMODBUS_SLAVE_FULL
52 #endif
53
54 #ifndef LIGHTMODBUS_MASTER_FULL
55 #define LIGHTMODBUS_MASTER_FULL
56 #endif
57#endif
58
63#ifdef LIGHTMODBUS_SLAVE_FULL
64 #ifndef LIGHTMODBUS_SLAVE
65 #define LIGHTMODBUS_SLAVE
66 #endif
67#endif
68
73#ifdef LIGHTMODBUS_MASTER_FULL
74 #ifndef LIGHTMODBUS_MASTER
75 #define LIGHTMODBUS_MASTER
76 #endif
77#endif
78#endif
79
80// Always include base
81#include "base.h"
82
87#ifdef LIGHTMODBUS_SLAVE
88 #include "slave.h"
89 #include "slave_func.h"
90#endif
91
96#ifdef LIGHTMODBUS_MASTER
97 #include "master.h"
98 #include "master_func.h"
99#endif
100
105#ifdef LIGHTMODBUS_DEBUG
106 #include "debug.h"
107#endif
108
114#ifdef LIGHTMODBUS_IMPL
115 #include "base.impl.h"
116 #ifdef LIGHTMODBUS_SLAVE
117 #include "slave.impl.h"
118 #include "slave_func.impl.h"
119 #endif
120
121 #ifdef LIGHTMODBUS_MASTER
122 #include "master.impl.h"
123 #include "master_func.impl.h"
124 #endif
125
126 #ifdef LIGHTMODBUS_DEBUG
127 #include "debug.impl.h"
128 #endif
129#endif
130
131// For C++ (closes `extern "C"` )
132#ifdef __cplusplus
133}
134#endif
Common types and functions (header)
Common types and functions (implementation)
Debug utilities (header)
Debug utilities (implementation)
Master's types and basic functions (header)
Master's types and basic functions (implementation)
Master's functions for building requests and parsing responses (header)
Master's functions for building requests and parsing responses (implementation)
Slave's types and basic functions (header)
Slave's types and basic functions (implementation)
Slave's functions for parsing requests (header)
Slave's functions for parsing requests (implementation)