opensurgsim
|
A collection of checksum functions specifically tailored for the labjackusb driver. More...
Classes | |
struct | AnalogInputSettings |
The analog input ranges. More... | |
struct | TimerSettings |
A struct holding the data to be associated with a Timer. More... | |
Enumerations | |
enum | Model { MODEL_SEARCH = -1, MODEL_UE9 = 9, MODEL_U3 = 3, MODEL_U6 = 6 } |
The models of LabJack devices. Numbers come from LabJackUD.h. | |
enum | Connection { CONNECTION_SEARCH = -1, CONNECTION_USB = 1, CONNECTION_ETHERNET = 2, CONNECTION_ETHERNET_MB = 3, CONNECTION_ETHERNET_DATA_ONLY = 4 } |
The connection (i.e., communication media) for LabJacks. Numbers come from LabJackUD.h. | |
enum | TimerBase { TIMERBASE_DEFAULT = -1, TIMERBASE_0 = 0, TIMERBASE_1 = 1, TIMERBASE_2 = 2, TIMERBASE_3 = 3, TIMERBASE_4 = 4, TIMERBASE_5 = 5, TIMERBASE_6 = 6, TIMERBASE_20 = 20, TIMERBASE_21 = 21, TIMERBASE_22 = 22, TIMERBASE_23 = 23, TIMERBASE_24 = 24, TIMERBASE_25 = 25, TIMERBASE_26 = 26 } |
The timer base frequencies for LabJacks. More... | |
enum | TimerMode { TIMERMODE_PWM_16BIT = 0, TIMERMODE_PWM_8BIT = 1, TIMERMODE_RISING_EDGES_32BIT = 2, TIMERMODE_FALLING_EDGES_32BIT = 3, TIMERMODE_DUTY_CYCLE = 4, TIMERMODE_FIRMWARE_COUNTER = 5, TIMERMODE_FIRMWARE_COUNTER_DEBOUNCED = 6, TIMERMODE_FREQUENCY_OUTPUT = 7, TIMERMODE_QUADRATURE = 8, TIMERMODE_TIMER_STOP = 9, TIMERMODE_SYSTEM_TIMER_LOWER_32BITS = 10, TIMERMODE_SYSTEM_TIMER_UPPR_32BITS = 11, TIMERMODE_RISING_EDGES_16BIT = 12, TIMERMODE_FALLING_EDGES_16BIT = 13, TIMERMODE_LINE_TO_LINE = 14 } |
The timer modes. More... | |
enum | TIMER { TIMER0, TIMER1, TIMER2, TIMER3, TIMER4, TIMER5 } |
enum | FIO_LINE { FIO0, FIO1, FIO2, FIO3, FIO4, FIO5, FIO6, FIO7 } |
enum | EIO_LINE { EIO0 = 8, EIO1, EIO2, EIO3, EIO4, EIO5, EIO6, EIO7 } |
enum | CIO_LINE { CIO0 = 16, CIO1, CIO2, CIO3 } |
enum | MIO_LINE { MIO0 = 20, MIO1, MIO2 } |
enum | AIN { AIN0, AIN1, AIN2, AIN3, AIN4, AIN5, AIN6, AIN7, AIN8, AIN9, AIN10, AIN11, AIN12, AIN13, AIN14, AIN15 } |
enum | DAC { DAC0, DAC1 } |
Functions | |
unsigned char | normalChecksum8 (const std::array< unsigned char, MAXIMUM_BUFFER > &bytes, int count) |
Calculates an 8-bit 1's complement unsigned checksum specifically for normal command communication with the low-level LabJack driver. More... | |
uint16_t | extendedChecksum16 (const std::array< unsigned char, MAXIMUM_BUFFER > &bytes, int count) |
Calculates a 16-bit 1's complement unsigned checksum specifically for extended command communication with the low-level LabJack driver. More... | |
unsigned char | extendedChecksum8 (const std::array< unsigned char, MAXIMUM_BUFFER > &bytes) |
Calculates an 8-bit 1's complement unsigned checksum specifically for extended command communication with the low-level LabJack driver. More... | |
void | normalChecksum (std::array< unsigned char, MAXIMUM_BUFFER > *bytes, int count) |
Performs the 8-bit 1's complement unsigned checksum required for normal command communication with the low-level LabJack driver, and stores the result in the buffer. More... | |
void | extendedChecksum (std::array< unsigned char, MAXIMUM_BUFFER > *bytes, int count) |
Performs the 1's complement unsigned checksums required for extended command communication with the low-level LabJack driver, and stores the results in the buffer. More... | |
double | doubleFromChars (const std::array< unsigned char, MAXIMUM_BUFFER > &bytes, int startIndex) |
Converts an eight byte array to a floating point double value. More... | |
uint32_t | uint32FromChars (const std::array< unsigned char, LabJack::MAXIMUM_BUFFER > &bytes, int startIndex, int count) |
Converts an array of bytes to a uint32_t, with the least significant byte at startIndex, and the most significant byte at startIndex + byteCount - 1. More... | |
uint16_t | uint16FromChars (const std::array< unsigned char, LabJack::MAXIMUM_BUFFER > &bytes, int startIndex, int count) |
Converts an array of bytes to a uint16_t, with the least significant byte at startIndex. More... | |
A collection of checksum functions specifically tailored for the labjackusb driver.
These functions are based off the description in the LabJack User's Guide, and the examples provided with labjackusb.
The timer or channel number that corresponds with the descriptive name used by the LabJack. Use these for the arguments to the enable* functions.
The timer base frequencies for LabJacks.
A given value can correspond to different clock frequencies for different LabJack models. The same clock frequency corresponds to different values depending on whether the high- or low-level driver is used. See section 2.10 - Timers/Counters in the respective model's User's Guide.
The timer modes.
Numbers come from LabJackUD.h. Note that edge-counting modes require processing time: see the LabJack manual for restrictions on number of edges counted per second over all timers (e.g., 30,000/second for U3 or U6).
double SurgSim::Devices::LabJack::doubleFromChars | ( | const std::array< unsigned char, MAXIMUM_BUFFER > & | bytes, |
int | startIndex | ||
) |
Converts an eight byte array to a floating point double value.
This function is necessary for communication with the low-level driver for the LabJack, which passes all data via unsigned char. The expected format is: the first four bytes store the truncated absolute value of the decimal portion times 4294967296, the last four bytes store the signed whole-number portion, and the bytes are stored in little endian order.
bytes | The array. |
startIndex | The index of the first element. |
void SurgSim::Devices::LabJack::extendedChecksum | ( | std::array< unsigned char, MAXIMUM_BUFFER > * | bytes, |
int | count | ||
) |
Performs the 1's complement unsigned checksums required for extended command communication with the low-level LabJack driver, and stores the results in the buffer.
This function is called prior to writing data to the device for an "extended" command, so that the device can do a checksum.
[in,out] | bytes | The buffer of bytes. |
count | The number of bytes to check. |
uint16_t SurgSim::Devices::LabJack::extendedChecksum16 | ( | const std::array< unsigned char, MAXIMUM_BUFFER > & | bytes, |
int | count | ||
) |
Calculates a 16-bit 1's complement unsigned checksum specifically for extended command communication with the low-level LabJack driver.
bytes | The buffer of bytes. |
count | The number of bytes to check. |
unsigned char SurgSim::Devices::LabJack::extendedChecksum8 | ( | const std::array< unsigned char, MAXIMUM_BUFFER > & | bytes | ) |
Calculates an 8-bit 1's complement unsigned checksum specifically for extended command communication with the low-level LabJack driver.
bytes | The buffer of bytes. |
void SurgSim::Devices::LabJack::normalChecksum | ( | std::array< unsigned char, MAXIMUM_BUFFER > * | bytes, |
int | count | ||
) |
Performs the 8-bit 1's complement unsigned checksum required for normal command communication with the low-level LabJack driver, and stores the result in the buffer.
This function is called prior to writing data to the device for a "normal" command, so that the device can do a checksum.
[in,out] | bytes | The buffer of bytes. |
count | The number of bytes to check. |
unsigned char SurgSim::Devices::LabJack::normalChecksum8 | ( | const std::array< unsigned char, MAXIMUM_BUFFER > & | bytes, |
int | count | ||
) |
Calculates an 8-bit 1's complement unsigned checksum specifically for normal command communication with the low-level LabJack driver.
bytes | The buffer of bytes. |
count | The number of bytes to check. |
uint16_t SurgSim::Devices::LabJack::uint16FromChars | ( | const std::array< unsigned char, LabJack::MAXIMUM_BUFFER > & | bytes, |
int | startIndex, | ||
int | count | ||
) |
Converts an array of bytes to a uint16_t, with the least significant byte at startIndex.
bytes | The array. |
startIndex | The index in the array of the first byte to use. |
count | The number of bytes to convert. |
Asserts | if byteCount is greater than 2, or it attempts to access beyond the end of the byte array. |
uint32_t SurgSim::Devices::LabJack::uint32FromChars | ( | const std::array< unsigned char, LabJack::MAXIMUM_BUFFER > & | bytes, |
int | startIndex, | ||
int | count | ||
) |
Converts an array of bytes to a uint32_t, with the least significant byte at startIndex, and the most significant byte at startIndex + byteCount - 1.
bytes | The array. |
startIndex | The index in the array of the first byte to use. |
count | The number of bytes to convert. |
Asserts | if byteCount is greater than 4, or it attempts to access beyond the end of the byte array. |