magaccel 2.1.0.0
MagAccel Click Driver

API for configuring and manipulating MagAccel Click driver. More...

Topics

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

Functions

void magaccel_cfg_setup (magaccel_cfg_t *cfg)
 MagAccel configuration object setup function.
 
err_t magaccel_init (magaccel_t *ctx, magaccel_cfg_t *cfg)
 MagAccel initialization function.
 
err_t magaccel_default_cfg (magaccel_t *ctx)
 MagAccel default configuration function.
 
err_t magaccel_generic_write (magaccel_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 MagAccel I2C writing function.
 
err_t magaccel_generic_read (magaccel_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 MagAccel I2C reading function.
 
err_t magaccel_get_device_id (magaccel_t *ctx, uint8_t *device_id)
 MagAccel get device ID function.
 
err_t magaccel_get_status (magaccel_t *ctx, uint8_t *status)
 MagAccel get status function.
 
err_t magaccel_sw_reset (magaccel_t *ctx)
 MagAccel soft reset function.
 
err_t magaccel_set_op_mode (magaccel_t *ctx, uint8_t op_mode)
 MagAccel set operating mode function.
 
err_t magaccel_set_fsr (magaccel_t *ctx, uint8_t fsr)
 MagAccel set FSR function.
 
err_t magaccel_en_data_ready (magaccel_t *ctx)
 MagAccel enable data ready function.
 
err_t magaccel_get_axes_data (magaccel_t *ctx, magaccel_axes_t *axes)
 MagAccel get the accel sensor axes function.
 
uint8_t magaccel_check_data_ready (magaccel_t *ctx)
 MagAccel get data ready function.
 
uint8_t magaccel_check_mag_field (magaccel_t *ctx)
 MagAccel checks the magnetic field function.
 

Detailed Description

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

◆ magaccel_cfg_setup()

void magaccel_cfg_setup ( magaccel_cfg_t * cfg)

MagAccel configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ magaccel_check_data_ready()

uint8_t magaccel_check_data_ready ( magaccel_t * ctx)

MagAccel get data ready function.

This function checks if data is ready by reading the states of the MOT (INT) pin of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

Parameters
[in]ctx: Click context object. See magaccel_t object definition for detailed explanation.
Returns
  • 0 - The data is ready,
  • 1 - Data not ready.
Note
None.

◆ magaccel_check_mag_field()

uint8_t magaccel_check_mag_field ( magaccel_t * ctx)

MagAccel checks the magnetic field function.

This function checks the magnetic field y by reading the states of the FLD (AN) pin of the NMH1000, Magnetic switch on the MagAccel Click board.

Parameters
[in]ctx: Click context object. See magaccel_t object definition for detailed explanation.
Returns
  • 0 - Presence of a magnetic field,
  • 1 - Absence of a magnetic field.
Note
None.

◆ magaccel_default_cfg()

err_t magaccel_default_cfg ( magaccel_t * ctx)

MagAccel default configuration function.

This function executes a default configuration of MagAccel click board.

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

◆ magaccel_en_data_ready()

err_t magaccel_en_data_ready ( magaccel_t * ctx)

MagAccel enable data ready function.

This function is used to enable data-ready interrupt output of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

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

◆ magaccel_generic_read()

err_t magaccel_generic_read ( magaccel_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

MagAccel 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 magaccel_t object definition for detailed explanation.
[in]reg: Start register address.
[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.

◆ magaccel_generic_write()

err_t magaccel_generic_write ( magaccel_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

MagAccel 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 magaccel_t object definition for detailed explanation.
[in]reg: Start register address.
[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.

◆ magaccel_get_axes_data()

err_t magaccel_get_axes_data ( magaccel_t * ctx,
magaccel_axes_t * axes )

MagAccel get the accel sensor axes function.

This function reads the accelerometer sensor axes data of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

Parameters
[in]ctx: Click context object. See magaccel_t object definition for detailed explanation.
[out]axes: Linear acceleration output data object (mg).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magaccel_get_device_id()

err_t magaccel_get_device_id ( magaccel_t * ctx,
uint8_t * device_id )

MagAccel get device ID function.

This function reads the device identification data of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

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

◆ magaccel_get_status()

err_t magaccel_get_status ( magaccel_t * ctx,
uint8_t * status )

MagAccel get status function.

This function reads the status data of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

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

◆ magaccel_init()

err_t magaccel_init ( magaccel_t * ctx,
magaccel_cfg_t * cfg )

MagAccel initialization function.

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

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

◆ magaccel_set_fsr()

err_t magaccel_set_fsr ( magaccel_t * ctx,
uint8_t fsr )

MagAccel set FSR function.

This function sets the desired full-scale measurement range of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

Parameters
[in]ctx: Click context object. See magaccel_t object definition for detailed explanation.
[in]op_mode: Standby/Active mode selection.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magaccel_set_op_mode()

err_t magaccel_set_op_mode ( magaccel_t * ctx,
uint8_t op_mode )

MagAccel set operating mode function.

This function sets the desired operating mode of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

Parameters
[in]ctx: Click context object. See magaccel_t object definition for detailed explanation.
[in]op_mode: Standby/Active mode selection.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ magaccel_sw_reset()

err_t magaccel_sw_reset ( magaccel_t * ctx)

MagAccel soft reset function.

This function trigger the soft reset sequence of the FXLS8974, 3-Axis Low-g Accelerometer on the MagAccel Click board.

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