mrangle 2.0.0.0
MR Angle Click Driver

API for configuring and manipulating MR Angle Click driver. More...

Topics

 MR Angle MikroBUS Map
 MikroBUS pin mapping of MR Angle Click driver.
 

Functions

void mrangle_cfg_setup (mrangle_cfg_t *cfg)
 MR Angle configuration object setup function.
 
err_t mrangle_init (mrangle_t *ctx, mrangle_cfg_t *cfg)
 MR Angle initialization function.
 
void mrangle_default_cfg (mrangle_t *ctx)
 MR Angle default configuration function.
 
void mrangle_powerdown_mode (mrangle_t *ctx, mrangle_powerdown_mode_value_t pd_mode)
 MR Angle powerdown mode function.
 
void mrangle_output_mode (mrangle_t *ctx, mrangle_output_mode_value_t output_mode)
 MR Angle output mode function.
 
err_t mrangle_generic_write (mrangle_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 MR Angle data writing function.
 
err_t mrangle_generic_read (mrangle_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 MR Angle data reading function.
 
err_t mrangle_get_adc_sin (mrangle_t *ctx, uint16_t *sin_adc)
 MR Angle get ADC sine function.
 
err_t mrangle_get_sin (mrangle_t *ctx, float *sin)
 MR Angle get sine function.
 
err_t mrangle_get_adc_cos (mrangle_t *ctx, uint16_t *cos_adc)
 MR Angle get ADC cosine function.
 
err_t mrangle_get_cos (mrangle_t *ctx, float *cos)
 MR Angle get cosine function.
 
err_t mrangle_get_adc_temp (mrangle_t *ctx, uint16_t *temp_adc)
 MR Angle get ADC temperature function.
 
err_t mrangle_get_temperature (mrangle_t *ctx, float *temperature)
 MR Angle get temperature function.
 
err_t mrangle_get_angle (mrangle_t *ctx, float *angle)
 MR Angle get angle function.
 

Detailed Description

API for configuring and manipulating MR Angle Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ mrangle_cfg_setup()

void mrangle_cfg_setup ( mrangle_cfg_t * cfg)

MR Angle configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See mrangle_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ mrangle_default_cfg()

void mrangle_default_cfg ( mrangle_t * ctx)

MR Angle default configuration function.

This function executes a default configuration of MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
Returns
None.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ mrangle_generic_read()

err_t mrangle_generic_read ( mrangle_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

MR Angle data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_generic_write()

err_t mrangle_generic_write ( mrangle_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

MR Angle data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_get_adc_cos()

err_t mrangle_get_adc_cos ( mrangle_t * ctx,
uint16_t * cos_adc )

MR Angle get ADC cosine function.

This function reads a cosine ADC value of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[out]cos_adc: Pointer to the memory location of the structure where data be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_get_adc_sin()

err_t mrangle_get_adc_sin ( mrangle_t * ctx,
uint16_t * sin_adc )

MR Angle get ADC sine function.

This function reads a sine ADC value of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[out]sin_adc: Pointer to the memory location of the structure where data be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_get_adc_temp()

err_t mrangle_get_adc_temp ( mrangle_t * ctx,
uint16_t * temp_adc )

MR Angle get ADC temperature function.

This function reads a temperature ADC value of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[out]temp_adc: Pointer to the memory location of the structure where data be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_get_angle()

err_t mrangle_get_angle ( mrangle_t * ctx,
float * angle )

MR Angle get angle function.

This function reads a angle data ( degree ) of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[out]angle: Pointer to the memory location of the structure where data be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_get_cos()

err_t mrangle_get_cos ( mrangle_t * ctx,
float * cos )

MR Angle get cosine function.

This function reads a cosine ADC value and calculate cosine output signal amplitude of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[out]cos: Pointer to the memory location of the structure where data be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_get_sin()

err_t mrangle_get_sin ( mrangle_t * ctx,
float * sin )

MR Angle get sine function.

This function reads a sine ADC value and calculate sine output signal amplitude of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[out]sin: Pointer to the memory location of the structure where data be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_get_temperature()

err_t mrangle_get_temperature ( mrangle_t * ctx,
float * temperature )

MR Angle get temperature function.

This function reads a temperature data ( degree Celsius ) of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[out]temperature: Pointer to the memory location of the structure where data be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_init()

err_t mrangle_init ( mrangle_t * ctx,
mrangle_cfg_t * cfg )

MR Angle initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See mrangle_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ mrangle_output_mode()

void mrangle_output_mode ( mrangle_t * ctx,
mrangle_output_mode_value_t output_mode )

MR Angle output mode function.

This function output mode switches to the desired device output mode sine and cosine output mode or temperature output mode of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[in]output_mode: Enum values for data output mode.
Returns
None.
Note
None.

◆ mrangle_powerdown_mode()

void mrangle_powerdown_mode ( mrangle_t * ctx,
mrangle_powerdown_mode_value_t pd_mode )

MR Angle powerdown mode function.

This function powerdown mode switches the device into Power-down mode or Power-up mode of the KMZ60 Angle sensor with integrated amplifier on the MR Angle click board™.

Parameters
[in]ctx: Click context object. See mrangle_t object definition for detailed explanation.
[in]pd_mode: Enum values for powerdown mode.
Returns
None.
Note
None.