magneto13 2.1.0.0
Magneto 13 Click Driver

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

Topics

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

Functions

void magneto13_cfg_setup (magneto13_cfg_t *cfg)
 Magneto 13 configuration object setup function.
 
err_t magneto13_init (magneto13_t *ctx, magneto13_cfg_t *cfg)
 Magneto 13 initialization function.
 
err_t magneto13_default_cfg (magneto13_t *ctx)
 Magneto 13 default configuration function.
 
err_t magneto13_write_reg (magneto13_t *ctx, uint8_t cmd, uint8_t reg, uint8_t data_in)
 Magneto 13 data writing function.
 
err_t magneto13_read_reg (magneto13_t *ctx, uint8_t cmd, uint8_t reg, uint8_t *data_out)
 Magneto 13 data reading function.
 
err_t magneto13_get_angle_raw_data (magneto13_t *ctx, uint16_t *raw_data)
 Magneto 13 gets the angle raw data function.
 
err_t magneto13_get_angle (magneto13_t *ctx, float *angle)
 Magneto 13 gets the angular position function.
 
err_t magneto13_set_mag_field_thd (magneto13_t *ctx, uint8_t mglt, uint8_t mght)
 Magneto 13 sets the magnetic field threshold function.
 
err_t magneto13_enable_fld_thd_det (magneto13_t *ctx)
 Magneto 13 enables the magnetic field threshold detection function.
 
err_t magneto13_get_field_strength (magneto13_t *ctx, uint8_t *field_strength)
 Magneto 13 gets the magnetic field strength function.
 
uint8_t magneto13_get_error_flag (magneto13_t *ctx)
 Magneto 13 gets the error flag function.
 
uint8_t magneto13_get_nvm_access_state (magneto13_t *ctx)
 Magneto 13 checks the access to the NVM function.
 
uint8_t magneto13_get_interrupt (magneto13_t *ctx)
 Magneto 13 gets the interrupt on the angle change state function.
 

Detailed Description

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

◆ magneto13_cfg_setup()

void magneto13_cfg_setup ( magneto13_cfg_t * cfg)

Magneto 13 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ magneto13_default_cfg()

err_t magneto13_default_cfg ( magneto13_t * ctx)

Magneto 13 default configuration function.

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

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

◆ magneto13_enable_fld_thd_det()

err_t magneto13_enable_fld_thd_det ( magneto13_t * ctx)

Magneto 13 enables the magnetic field threshold detection function.

This function activates the magnetic field threshold detection of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

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

◆ magneto13_get_angle()

err_t magneto13_get_angle ( magneto13_t * ctx,
float * angle )

Magneto 13 gets the angular position function.

This function reads an angular position in degrees of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

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

◆ magneto13_get_angle_raw_data()

err_t magneto13_get_angle_raw_data ( magneto13_t * ctx,
uint16_t * raw_data )

Magneto 13 gets the angle raw data function.

This function reads a 16-bit angle raw data of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
[out]raw_data: Angle raw data [0-65535].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneto13_get_error_flag()

uint8_t magneto13_get_error_flag ( magneto13_t * ctx)

Magneto 13 gets the error flag function.

This function gets states of the error flag ( ERR ) pin of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ magneto13_get_field_strength()

err_t magneto13_get_field_strength ( magneto13_t * ctx,
uint8_t * field_strength )

Magneto 13 gets the magnetic field strength function.

This function reads a magnetic field strength detection of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
[out]field_strength:
  • 0 - Magnetic field strength OK,
  • 1 - Magnetic field strength below the MGLT level,
  • 2 - Magnetic field strength above the MGHT level.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneto13_get_interrupt()

uint8_t magneto13_get_interrupt ( magneto13_t * ctx)

Magneto 13 gets the interrupt on the angle change state function.

This function indicates whether the angle change has exceeded the defined threshold of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ magneto13_get_nvm_access_state()

uint8_t magneto13_get_nvm_access_state ( magneto13_t * ctx)

Magneto 13 checks the access to the NVM function.

This function indicates whether the chip is busy accessing the NVM of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state.
Note
None.

◆ magneto13_init()

err_t magneto13_init ( magneto13_t * ctx,
magneto13_cfg_t * cfg )

Magneto 13 initialization function.

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

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

◆ magneto13_read_reg()

err_t magneto13_read_reg ( magneto13_t * ctx,
uint8_t cmd,
uint8_t reg,
uint8_t * data_out )

Magneto 13 data reading function.

This function reads a data byte from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
[in]cmd: Command.
[in]reg: Register address
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneto13_set_mag_field_thd()

err_t magneto13_set_mag_field_thd ( magneto13_t * ctx,
uint8_t mglt,
uint8_t mght )

Magneto 13 sets the magnetic field threshold function.

This function sets the magnetic field's high and low thresholds of the MagAlpha MA736, Contactless Digital Angle Sensor on the Magneto 13 Click board™.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
[in]mglt: Sets the field strength low threshold.
[in]mght: Sets the field strength high threshold.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magneto13_write_reg()

err_t magneto13_write_reg ( magneto13_t * ctx,
uint8_t cmd,
uint8_t reg,
uint8_t data_in )

Magneto 13 data writing function.

This function writes a data byte to the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See magneto13_t object definition for detailed explanation.
[in]cmd: Command.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.