liblightmodbus  2.0
A lightweight, cross-platform Modbus RTU library
Functions
lightmodbus.c File Reference

Functions

uint8_t modbusMaskRead (const uint8_t *mask, uint16_t maskLength, uint16_t bit)
 Reads n-th bit from an array. More...
 
uint8_t modbusMaskWrite (uint8_t *mask, uint16_t maskLength, uint16_t bit, uint8_t value)
 Writes n-th bit in an array. More...
 
uint16_t modbusCRC (const uint8_t *data, uint16_t length)
 Calculates 16-bit Modbus CRC of provided data. More...
 

Function Documentation

◆ modbusCRC()

uint16_t modbusCRC ( const uint8_t *  data,
uint16_t  length 
)

Calculates 16-bit Modbus CRC of provided data.

Parameters
dataA pointer to the data to be processed
lengthNumber of bytes, starting at the data pointer, to process
Returns
16-bit Modbus CRC value
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modbusMaskRead()

uint8_t modbusMaskRead ( const uint8_t *  mask,
uint16_t  maskLength,
uint16_t  bit 
)

Reads n-th bit from an array.

Parameters
maskA pointer to the array
maskLengthThe length of the array in bytes
bitNumber of the bit to be read
Returns
The bit value, or 255 if the bit lies outside the array.
+ Here is the caller graph for this function:

◆ modbusMaskWrite()

uint8_t modbusMaskWrite ( uint8_t *  mask,
uint16_t  maskLength,
uint16_t  bit,
uint8_t  value 
)

Writes n-th bit in an array.

Parameters
maskA pointer to the array
maskLengthThe length of the array in bytes
bitNumber of the bit to write
valueBit value to be written
Returns
Bit value on success, 255 if the bit lies outside the array.
+ Here is the caller graph for this function: