magneticrotary5 2.1.0.0
Magnetic Rotary 5 Click Driver

API for configuring and manipulating Magnetic Rotary 5 Click driver. More...

Topics

 Magnetic Rotary 5 Registers List
 List of registers of Magnetic Rotary 5 Click driver.
 
 Magnetic Rotary 5 Registers Settings
 Settings for registers of Magnetic Rotary 5 Click driver.
 
 Magnetic Rotary 5 MikroBUS Map
 MikroBUS pin mapping of Magnetic Rotary 5 Click driver.
 

Functions

void magneticrotary5_cfg_setup (magneticrotary5_cfg_t *cfg)
 Magnetic Rotary 5 configuration object setup function.
 
err_t magneticrotary5_init (magneticrotary5_t *ctx, magneticrotary5_cfg_t *cfg)
 Magnetic Rotary 5 initialization function.
 
err_t magneticrotary5_default_cfg (magneticrotary5_t *ctx)
 Magnetic Rotary 5 default configuration function.
 
err_t magneticrotary5_write_cmd (magneticrotary5_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
 Magnetic Rotary 5 write cmd function.
 
err_t magneticrotary5_read_cmd (magneticrotary5_t *ctx, uint8_t cmd, uint8_t *data_out, uint8_t len)
 Magnetic Rotary 5 read cmd function.
 
err_t magneticrotary5_read_angle (magneticrotary5_t *ctx, uint8_t *agc, uint16_t *angle)
 Magnetic Rotary 5 read angle function.
 
err_t magneticrotary5_read_mt_cnt (magneticrotary5_t *ctx, int16_t *mt_cnt)
 Magnetic Rotary 5 read multi turn counter function.
 
err_t magneticrotary5_set_mt_cnt (magneticrotary5_t *ctx, int16_t mt_cnt)
 Magnetic Rotary 5 set multi turn counter function.
 
err_t magneticrotary5_read_raw_adc (magneticrotary5_t *ctx, uint16_t *raw_adc)
 Magnetic Rotary 5 read raw ADC value function.
 
err_t magneticrotary5_read_voltage (magneticrotary5_t *ctx, float *voltage)
 Magnetic Rotary 5 read voltage level function.
 
err_t magneticrotary5_set_vref (magneticrotary5_t *ctx, float vref)
 Magnetic Rotary 5 set vref function.
 

Detailed Description

API for configuring and manipulating Magnetic Rotary 5 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

◆ magneticrotary5_cfg_setup()

void magneticrotary5_cfg_setup ( magneticrotary5_cfg_t * cfg)

Magnetic Rotary 5 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ magneticrotary5_default_cfg()

err_t magneticrotary5_default_cfg ( magneticrotary5_t * ctx)

Magnetic Rotary 5 default configuration function.

This function executes a default configuration of Magnetic Rotary 5 click board.

Parameters
[in]ctx: Click context object. See magneticrotary5_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.

◆ magneticrotary5_init()

err_t magneticrotary5_init ( magneticrotary5_t * ctx,
magneticrotary5_cfg_t * cfg )

Magnetic Rotary 5 initialization function.

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

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

◆ magneticrotary5_read_angle()

err_t magneticrotary5_read_angle ( magneticrotary5_t * ctx,
uint8_t * agc,
uint16_t * angle )

Magnetic Rotary 5 read angle function.

This function reads the magnetic angle and automatic gain control (AGC) values measured by the sensor.

Parameters
[in]ctx: Click context object. See magneticrotary5_t object definition for detailed explanation.
[out]agc: Automatic gain control (AGC) value [0,63].
[out]angle: Magnetic angle in degrees [0,360].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneticrotary5_read_cmd()

err_t magneticrotary5_read_cmd ( magneticrotary5_t * ctx,
uint8_t cmd,
uint8_t * data_out,
uint8_t len )

Magnetic Rotary 5 read cmd function.

This function reads a desired number of data bytes from the selected command by using SSI serial interface bit banging.

Parameters
[in]ctx: Click context object. See magneticrotary5_t object definition for detailed explanation.
[in]cmd: Command byte (5-bits).
[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.

◆ magneticrotary5_read_mt_cnt()

err_t magneticrotary5_read_mt_cnt ( magneticrotary5_t * ctx,
int16_t * mt_cnt )

Magnetic Rotary 5 read multi turn counter function.

This function reads the multi turn counter value. With each zero transition in any direction, the output of a special counter is incremented or decremented.

Parameters
[in]ctx: Click context object. See magneticrotary5_t object definition for detailed explanation.
[out]mt_cnt: Multi turn counter value [-256,255].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneticrotary5_read_raw_adc()

err_t magneticrotary5_read_raw_adc ( magneticrotary5_t * ctx,
uint16_t * raw_adc )

Magnetic Rotary 5 read raw ADC value function.

This function reads raw ADC value.

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

◆ magneticrotary5_read_voltage()

err_t magneticrotary5_read_voltage ( magneticrotary5_t * ctx,
float * voltage )

Magnetic Rotary 5 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See magneticrotary5_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ magneticrotary5_set_mt_cnt()

err_t magneticrotary5_set_mt_cnt ( magneticrotary5_t * ctx,
int16_t mt_cnt )

Magnetic Rotary 5 set multi turn counter function.

This function sets the multi turn counter value. The initial value after reset is 0 LSB.

Parameters
[in]ctx: Click context object. See magneticrotary5_t object definition for detailed explanation.
[in]mt_cnt: Multi turn counter value [-256,255].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneticrotary5_set_vref()

err_t magneticrotary5_set_vref ( magneticrotary5_t * ctx,
float vref )

Magnetic Rotary 5 set vref function.

This function sets the voltage reference for Magnetic Rotary 5 click driver.

Parameters
[in]ctx: Click context object. See magneticrotary5_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with magneticrotary5_init is 3.3V.

◆ magneticrotary5_write_cmd()

err_t magneticrotary5_write_cmd ( magneticrotary5_t * ctx,
uint8_t cmd,
uint8_t * data_in,
uint8_t len )

Magnetic Rotary 5 write cmd function.

This function writes a desired number of data bytes to the selected command by using SSI serial interface bit banging.

Parameters
[in]ctx: Click context object. See magneticrotary5_t object definition for detailed explanation.
[in]cmd: Command byte (5-bits).
[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.