tmrangle 2.0.0.0
tmrangle.h File Reference

This file contains API for TMR Angle Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  tmrangle_analog_sensor_data_t
 Click ctx object definition. More...
 
struct  tmrangle_t
 
struct  tmrangle_cfg_t
 Click configuration structure definition. More...
 
struct  tmrangle_rotation_data_store_t
 
struct  tmrangle_calib_data_t
 
struct  trigonometry_t
 

Macros

#define TMRANGLE_MAP_MIKROBUS(cfg, mikrobus)
 
#define TMRANGLE_RETVAL   uint8_t
 
#define TMRANGLE_OK   0x00
 
#define TMRANGLE_INIT_ERROR   0xFF
 
#define TMRANGLE_COS_N   0x00
 
#define TMRANGLE_COS_P   0x01
 
#define TMRANGLE_SIN_P   0x02
 
#define TMRANGLE_SIN_N   0x03
 
#define TMRANGLE_RAD2DEGFACTOR   57.3248
 
#define TMRANGLE_ROTATION_VALID   1
 
#define TMRANGLE_ANGLE45_H   0.7894
 
#define TMRANGLE_ANGLE45_L   0.7806
 
#define TMRANGLE_ANGLE135_H   2.3594
 
#define TMRANGLE_ANGLE135_L   2.3506
 
#define TMRANGLE_MAX_DIFF_SIN   1251
 
#define TMRANGLE_MAX_DIFF_COS   1217
 
#define TMRANGLE_MIN_DIFF_SIN   -1200
 
#define TMRANGLE_MIN_DIFF_COS   -1206
 
#define TMRANGLE_SIN_45   854.0
 
#define TMRANGLE_COS_45   864.0
 
#define TMRANGLE_SIN_135   873.0
 
#define TMRANGLE_COS_135   -865.0
 

Functions

void tmrangle_cfg_setup (tmrangle_cfg_t *cfg)
 Config Object Initialization function.
 
TMRANGLE_RETVAL tmrangle_init (tmrangle_t *ctx, tmrangle_cfg_t *cfg)
 Initialization function.
 
uint16_t tmrangle_read_channel_adc (tmrangle_t *ctx, uint8_t channel)
 Read the ADC value of the selected channel function.
 
void tmrangle_calculate_diff (tmrangle_t *ctx)
 Calculate the differential values of sin,cos signal and angle function.
 
void tmrangle_init_sensor_data (tmrangle_t *ctx)
 Read and stores parameters data function.
 
void tmrangle_calib_calculate_one_direction (tmrangle_t *ctx, tmrangle_rotation_data_store_t *rotation_data_store)
 Calculates and stores parameters, based on found parameters function.
 
void tmrangle_calib_calculate_ortho (tmrangle_calib_data_t *calib_param)
 Calculates and stores parameters, based on found parameters from both CW and CCW function.
 
void tmrangle_init_calib_data (tmrangle_t *ctx, tmrangle_calib_data_t *calib_param, trigonometry_t *dev)
 Initialization and stores calibration parameters function.
 
float tmrangle_get_calib_deff_angle (tmrangle_t *ctx, tmrangle_calib_data_t *calib_param)
 Calculate the calibrated angle ( radians ) function.
 
float tmrangle_get_calib_angle (tmrangle_t *ctx, tmrangle_calib_data_t *calib_param)
 Calculate the calibrated angle ( degree ) function.
 
void tmrangle_calib_find_min_max (tmrangle_t *ctx, tmrangle_rotation_data_store_t *rotation_data_store)
 Compare and stores rotation parameters function.
 
void tmrangle_calib_one_direction_min_max (tmrangle_t *ctx, tmrangle_rotation_data_store_t *rotation_data_store)
 Find and stores rotation parameters ( min, max ) function.
 
void tmrangle_calibration_find_param (tmrangle_t *ctx, tmrangle_calib_data_t *calib_param)
 Get new calibration rotation parameters function.
 

Detailed Description

This file contains API for TMR Angle Click driver.