amrangle2 2.1.0.0
AMR Angle 2 Click Driver

API for configuring and manipulating AMR Angle 2 Click driver. More...

Topics

 AMR Angle 2 Registers List
 List of registers of AMR Angle 2 Click driver.
 
 AMR Angle 2 Registers Settings
 Settings for registers of AMR Angle 2 Click driver.
 
 AMR Angle 2 MikroBUS Map
 MikroBUS pin mapping of AMR Angle 2 Click driver.
 

Functions

void amrangle2_cfg_setup (amrangle2_cfg_t *cfg)
 AMR Angle 2 configuration object setup function.
 
err_t amrangle2_init (amrangle2_t *ctx, amrangle2_cfg_t *cfg)
 AMR Angle 2 initialization function.
 
err_t amrangle2_default_cfg (amrangle2_t *ctx)
 AMR Angle 2 default configuration function.
 
err_t amrangle2_spi_transfer (amrangle2_t *ctx, uint16_t data_in)
 AMR Angle 2 spi transfer function.
 
err_t amrangle2_read_an_pin_value (amrangle2_t *ctx, uint16_t *data_out)
 AMR Angle 2 read AN pin value function.
 
err_t amrangle2_read_an_pin_voltage (amrangle2_t *ctx, float *data_out)
 AMR Angle 2 read AN pin voltage level function.
 
err_t amrangle2_calibrate_temperature (amrangle2_t *ctx)
 AMR Angle 2 calibrate temperature function.
 
err_t amrangle2_read_temperature (amrangle2_t *ctx, float *temperature)
 AMR Angle 2 read temperature function.
 
err_t amrangle2_read_vsin_vcos (amrangle2_t *ctx, float *vsin, float *vcos)
 AMR Angle 2 read vsin vcos function.
 
err_t amrangle2_read_angle (amrangle2_t *ctx, float *angle)
 AMR Angle 2 read angle function.
 
void amrangle2_set_cst_pin (amrangle2_t *ctx, uint8_t state)
 AMR Angle 2 set cst pin function.
 
uint8_t amrangle2_get_eoc_pin (amrangle2_t *ctx)
 AMR Angle 2 get eoc pin function.
 
void amrangle2_start_conversion (amrangle2_t *ctx)
 AMR Angle 2 start conversion function.
 

Detailed Description

API for configuring and manipulating AMR Angle 2 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

◆ amrangle2_calibrate_temperature()

err_t amrangle2_calibrate_temperature ( amrangle2_t * ctx)

AMR Angle 2 calibrate temperature function.

This function calibrates the temperature readings (ctx->vcal) to the known room temperature in Celsius (AMRANGLE2_TEMP_TCAL).

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Adjust the value of macro AMRANGLE2_TEMP_TCAL to the known room temperature for correct calibration.

◆ amrangle2_cfg_setup()

void amrangle2_cfg_setup ( amrangle2_cfg_t * cfg)

AMR Angle 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ amrangle2_default_cfg()

err_t amrangle2_default_cfg ( amrangle2_t * ctx)

AMR Angle 2 default configuration function.

This function executes a default configuration of AMR Angle 2 click board.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ amrangle2_get_eoc_pin()

uint8_t amrangle2_get_eoc_pin ( amrangle2_t * ctx)

AMR Angle 2 get eoc pin function.

This function returns the conversion end (EOC) pin logic state.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ amrangle2_init()

err_t amrangle2_init ( amrangle2_t * ctx,
amrangle2_cfg_t * cfg )

AMR Angle 2 initialization function.

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

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

◆ amrangle2_read_an_pin_value()

err_t amrangle2_read_an_pin_value ( amrangle2_t * ctx,
uint16_t * data_out )

AMR Angle 2 read AN pin value function.

This function reads results of AD conversion of the AN pin.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
[out]data_out: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amrangle2_read_an_pin_voltage()

err_t amrangle2_read_an_pin_voltage ( amrangle2_t * ctx,
float * data_out )

AMR Angle 2 read AN pin voltage level function.

This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
[out]data_out: Output voltage level of the analog pin [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ amrangle2_read_angle()

err_t amrangle2_read_angle ( amrangle2_t * ctx,
float * angle )

AMR Angle 2 read angle function.

This function reads a Vsin and Vcos voltages and converts them to angle in Degrees.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
[out]angle: Angular position in degrees.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amrangle2_read_temperature()

err_t amrangle2_read_temperature ( amrangle2_t * ctx,
float * temperature )

AMR Angle 2 read temperature function.

This function reads a temperature measurements in Celsius.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
[out]temperature: Temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amrangle2_read_vsin_vcos()

err_t amrangle2_read_vsin_vcos ( amrangle2_t * ctx,
float * vsin,
float * vcos )

AMR Angle 2 read vsin vcos function.

This function reads a voltage of sine and cosine differential signal outputs.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
[out]vsin: Sine voltage.
[out]vcos: Cosine voltage.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amrangle2_set_cst_pin()

void amrangle2_set_cst_pin ( amrangle2_t * ctx,
uint8_t state )

AMR Angle 2 set cst pin function.

This function sets the conversion start (CST) pin logic state.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ amrangle2_spi_transfer()

err_t amrangle2_spi_transfer ( amrangle2_t * ctx,
uint16_t data_in )

AMR Angle 2 spi transfer function.

This function writes and reads a word of data simultaneously by using SPI serial interface.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
[in]data_in: Data to be written.
Returns
  • >=0 - 16-bit data read,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ amrangle2_start_conversion()

void amrangle2_start_conversion ( amrangle2_t * ctx)

AMR Angle 2 start conversion function.

This function starts the conversion and waits for the end of conversion indication.

Parameters
[in]ctx: Click context object. See amrangle2_t object definition for detailed explanation.
Returns
None.
Note
None.