|
liblightmodbus 3.0
A lightweight, header-only, hardware-agnostic Modbus RTU/TCP library
|
Master's types and basic functions (implementation) More...
Include dependency graph for master.impl.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| ModbusErrorInfomodbusMasterInit (ModbusMaster *status, ModbusDataCallback dataCallback, ModbusMasterExceptionCallback exceptionCallback, ModbusAllocator allocator, const ModbusMasterFunctionHandler *functions, uint8_t functionCount) | |
| Initializes a ModbusMaster struct. | |
| void | modbusMasterDestroy (ModbusMaster *status) |
| Deinitializes a ModbusMaster struct. | |
| ModbusErrorInfomodbusBeginRequestPDU (ModbusMaster *status) | |
| Begins a PDU-only request. | |
| ModbusErrorInfomodbusEndRequestPDU (ModbusMaster *status) | |
| Finalizes a PDU-only request. | |
| ModbusErrorInfomodbusBeginRequestRTU (ModbusMaster *status) | |
| Begins a RTU request. | |
| ModbusErrorInfomodbusEndRequestRTU (ModbusMaster *status, uint8_t address) | |
| Finalizes a Modbus RTU request. | |
| ModbusErrorInfomodbusBeginRequestTCP (ModbusMaster *status) | |
| Begins a TCP request. | |
| ModbusErrorInfomodbusEndRequestTCP (ModbusMaster *status, uint16_t transactionID, uint8_t unitID) | |
| Finalizes a Modbus TCP request. | |
| ModbusErrorInfomodbusParseResponsePDU (ModbusMaster *status, uint8_t address, const uint8_t *request, uint8_t requestLength, const uint8_t *response, uint8_t responseLength) | |
| Parses a PDU section of a slave response. | |
| ModbusErrorInfomodbusParseResponseRTU (ModbusMaster *status, const uint8_t *request, uint16_t requestLength, const uint8_t *response, uint16_t responseLength) | |
| Parses a Modbus RTU slave response. | |
| ModbusErrorInfomodbusParseResponseTCP (ModbusMaster *status, const uint8_t *request, uint16_t requestLength, const uint8_t *response, uint16_t responseLength) | |
| Parses a Modbus TCP slave response. | |
Variables | |
| ModbusMasterFunctionHandler | modbusMasterDefaultFunctions [] |
| Default array of supported functions. Length is stored in modbusMasterDefaultFunctionCount. | |
| const uint8_t | modbusMasterDefaultFunctionCount = sizeof(modbusMasterDefaultFunctions) / sizeof(modbusMasterDefaultFunctions[0]) - 1 |
| Stores length of modbusMasterDefaultFunctions array. | |
Master's types and basic functions (implementation)
| ModbusErrorInfomodbusBeginRequestPDU | ( | ModbusMaster * | status | ) |
| ModbusErrorInfomodbusBeginRequestRTU | ( | ModbusMaster * | status | ) |
| ModbusErrorInfomodbusBeginRequestTCP | ( | ModbusMaster * | status | ) |
| ModbusErrorInfomodbusEndRequestPDU | ( | ModbusMaster * | status | ) |
Finalizes a PDU-only request.
| ModbusErrorInfomodbusEndRequestRTU | ( | ModbusMaster * | status, |
| uint8_t | address ) |
Finalizes a Modbus RTU request.
Here is the call graph for this function:| ModbusErrorInfomodbusEndRequestTCP | ( | ModbusMaster * | status, |
| uint16_t | transactionID, | ||
| uint8_t | unitID ) |
Finalizes a Modbus TCP request.
| transactionID | Modbus TCP transaction identifier |
| unitID | Modbus TCP Unit ID |
Here is the call graph for this function:| ModbusErrorInfomodbusMasterInit | ( | ModbusMaster * | status, |
| ModbusDataCallback | dataCallback, | ||
| ModbusMasterExceptionCallback | exceptionCallback, | ||
| ModbusAllocator | allocator, | ||
| const ModbusMasterFunctionHandler * | functions, | ||
| uint8_t | functionCount ) |
Initializes a ModbusMaster struct.
| status | ModbusMaster struct to be initialized |
| dataCallback | Callback function for handling incoming data (may be required by used parsing functions) |
| exceptionCallback | Callback function for handling slave exceptions (optional) |
| allocator | Memory allocator to be used (see modbusDefaultAllocator()) (required) |
| functions | Pointer to an array of supported function handlers (required). The lifetime of this array must not be shorter than the lifetime of the master. |
| functionCount | Number of elements in the functions array (required) |
| ModbusErrorInfomodbusParseResponsePDU | ( | ModbusMaster * | status, |
| uint8_t | address, | ||
| const uint8_t * | request, | ||
| uint8_t | requestLength, | ||
| const uint8_t * | response, | ||
| uint8_t | responseLength ) |
Parses a PDU section of a slave response.
| address | Value to be reported as slave address |
| request | Pointer to the PDU section of the request frame |
| requestLength | Length of the request PDU (valid range: 1 - 253) |
| response | Pointer to the PDU section of the response |
| responseLength | Length of the response PDU (valid range: 1 - 253) |
| ModbusErrorInfomodbusParseResponseRTU | ( | ModbusMaster * | status, |
| const uint8_t * | request, | ||
| uint16_t | requestLength, | ||
| const uint8_t * | response, | ||
| uint16_t | responseLength ) |
Parses a Modbus RTU slave response.
| request | Pointer to the request frame |
| requestLength | Length of the request (valid range: 4 - 256) |
| response | Pointer to the response frame |
| responseLength | Length of the response (valid range: 4 - 256) |
Here is the call graph for this function:| ModbusErrorInfomodbusParseResponseTCP | ( | ModbusMaster * | status, |
| const uint8_t * | request, | ||
| uint16_t | requestLength, | ||
| const uint8_t * | response, | ||
| uint16_t | responseLength ) |
Parses a Modbus TCP slave response.
| request | Pointer to the request frame |
| requestLength | Length of the request (valid range: 8 - 260) |
| response | Pointer to the response frame |
| responseLength | Length of the response (valid range: 8 - 260) |
Here is the call graph for this function:| void modbusMasterDestroy | ( | ModbusMaster * | status | ) |
Deinitializes a ModbusMaster struct.
| status | ModbusMaster struct to be destroyed |
status pointer and only cleans up the interals ofthe ModbusMaster struct.
Here is the call graph for this function:
Here is the caller graph for this function:| const uint8_t modbusMasterDefaultFunctionCount = sizeof(modbusMasterDefaultFunctions) / sizeof(modbusMasterDefaultFunctions[0]) - 1 |
Stores length of modbusMasterDefaultFunctions array.
| ModbusMasterFunctionHandler modbusMasterDefaultFunctions[] |
Default array of supported functions. Length is stored in modbusMasterDefaultFunctionCount.
Contents are controlled by defining LIGHTMODBUS_FxxM macros.