|
Infineon One Point 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 | ANALOG_SENSOR_DATA |
| struct | ROTATION_DATA_STORE |
| struct | 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) |
Typedefs | |
| typedef double | float64_t |
| typedef struct ANALOG_SENSOR_DATA | ANALOG_SENSOR_DATA_t |
| typedef struct ROTATION_DATA_STORE | ROTATION_DATA_STORE_t |
| typedef struct CALIB_DATA | CALIB_DATA_t |
Functions | |
| void | ONECALIB_InitSensorData (uint32_t cosP_in_LSB, uint32_t cosN_in_LSB, uint32_t sinP_in_LSB, uint32_t sinN_in_LSB) |
| Function used for ANALOG_SENSOR_DATA_t data assignment. More... | |
| void | ONECALIB_InitCalibData (CALIB_DATA_t *param_store) |
| Function used for CALIB_DATA_t data initialization. The pointer of type CALIB_DATA_t will be used to store calibration parameters. More... | |
| float64_t | ONECALIB_GetAngle (const CALIB_DATA_t *calib_param) |
| Calculates the calibrated angle if calibration has been performed, else the uncalibrated angle. More... | |
| float64_t | ONECALIB_GetUncalibAngle (void) |
| Calculates the uncalibrated angle. More... | |
| float64_t | ONECALIB_GetCalibAngle (const CALIB_DATA_t *calib_param) |
| Calculates the calibrated angle. More... | |
| void | ONECALIB_CalibrationFindParam (CALIB_DATA_t *param_store, bool rotate_CW, bool rotate_CCW) |
| This function is used to extract the calibration parameters. It should called until calib_param.full_calibration_performed is true. To extract the correct rotation, the input parameter rotate_CW should be true until calib_param.rotation_data_CW.calibration_done is true(while the magnet is spinning in CW direction). Same for the CCW direction. While calib_param.full_calibration_performed is false only the differential uncalibrated angle is available. More... | |
| #define ANGLE135 135.00 |
angle position used for the calibration process.
Definition at line 37 of file onecalib.h.
| #define ANGLE135_H ((ANGLE135 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 43 of file onecalib.h.
| #define ANGLE135_L ((ANGLE135 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 44 of file onecalib.h.
| #define ANGLE180_RAD (180.00 * DEG2RADFACTOR) |
angle position in radians used for the calibration process.
Definition at line 34 of file onecalib.h.
| #define ANGLE225 -135.00 |
angle position used for the calibration process.
Definition at line 38 of file onecalib.h.
| #define ANGLE225_H ((ANGLE225 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 45 of file onecalib.h.
| #define ANGLE225_L ((ANGLE225 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 46 of file onecalib.h.
| #define ANGLE315 -45.00 |
angle position used for the calibration process.
Definition at line 39 of file onecalib.h.
| #define ANGLE315_H ((ANGLE315 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 47 of file onecalib.h.
| #define ANGLE315_L ((ANGLE315 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 48 of file onecalib.h.
| #define ANGLE45 45.00 |
angle position used for the calibration process.
Definition at line 36 of file onecalib.h.
| #define ANGLE45_H ((ANGLE45 + ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 41 of file onecalib.h.
| #define ANGLE45_L ((ANGLE45 - ANGLE_TOLERANCE) * DEG2RADFACTOR) |
angle position limit in radians used for the calibration process.
Definition at line 42 of file onecalib.h.
| #define ANGLE_TOLERANCE 0.25 |
tolerance angle used for calibration process.
Definition at line 32 of file onecalib.h.
| #define ANGLE_TOLERANCE_RAD (ANGLE_TOLERANCE * DEG2RADFACTOR) |
tolerance angle in radians used for the calibration process.
Definition at line 33 of file onecalib.h.
| #define DEG2RADFACTOR (M_PI / 180.00) |
Definition at line 31 of file onecalib.h.
| #define RAD2DEGFACTOR (180.00 / M_PI) |
Definition at line 30 of file onecalib.h.
| typedef struct ANALOG_SENSOR_DATA ANALOG_SENSOR_DATA_t |
| typedef struct CALIB_DATA CALIB_DATA_t |
| typedef double float64_t |
Definition at line 50 of file onecalib.h.
| typedef struct ROTATION_DATA_STORE ROTATION_DATA_STORE_t |
| void ONECALIB_CalibrationFindParam | ( | CALIB_DATA_t * | calib_param, |
| bool | rotate_CW, | ||
| bool | rotate_CCW | ||
| ) |
This function is used to extract the calibration parameters. It should called until calib_param.full_calibration_performed is true. To extract the correct rotation, the input parameter rotate_CW should be true until calib_param.rotation_data_CW.calibration_done is true(while the magnet is spinning in CW direction). Same for the CCW direction. While calib_param.full_calibration_performed is false only the differential uncalibrated angle is available.
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.
Usage example:
| [in] | calib_param | is a pointer of type CALIB_DATA_t, this structure holds the current sensor calibration parameters. |
| [in] | rotate_CW | is a bool that is true if the rotation is in clockwise direction. |
| [in] | rotate_CCW | is a bool that is true if the rotation is in counter-clockwise direction. |
Definition at line 468 of file onecalib.c.
References ROTATION_DATA_STORE::calibration_done, and CALIB_DATA::rotation_data_CW.
| float64_t ONECALIB_GetAngle | ( | const CALIB_DATA_t * | calib_param | ) |
Calculates the calibrated angle if calibration has been performed, else the uncalibrated angle.
This function checks the stored calibration parameters and returns a angle value, no matter if the calibration procedure has been performed.
| [in] | calib_param | is a pointer of type CALIB_DATA_t, this structure holds the current sensor calibration parameters. |
Definition at line 372 of file onecalib.c.
| float64_t ONECALIB_GetCalibAngle | ( | const CALIB_DATA_t * | calib_param | ) |
Calculates the calibrated angle.
Don't use this if the calibration procedure has not been performed. This function dosen't check the stored calibration parameters and returns the calibrated angle value.
| [in] | calib_param | is a pointer of type CALIB_DATA_t, this structure holds the current sensor calibration parameters. |
Definition at line 414 of file onecalib.c.
| float64_t ONECALIB_GetUncalibAngle | ( | void | ) |
Calculates the uncalibrated angle.
This function uses differential sensor data to extract the angle.
Definition at line 397 of file onecalib.c.
| void ONECALIB_InitCalibData | ( | CALIB_DATA_t * | calib_param | ) |
Function used for CALIB_DATA_t data initialization. The pointer of type CALIB_DATA_t will be used to store calibration parameters.
This function must be called once before ONECALIB_CalibrationFindParam(..).
| [in] | calib_param | is a pointer of type CALIB_DATA_t. |
Definition at line 301 of file onecalib.c.
| void ONECALIB_InitSensorData | ( | uint32_t | sinP_in_LSB, |
| uint32_t | cosP_in_LSB, | ||
| uint32_t | sinN_in_LSB, | ||
| uint32_t | cosN_in_LSB | ||
| ) |
Function used for 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 242 of file onecalib.c.
1.8.14