magneto12 2.0.0.0
Magneto 12 Click Driver

API for configuring and manipulating Magneto 12 Click driver. More...

Topics

 Magneto 12 Registers Settings
 Settings for registers of Magneto 12 Click driver.
 
 Magneto 12 MikroBUS Map
 MikroBUS pin mapping of Magneto 12 Click driver.
 

Functions

void magneto12_cfg_setup (magneto12_cfg_t *cfg)
 Magneto 12 configuration object setup function.
 
void magneto12_drv_interface_selection (magneto12_cfg_t *cfg, magneto12_drv_t drv_sel)
 Magneto 12 driver interface setup function.
 
err_t magneto12_init (magneto12_t *ctx, magneto12_cfg_t *cfg)
 Magneto 12 initialization function.
 
err_t magneto12_read_raw_adc (magneto12_t *ctx, uint16_t *raw_adc)
 Magneto 12 read raw ADC value function.
 
err_t magneto12_read_voltage (magneto12_t *ctx, float *voltage)
 Magneto 12 read voltage level function.
 
err_t magneto12_set_vref (magneto12_t *ctx, float vref)
 Magneto 12 set vref function.
 
err_t magneto12_read_angle (magneto12_t *ctx, float *angle)
 Magneto 12 read angle function.
 

Detailed Description

API for configuring and manipulating Magneto 12 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

◆ magneto12_cfg_setup()

void magneto12_cfg_setup ( magneto12_cfg_t * cfg)

Magneto 12 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ magneto12_drv_interface_selection()

void magneto12_drv_interface_selection ( magneto12_cfg_t * cfg,
magneto12_drv_t drv_sel )

Magneto 12 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See magneto12_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See magneto12_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ magneto12_init()

err_t magneto12_init ( magneto12_t * ctx,
magneto12_cfg_t * cfg )

Magneto 12 initialization function.

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

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

◆ magneto12_read_angle()

err_t magneto12_read_angle ( magneto12_t * ctx,
float * angle )

Magneto 12 read angle function.

This function reads the sensor output voltage and converts it to angular position in degrees.

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

◆ magneto12_read_raw_adc()

err_t magneto12_read_raw_adc ( magneto12_t * ctx,
uint16_t * raw_adc )

Magneto 12 read raw ADC value function.

This function reads raw ADC value.

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

◆ magneto12_read_voltage()

err_t magneto12_read_voltage ( magneto12_t * ctx,
float * voltage )

Magneto 12 read voltage level function.

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

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

◆ magneto12_set_vref()

err_t magneto12_set_vref ( magneto12_t * ctx,
float vref )

Magneto 12 set vref function.

This function sets the voltage reference for Magneto 12 click driver.

Parameters
[in]ctx: Click context object. See magneto12_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 magneto12_init is 3.3V.