Utility class for Modbus buffer management.
More...
#include <ModbusBuffer.h>
|
int32_t | getIndex () |
|
void | setIndex (int32_t index) |
|
void | incIndex (int32_t inc) |
|
void | skipToNextFrame () |
|
uint16_t * | getBuffer () |
|
void | set (int32_t index, uint16_t data) |
|
void | setLength (int32_t length) |
|
int32_t | getLength () |
|
void | reset () |
| Set empty buffer.
|
|
bool | endOfBuffer () |
|
bool | endOfFrame () |
|
std::vector< uint8_t > | getReadData (int32_t length) |
| Returns read data from buffer.
|
|
uint16_t | calculateCRC (int32_t length) |
| Calculate Modbus from written data.
|
|
uint16_t | readLength () |
|
int32_t | readI32 () |
|
uint8_t | readU8 () |
|
uint16_t | readU16 () |
|
uint32_t | readU32 () |
|
uint64_t | readU48 () |
|
float | readSGL () |
|
std::string | readString (int32_t length) |
|
uint16_t | readCRC () |
|
double | readTimestamp () |
|
void | readEndOfFrame () |
|
void | writeSubnet (uint8_t data) |
|
void | writeLength (uint16_t data) |
|
void | writeI8 (int8_t data) |
|
void | writeI16 (int16_t data) |
|
void | writeI24 (int32_t data) |
|
void | writeI32 (int32_t data) |
|
void | writeU8 (uint8_t data) |
|
void | writeU16 (uint16_t data) |
|
void | writeU32 (uint32_t data) |
|
void | writeSGL (float data) |
|
void | writeCRC (int32_t length) |
|
void | writeDelay (uint32_t delayMicros) |
|
void | writeEndOfFrame () |
|
void | writeSoftwareTrigger () |
|
void | writeTimestamp () |
|
void | writeTriggerIRQ () |
|
void | writeWaitForRx (uint32_t timeoutMicros) |
|
void | pullModbusResponse (uint16_t request, uint64_t &beginTs, uint64_t &endTs, std::vector< uint8_t > &data) |
| Fills buffer with data from response, returns start and end timestamps.
|
|
Utility class for Modbus buffer management.
Provides function to write and read cRIO FIFO (FPGA) Modbus buffers.
8bit data are stored as 16bit values. Real data are left shifted by 1. Last bit (0, transmitted first) is start bit, always 1 for ILC communication.
◆ calculateCRC() [1/2]
uint16_t LSST::M1M3::SS::ModbusBuffer::calculateCRC |
( |
int32_t | length | ) |
|
Calculate Modbus from written data.
- Parameters
-
- Returns
- calculated Modbus CRC16
◆ calculateCRC() [2/2]
uint16_t LSST::M1M3::SS::ModbusBuffer::calculateCRC |
( |
std::vector< uint8_t > | data | ) |
|
|
static |
Calculate Modbus CRC16.
- Parameters
-
data | data for CRC16 calculation |
- Returns
- calculated Modbus CRC16
◆ getReadData()
std::vector< uint8_t > LSST::M1M3::SS::ModbusBuffer::getReadData |
( |
int32_t | length | ) |
|
Returns read data from buffer.
- Parameters
-
- Returns
- read data
◆ pullModbusResponse()
void LSST::M1M3::SS::ModbusBuffer::pullModbusResponse |
( |
uint16_t | request, |
|
|
uint64_t & | beginTs, |
|
|
uint64_t & | endTs, |
|
|
std::vector< uint8_t > & | data ) |
Fills buffer with data from response, returns start and end timestamps.
Checks for CRC.
Throws exception on error.
◆ readInstructionByte()
static uint8_t LSST::M1M3::SS::ModbusBuffer::readInstructionByte |
( |
uint16_t | instruction | ) |
|
|
inlinestatic |
Reads instruction byte from FPGA FIFO.
- Parameters
-
instruction | instruction from Response FIFO. |
- Returns
- byte written by the instruction. Start bit is removed.
◆ writeByteInstruction()
static uint16_t LSST::M1M3::SS::ModbusBuffer::writeByteInstruction |
( |
uint8_t | data | ) |
|
|
inlinestatic |
Return data item to write to buffer.
- Parameters
-
- Returns
- 16bit for command queue.
The documentation for this class was generated from the following files: