CalibrationUtilities 1.0.4
A small compiled C library for handling cursor calibration operations.
Loading...
Searching...
No Matches
Main Calibration Tools

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.
 

Detailed Description

Calibrate and/or transform the potentiometer voltages from each gimbal.

Function Documentation

◆ calu_imax()

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.

Parameters
aFirst int16_t value.
bSecond int16_t value.
Returns
The maximum of a and b.

◆ calu_initCalibrationData()

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.

Returns
The initialized CalibrationData structure.

◆ calu_rescale()

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.

Parameters
input_voltageThe input voltage value (mV) to be rescaled.
input_centerThe center of the input range (mV).
input_rangeThe range of the input values (mV).
output_centerThe center of the output range (pixels).
output_rangeThe range of the output values (pixels).
Returns
The rescaled uint16_t output value.

◆ calu_transform()

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).

Parameters
calThe CalibrationData structure containing calibration parameters.
v0The first voltage value to transform.
v1The second voltage value to transform.
pxPointer to store the resulting pixel coordinate for the first voltage.
pyPointer to store the resulting pixel coordinate for the second voltage.

◆ calu_update()

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.

Parameters
calPointer to the CalibrationData structure to be updated.
orientationThe orientation value (0 or 1) to determine the update.