magneto11 2.0.0.0
Magneto 11 Click Driver

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

Topics

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

Functions

void magneto11_cfg_setup (magneto11_cfg_t *cfg)
 Magneto 11 configuration object setup function.
 
err_t magneto11_init (magneto11_t *ctx, magneto11_cfg_t *cfg)
 Magneto 11 initialization function.
 
err_t magneto11_default_cfg (magneto11_t *ctx)
 Magneto 11 default configuration function.
 
err_t magneto11_generic_write (magneto11_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Magneto 11 I2C writing function.
 
err_t magneto11_generic_read (magneto11_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Magneto 11 I2C reading function.
 
err_t magneto11_get_magnetic_field (magneto11_t *ctx, float *mag_field)
 Magneto 11 get magnetic field function.
 
err_t magneto11_get_offset (magneto11_t *ctx, uint16_t *offset)
 Magneto 11 get offset function.
 
err_t magneto11_set_config (magneto11_t *ctx, uint8_t config)
 Magneto 11 set config function.
 
err_t magneto11_set_sensitivity (magneto11_t *ctx, uint8_t sensitivity)
 Magneto 11 set sensitivity function.
 

Detailed Description

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

◆ magneto11_cfg_setup()

void magneto11_cfg_setup ( magneto11_cfg_t * cfg)

Magneto 11 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ magneto11_default_cfg()

err_t magneto11_default_cfg ( magneto11_t * ctx)

Magneto 11 default configuration function.

This function executes a default configuration of Magneto 11 click board.

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

◆ magneto11_generic_read()

err_t magneto11_generic_read ( magneto11_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Magneto 11 I2C reading function.

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

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

◆ magneto11_generic_write()

err_t magneto11_generic_write ( magneto11_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Magneto 11 I2C writing function.

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

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

◆ magneto11_get_magnetic_field()

err_t magneto11_get_magnetic_field ( magneto11_t * ctx,
float * mag_field )

Magneto 11 get magnetic field function.

This function reads the magnetic field strength in milliTesla.

Parameters
[in]ctx: Click context object. See magneto11_t object definition for detailed explanation.
[out]mag_field: Magnetic field strength in milliTesla.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneto11_get_offset()

err_t magneto11_get_offset ( magneto11_t * ctx,
uint16_t * offset )

Magneto 11 get offset function.

This function reads the offset register value.

Parameters
[in]ctx: Click context object. See magneto11_t object definition for detailed explanation.
[out]offset: Offset register value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneto11_init()

err_t magneto11_init ( magneto11_t * ctx,
magneto11_cfg_t * cfg )

Magneto 11 initialization function.

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

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

◆ magneto11_set_config()

err_t magneto11_set_config ( magneto11_t * ctx,
uint8_t config )

Magneto 11 set config function.

This function writes specified data to the config register.

Parameters
[in]ctx: Click context object. See magneto11_t object definition for detailed explanation.
[in]config: Config register value [bit 2 - speed mode, bit 1 - polarity, bit 0 - operating mode].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneto11_set_sensitivity()

err_t magneto11_set_sensitivity ( magneto11_t * ctx,
uint8_t sensitivity )

Magneto 11 set sensitivity function.

This function writes specified data to the sensitivity register.

Parameters
[in]ctx: Click context object. See magneto11_t object definition for detailed explanation.
[in]sensitivity:
  • 0 - +-50mT,
  • 1 - +-25mT,
  • 1 - +-12.5mT,
  • 1 - +-18.75mT.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.