16 lines
847 B
C
16 lines
847 B
C
#ifndef SET_MODBUS_DATA_H
|
|
#define SET_MODBUS_DATA_H
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
/* Decoded Modbus values, independent of UART/HAL and register addresses.
|
|
* Coils in bank use bit 0 first in 16-bit words. Message words contain two
|
|
* wire bytes, first byte in bits 15..8 (same convention as register messages).
|
|
* The port validates/maps the complete address range before calling transfer.
|
|
* Return standard Modbus exceptions: 0 success, 1 function, 3 value. */
|
|
uint8_t mb_data_validate(uint8_t function, uint16_t quantity, uint16_t byte_count,
|
|
size_t data_capacity);
|
|
uint8_t mb_data_transfer(uint8_t function, uint16_t quantity, uint16_t byte_count,
|
|
uint16_t *bank, uint16_t bit_offset, uint16_t *data,
|
|
size_t data_capacity, uint16_t *response_bytes);
|
|
#endif
|