Infineon OnGoing Calibration Library  1.0.1
Functions
ongocalib.c File Reference
#include "ongocalib.h"
Include dependency graph for ongocalib.c:

Go to the source code of this file.

Functions

void ONGO_InitSensorData (uint32_t sinP_in_LSB, uint32_t cosP_in_LSB, uint32_t sinN_in_LSB, uint32_t cosN_in_LSB)
 Function used for ONGO_ANALOG_SENSOR_DATA_t data assignment. More...
 
void ONGO_InitCalibData (ONGO_CALIB_DATA_t *calib_param, int32_t max_diff_sin_LSB, int32_t max_diff_cos_LSB, int32_t min_diff_sin_LSB, int32_t min_diff_cos_LSB, float64_t sin_45, float64_t cos_45, float64_t sin_135, float64_t cos_135)
 Function used for ONGO_CALIB_DATA_t data initialization. The pointer of type ONGO_CALIB_DATA_t will be used to store calibration parameters. More...
 
void ONGO_InitCalibData2 (ONGO_CALIB_DATA_t *calib_param, int32_t max_SinP_LSB, int32_t max_CosP_LSB, int32_t max_SinN_LSB, int32_t max_CosN_LSB, int32_t min_SinP_LSB, int32_t min_CosP_LSB, int32_t min_SinN_LSB, int32_t min_CosN_LSB, float64_t sin_45, float64_t cos_45, float64_t sin_135, float64_t cos_135)
 Function used for ONGO_CALIB_DATA_t data initialization. The pointer of type ONGO_CALIB_DATA_t will be used to store calibration parameters. More...
 
float64_t ONGO_GetUncalibAngle (void)
 Calculates the uncalibrated angle. More...
 
float64_t ONGO_GetCalibAngle (const ONGO_CALIB_DATA_t *calib_param)
 Calculates the calibrated angle. More...
 
void ONGO_CalibrationFindParam (ONGO_CALIB_DATA_t *calib_param)
 This function is used to find new calibration parameters. More...
 

Function Documentation

◆ ONGO_CalibrationFindParam()

void ONGO_CalibrationFindParam ( ONGO_CALIB_DATA_t *  calib_param)

This function is used to find new calibration parameters.

When new calibration parameters have been found, this function will do mathematical calculations, which will take more time for one moment. This function will extract the maximum, minimum voltage levels, amplitude, offset, and orthogonality. Based on the found values, it will calculate the necessary calibration parameters.

Parameters
[in]calib_paramis a pointer of type ONGO_CALIB_DATA_t, this structure holds the current sensor calibration parameters.
Returns
Nothing

Definition at line 353 of file ongocalib.c.

◆ ONGO_GetCalibAngle()

float64_t ONGO_GetCalibAngle ( const ONGO_CALIB_DATA_t *  calib_param)

Calculates the calibrated angle.

Parameters
[in]calib_paramis a pointer of type ONGO_CALIB_DATA_t, this structure holds the current sensor calibration parameters.
Returns
Returns the calibrated angle in degrees.

Definition at line 337 of file ongocalib.c.

◆ ONGO_GetUncalibAngle()

float64_t ONGO_GetUncalibAngle ( void  )

Calculates the uncalibrated angle.

This function uses differential sensor data to extract the angle.

Returns
Returns the uncalibrated angle in degrees.

Definition at line 325 of file ongocalib.c.

◆ ONGO_InitCalibData()

void ONGO_InitCalibData ( ONGO_CALIB_DATA_t *  calib_param,
int32_t  max_diff_sin_LSB,
int32_t  max_diff_cos_LSB,
int32_t  min_diff_sin_LSB,
int32_t  min_diff_cos_LSB,
float64_t  sin_45,
float64_t  cos_45,
float64_t  sin_135,
float64_t  cos_135 
)

Function used for ONGO_CALIB_DATA_t data initialization. The pointer of type ONGO_CALIB_DATA_t will be used to store calibration parameters.

This function must be called once before ONGO_CalibrationFindParam(..). Use this or ONGO_InitCalibData2(..).

Parameters
[in]calib_paramis a pointer of type ONGO_CALIB_DATA_t.
[in]max_diff_sin_LSBis the maximum differential sin signal in LSB.
[in]max_diff_cos_LSBis the maximum differential cos signal in LSB.
[in]min_diff_sin_LSBis the minimum differential sin signal in LSB.
[in]min_diff_cos_LSBis the minimum differential cos signal in LSB.
[in]sin_45is the differential sin component in LSB at a 45 deg position.
[in]cos_45is the differential cos component in LSB at a 45 deg position.
[in]sin_135is the differential sin component in LSB at a 135 deg position.
[in]cos_135is the differential cos component in LSB at a 135 deg position.
Returns
Nothing

