|
Infineon OnGoing Calibration Library
1.0.1
|
#include <stdint.h>#include <stdbool.h>#include <math.h>

Go to the source code of this file.
Data Structures | |
| struct | ONGO_ANALOG_SENSOR_DATA |
| struct | ONGO_ROTATION_DATA_STORE |
| struct | ONGO_CALIB_DATA |
Macros | |
| #define | RAD2DEGFACTOR (180.00 / M_PI) |
| #define | DEG2RADFACTOR (M_PI / 180.00) |
| #define | ANGLE_TOLERANCE 0.25 |
| #define | ANGLE_TOLERANCE_RAD (ANGLE_TOLERANCE * DEG2RADFACTOR) |
| #define | ANGLE180_RAD (180.00 * DEG2RADFACTOR) |
| #define | ANGLE45 45.00 |
| #define | ANGLE135 135.00 |
| #define | ANGLE225 -135.00 |
| #define | ANGLE315 -45.00 |
| #define | ANGLE45_H ((ANGLE45 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ANGLE45_L ((ANGLE45 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ANGLE135_H ((ANGLE135 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ANGLE135_L ((ANGLE135 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ANGLE225_H ((ANGLE225 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ANGLE225_L ((ANGLE225 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ANGLE315_H ((ANGLE315 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ANGLE315_L ((ANGLE315 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
| #define | ROTATION_VALID 1u |
Typedefs | |
| typedef double | float64_t |
| typedef struct ONGO_ANALOG_SENSOR_DATA | ONGO_ANALOG_SENSOR_DATA_t |
| typedef struct ONGO_ROTATION_DATA_STORE | ONGO_ROTATION_DATA_STORE_t |
| typedef struct ONGO_CALIB_DATA | ONGO_CALIB_DATA_t |
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 *param_store) |
| This function is used to find new calibration parameters. More... | |
| #define ANGLE135 135.00 |
angle position used for the calibration process.
Definition at line 35 of file ongocalib.h.
| #define ANGLE135_H ((ANGLE135 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 41 of file ongocalib.h.
| #define ANGLE135_L ((ANGLE135 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 42 of file ongocalib.h.
| #define ANGLE180_RAD (180.00 * DEG2RADFACTOR) |
angle position in radians used for the calibration process.
Definition at line 32 of file ongocalib.h.
| #define ANGLE225 -135.00 |
angle position used for the calibration process.
Definition at line 36 of file ongocalib.h.
| #define ANGLE225_H ((ANGLE225 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 43 of file ongocalib.h.
| #define ANGLE225_L ((ANGLE225 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 44 of file ongocalib.h.
| #define ANGLE315 -45.00 |
angle position used for the calibration process.
Definition at line 37 of file ongocalib.h.
| #define ANGLE315_H ((ANGLE315 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 45 of file ongocalib.h.
| #define ANGLE315_L ((ANGLE315 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 46 of file ongocalib.h.
| #define ANGLE45 45.00 |
angle position used for the calibration process.
Definition at line 34 of file ongocalib.h.
| #define ANGLE45_H ((ANGLE45 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 39 of file ongocalib.h.
| #define ANGLE45_L ((ANGLE45 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 40 of file ongocalib.h.
| #define ANGLE_TOLERANCE 0.25 |
tolerance angle used for calibration process.
Definition at line 30 of file ongocalib.h.
| #define ANGLE_TOLERANCE_RAD (ANGLE_TOLERANCE * DEG2RADFACTOR) |
tolerance angle in radians used for the calibration process.
Definition at line 31 of file ongocalib.h.
| #define DEG2RADFACTOR (M_PI / 180.00) |
Definition at line 29 of file ongocalib.h.
| #define RAD2DEGFACTOR (180.00 / M_PI) |
Definition at line 28 of file ongocalib.h.
| #define ROTATION_VALID 1u |
Definition at line 48 of file ongocalib.h.
| typedef double float64_t |
Definition at line 50 of file ongocalib.h.
| typedef struct ONGO_ANALOG_SENSOR_DATA ONGO_ANALOG_SENSOR_DATA_t |
| typedef struct ONGO_CALIB_DATA ONGO_CALIB_DATA_t |
| typedef struct ONGO_ROTATION_DATA_STORE ONGO_ROTATION_DATA_STORE_t |
| 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.
| [in] | calib_param | is a pointer of type ONGO_CALIB_DATA_t, this structure holds the current sensor calibration parameters. |
Definition at line 353 of file ongocalib.c.
| float64_t ONGO_GetCalibAngle | ( | const ONGO_CALIB_DATA_t * | calib_param | ) |
Calculates the calibrated angle.
| [in] | calib_param | is a pointer of type ONGO_CALIB_DATA_t, this structure holds the current sensor calibration parameters. |
Definition at line 337 of file ongocalib.c.
| float64_t ONGO_GetUncalibAngle | ( | void | ) |
Calculates the uncalibrated angle.
This function uses differential sensor data to extract the angle.
Definition at line 325 of file ongocalib.c.
| 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(..).
| [in] | calib_param | is a pointer of type ONGO_CALIB_DATA_t. |
| [in] | max_diff_sin_LSB | is the maximum differential sin signal in LSB. |
| [in] | max_diff_cos_LSB | is the maximum differential cos signal in LSB. |
| [in] | min_diff_sin_LSB | is the minimum differential sin signal in LSB. |
| [in] | min_diff_cos_LSB | is the minimum differential cos signal in LSB. |
| [in] | sin_45 | is the differential sin component in LSB at a 45 deg position. |
| [in] | cos_45 | is the differential cos component in LSB at a 45 deg position. |
| [in] | sin_135 | is the differential sin component in LSB at a 135 deg position. |
| [in] | cos_135 | is the differential cos component in LSB at a 135 deg position. |
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.
| 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(..).
| [in] | calib_param | is a pointer of type ONGO_CALIB_DATA_t. |
| [in] | max_SinP_LSB | is the maximum P channel sin signal in LSB. |
| [in] | max_CosP_LSB | is the maximum P channel cos signal in LSB. |
| [in] | max_SinN_LSB | is the maximum N channel sin signal in LSB. |
| [in] | max_CosN_LSB | is the maximum N channel cos signal in LSB. |
| [in] | min_SinP_LSB | is the minimum P channel sin signal in LSB. |
| [in] | min_CosP_LSB | is the minimum P channel cos signal in LSB. |
| [in] | min_SinN_LSB | is the minimum N channel sin signal in LSB. |
| [in] | min_CosN_LSB | is the minimum N channel cos signal in LSB. |
| [in] | sin_45 | is the differential sin component in LSB at a 45 deg position. |
| [in] | cos_45 | is the differential cos component in LSB at a 45 deg position. |
| [in] | sin_135 | is the differential sin component in LSB at a 135 deg position. |
| [in] | cos_135 | is the differential cos component in LSB at a 135 deg position. |
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.
| 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.
| [in] | cosP_in_LSB | is the sensor value in LSB corresponding to the positive cosinus. |
| [in] | cosN_in_LSB | is the sensor value in LSB corresponding to the negative cosinus. |
| [in] | sinP_in_LSB | is the sensor value in LSB corresponding to the positive sinus. |
| [in] | sinN_in_LSB | is the sensor value in LSB corresponding to the negative sinus. |
Definition at line 164 of file ongocalib.c.
1.8.14