Agile Modbus  1.1.4
Lightweight modbus protocol stack.
agile_modbus_rtu.c File Reference

Agile Modbus package RTU source file. More...

#include "agile_modbus.h"
#include "agile_modbus_rtu.h"
Include dependency graph for agile_modbus_rtu.c:

Go to the source code of this file.

Functions

static uint16_t agile_modbus_rtu_crc16 (uint8_t *buffer, uint16_t buffer_length)
 RTU CRC16 calculation. More...
 
static int agile_modbus_rtu_set_slave (agile_modbus_t *ctx, int slave)
 RTU sets the address interface. More...
 
static int agile_modbus_rtu_build_request_basis (agile_modbus_t *ctx, int function, int addr, int nb, uint8_t *req)
 RTU builds the basic request message interface (header message) More...
 
static int agile_modbus_rtu_build_response_basis (agile_modbus_sft_t *sft, uint8_t *rsp)
 RTU builds the basic response message interface (header message) More...
 
static int agile_modbus_rtu_prepare_response_tid (const uint8_t *req, int *req_length)
 RTU ready response interface. More...
 
static int agile_modbus_rtu_send_msg_pre (uint8_t *req, int req_length)
 RTU pre-send data interface. More...
 
static int agile_modbus_rtu_check_integrity (agile_modbus_t *ctx, uint8_t *msg, const int msg_length)
 RTU check received data integrity interface (CRC16 comparison) More...
 
static int agile_modbus_rtu_pre_check_confirmation (agile_modbus_t *ctx, const uint8_t *req, const uint8_t *rsp, int rsp_length)
 RTU pre-check confirmation interface (request response address comparison) More...
 
int agile_modbus_rtu_init (agile_modbus_rtu_t *ctx, uint8_t *send_buf, int send_bufsz, uint8_t *read_buf, int read_bufsz)
 RTU initialization. More...
 

Variables

static const uint8_t _table_crc_hi []
 Table of CRC values for high-order byte. More...
 
static const uint8_t _table_crc_lo []
 Table of CRC values for low-order byte. More...
 
static const agile_modbus_backend_t agile_modbus_rtu_backend
 RTU backend interface. More...
 

Detailed Description

Agile Modbus package RTU source file.

Author
Ma Longwei (25440.nosp@m.4721.nosp@m.3@qq..nosp@m.com)
Date
2021-12-02
Attention

© Copyright (c) 2021 Ma Longwei. All rights reserved.

Definition in file agile_modbus_rtu.c.