Definition at line 200 of file ongocalib.c.

References ONGO_ROTATION_DATA_STORE::angle135found, ONGO_ROTATION_DATA_STORE::angle45found, ONGO_ROTATION_DATA_STORE::maxCos, ONGO_ROTATION_DATA_STORE::maxSin, ONGO_ROTATION_DATA_STORE::minCos, ONGO_ROTATION_DATA_STORE::minSin, ONGO_ROTATION_DATA_STORE::nr_valid_rotations, ONGO_CALIB_DATA::rotation_data, ONGO_ROTATION_DATA_STORE::X135, ONGO_ROTATION_DATA_STORE::X45, ONGO_ROTATION_DATA_STORE::Y135, and ONGO_ROTATION_DATA_STORE::Y45.

◆ ONGO_InitCalibData2()

void ONGO_InitCalibData2 ( ONGO_CALIB_DATA_t *  calib_param,
int32_t  max_SinP_LSB,
int32_t  max_CosP_LSB,
int32_t  max_SinN_LSB,
int32_t  max_CosN_LSB,
int32_t  min_SinP_LSB,
int32_t  min_CosP_LSB,
int32_t  min_SinN_LSB,
int32_t  min_CosN_LSB,
float64_t  sin_45,
float64_t  cos_45,
float64_t  sin_135,
float64_t  cos_135 
)

Function used for ONGO_CALIB_DATA_t data initialization. The pointer of type ONGO_CALIB_DATA_t will be used to store calibration parameters.

This function must be called once before ONGO_CalibrationFindParam(..). Use this or ONGO_InitCalibData(..).

Parameters
[in]calib_paramis a pointer of type ONGO_CALIB_DATA_t.
[in]max_SinP_LSBis the maximum P channel sin signal in LSB.
[in]max_CosP_LSBis the maximum P channel cos signal in LSB.
[in]max_SinN_LSBis the maximum N channel sin signal in LSB.
[in]max_CosN_LSBis the maximum N channel cos signal in LSB.
[in]min_SinP_LSBis the minimum P channel sin signal in LSB.
[in]min_CosP_LSBis the minimum P channel cos signal in LSB.
[in]min_SinN_LSBis the minimum N channel sin signal in LSB.
[in]min_CosN_LSBis the minimum N channel cos signal in LSB.
[in]sin_45is the differential sin component in LSB at a 45 deg position.
[in]cos_45is the differential cos component in LSB at a 45 deg position.
[in]sin_135is the differential sin component in LSB at a 135 deg position.
[in]cos_135is the differential cos component in LSB at a 135 deg position.
Returns
Nothing

Definition at line 258 of file ongocalib.c.

References ONGO_ROTATION_DATA_STORE::angle135found, ONGO_ROTATION_DATA_STORE::angle45found, ONGO_ROTATION_DATA_STORE::maxCos, ONGO_ROTATION_DATA_STORE::maxSin, ONGO_ROTATION_DATA_STORE::minCos, ONGO_ROTATION_DATA_STORE::minSin, ONGO_ROTATION_DATA_STORE::nr_valid_rotations, ONGO_CALIB_DATA::rotation_data, ONGO_ROTATION_DATA_STORE::X135, ONGO_ROTATION_DATA_STORE::X45, ONGO_ROTATION_DATA_STORE::Y135, and ONGO_ROTATION_DATA_STORE::Y45.

◆ ONGO_InitSensorData()

void ONGO_InitSensorData ( uint32_t  sinP_in_LSB,
uint32_t  cosP_in_LSB,
uint32_t  sinN_in_LSB,
uint32_t  cosN_in_LSB 
)

Function used for ONGO_ANALOG_SENSOR_DATA_t data assignment.

This function must be called after the data readout.

The initialized pointer will be used in the angle calculation and calibration process.

Parameters
[in]cosP_in_LSBis the sensor value in LSB corresponding to the positive cosinus.
[in]cosN_in_LSBis the sensor value in LSB corresponding to the negative cosinus.
[in]sinP_in_LSBis the sensor value in LSB corresponding to the positive sinus.
[in]sinN_in_LSBis the sensor value in LSB corresponding to the negative sinus.
Returns
Nothing

Definition at line 164 of file ongocalib.c.