CalibrationUtilities 1.0.4
A small compiled C library for handling cursor calibration operations.
|
Calibrate and/or transform the potentiometer voltages from each gimbal.
More...
Functions | |
CalibrationData | calu_initCalibrationData () |
Initializes a CalibrationData structure with default values. | |
int16_t | calu_imax (int16_t a, int16_t b) |
Returns the maximum of two int16_t values. | |
uint16_t | calu_rescale (int16_t input_voltage, int16_t input_center, int16_t input_range, int16_t output_center, int16_t output_range) |
Rescales an input voltage to a uint16_t output value. | |
void | calu_transform (CalibrationData cal, double v0, double v1, uint16_t *px, uint16_t *py) |
Transforms voltage values to pixel coordinates based on calibration data. | |
void | calu_update (CalibrationData *cal, uint8_t orientation) |
Updates the calibration data based on orientation. | |
Calibrate and/or transform the potentiometer voltages from each gimbal.
int16_t calu_imax | ( | int16_t | a, |
int16_t | b ) |
Returns the maximum of two int16_t values.
This function returns the maximum of two int16_t values.
a | First int16_t value. |
b | Second int16_t value. |
CalibrationData calu_initCalibrationData | ( | ) |
Initializes a CalibrationData structure with default values.
This function initializes a CalibrationData structure with default values for input transform, voltage range, voltage center, pixel range, and pixel center.
uint16_t calu_rescale | ( | int16_t | input_voltage, |
int16_t | input_center, | ||
int16_t | input_range, | ||
int16_t | output_center, | ||
int16_t | output_range ) |
Rescales an input voltage to a uint16_t output value.
This function rescales an input voltage to a uint16_t output value based on input center, input range, output center, and output range.
input_voltage | The input voltage value (mV) to be rescaled. |
input_center | The center of the input range (mV). |
input_range | The range of the input values (mV). |
output_center | The center of the output range (pixels). |
output_range | The range of the output values (pixels). |
void calu_transform | ( | CalibrationData | cal, |
double | v0, | ||
double | v1, | ||
uint16_t * | px, | ||
uint16_t * | py ) |
Transforms voltage values to pixel coordinates based on calibration data.
This function transforms two voltage values to pixel coordinates using calibration data. It calculates the pixel coordinates (px, py) corresponding to the given voltage values (v0, v1) based on the calibration data (cal).
cal | The CalibrationData structure containing calibration parameters. |
v0 | The first voltage value to transform. |
v1 | The second voltage value to transform. |
px | Pointer to store the resulting pixel coordinate for the first voltage. |
py | Pointer to store the resulting pixel coordinate for the second voltage. |
void calu_update | ( | CalibrationData * | cal, |
uint8_t | orientation ) |
Updates the calibration data based on orientation.
This function updates the calibration data based on the orientation provided. It updates the rotation matrix (R), sign values, and apparent center and range values of the calibration data structure (cal) according to the specified orientation.
cal | Pointer to the CalibrationData structure to be updated. |
orientation | The orientation value (0 or 1) to determine the update. |