3-axis MEMS ultra low power magnetometer

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_IKS01A3 X_NUCLEO_IKS01A3

Embed: (wiki syntax)

« Back to documentation index

LIS2MDL_data_generation

LIS2MDL_data_generation
[LIS2MDL]

This section group all the functions concerning data generation. More...

Functions

int32_t lis2mdl_mag_user_offset_set (lis2mdl_ctx_t *ctx, uint8_t *buff)
 These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects.
int32_t lis2mdl_mag_user_offset_get (lis2mdl_ctx_t *ctx, uint8_t *buff)
 These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects.
int32_t lis2mdl_operating_mode_set (lis2mdl_ctx_t *ctx, lis2mdl_md_t val)
 Operating mode selection.
int32_t lis2mdl_operating_mode_get (lis2mdl_ctx_t *ctx, lis2mdl_md_t *val)
 Operating mode selection.
int32_t lis2mdl_data_rate_set (lis2mdl_ctx_t *ctx, lis2mdl_odr_t val)
 Output data rate selection.
int32_t lis2mdl_data_rate_get (lis2mdl_ctx_t *ctx, lis2mdl_odr_t *val)
 Output data rate selection.
int32_t lis2mdl_power_mode_set (lis2mdl_ctx_t *ctx, lis2mdl_lp_t val)
 Enables high-resolution/low-power mode.
int32_t lis2mdl_power_mode_get (lis2mdl_ctx_t *ctx, lis2mdl_lp_t *val)
 Enables high-resolution/low-power mode.
int32_t lis2mdl_offset_temp_comp_set (lis2mdl_ctx_t *ctx, uint8_t val)
 Enables the magnetometer temperature compensation.
int32_t lis2mdl_offset_temp_comp_get (lis2mdl_ctx_t *ctx, uint8_t *val)
 Enables the magnetometer temperature compensation.
int32_t lis2mdl_low_pass_bandwidth_set (lis2mdl_ctx_t *ctx, lis2mdl_lpf_t val)
 Low-pass bandwidth selection.
int32_t lis2mdl_low_pass_bandwidth_get (lis2mdl_ctx_t *ctx, lis2mdl_lpf_t *val)
 Low-pass bandwidth selection.
int32_t lis2mdl_set_rst_mode_set (lis2mdl_ctx_t *ctx, lis2mdl_set_rst_t val)
 Reset mode.
int32_t lis2mdl_set_rst_mode_get (lis2mdl_ctx_t *ctx, lis2mdl_set_rst_t *val)
 Reset mode.
int32_t lis2mdl_set_rst_sensor_single_set (lis2mdl_ctx_t *ctx, uint8_t val)
 Enables offset cancellation in single measurement mode.
int32_t lis2mdl_set_rst_sensor_single_get (lis2mdl_ctx_t *ctx, uint8_t *val)
 Enables offset cancellation in single measurement mode.
int32_t lis2mdl_block_data_update_set (lis2mdl_ctx_t *ctx, uint8_t val)
 Blockdataupdate.
int32_t lis2mdl_block_data_update_get (lis2mdl_ctx_t *ctx, uint8_t *val)
 Blockdataupdate.
int32_t lis2mdl_mag_data_ready_get (lis2mdl_ctx_t *ctx, uint8_t *val)
 Magnetic set of data available.
int32_t lis2mdl_mag_data_ovr_get (lis2mdl_ctx_t *ctx, uint8_t *val)
 Magnetic set of data overrun.
int32_t lis2mdl_magnetic_raw_get (lis2mdl_ctx_t *ctx, uint8_t *buff)
 Magnetic output value.
int32_t lis2mdl_temperature_raw_get (lis2mdl_ctx_t *ctx, uint8_t *buff)
 Temperature output value.

Detailed Description

This section group all the functions concerning data generation.


Function Documentation

int32_t lis2mdl_block_data_update_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  val 
)

Blockdataupdate.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of bdu in reg CFG_REG_C.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 556 of file lis2mdl_reg.c.

int32_t lis2mdl_block_data_update_set ( lis2mdl_ctx_t *  ctx,
uint8_t  val 
)

Blockdataupdate.

[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of bdu in reg CFG_REG_C
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 533 of file lis2mdl_reg.c.

int32_t lis2mdl_data_rate_get ( lis2mdl_ctx_t *  ctx,
lis2mdl_odr_t *  val 
)

Output data rate selection.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valGet the values of odr in reg CFG_REG_A.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 249 of file lis2mdl_reg.c.

int32_t lis2mdl_data_rate_set ( lis2mdl_ctx_t *  ctx,
lis2mdl_odr_t  val 
)

Output data rate selection.

[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of odr in reg CFG_REG_A
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 226 of file lis2mdl_reg.c.

int32_t lis2mdl_low_pass_bandwidth_get ( lis2mdl_ctx_t *  ctx,
lis2mdl_lpf_t *  val 
)

Low-pass bandwidth selection.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valGet the values of lpf in reg CFG_REG_B.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 400 of file lis2mdl_reg.c.

int32_t lis2mdl_low_pass_bandwidth_set ( lis2mdl_ctx_t *  ctx,
lis2mdl_lpf_t  val 
)

Low-pass bandwidth selection.

[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of lpf in reg CFG_REG_B
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 376 of file lis2mdl_reg.c.

int32_t lis2mdl_mag_data_ovr_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  val 
)

Magnetic set of data overrun.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of zyxor in reg STATUS_REG.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 594 of file lis2mdl_reg.c.

int32_t lis2mdl_mag_data_ready_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  val 
)

Magnetic set of data available.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of zyxda in reg STATUS_REG.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 575 of file lis2mdl_reg.c.

int32_t lis2mdl_mag_user_offset_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  buff 
)

These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects.

Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.[get]

Parameters:
ctxread / write interface definitions.(ptr)
buffthat stores data read
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 156 of file lis2mdl_reg.c.

int32_t lis2mdl_mag_user_offset_set ( lis2mdl_ctx_t *  ctx,
uint8_t *  buff 
)

These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects.

Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.[set]

Parameters:
ctxread / write interface definitions.(ptr)
buffbuffer that contains data to write
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 137 of file lis2mdl_reg.c.

int32_t lis2mdl_magnetic_raw_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  buff 
)

Magnetic output value.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
buffthat stores data read
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 613 of file lis2mdl_reg.c.

int32_t lis2mdl_offset_temp_comp_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  val 
)

Enables the magnetometer temperature compensation.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of comp_temp_en in reg CFG_REG_A.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 357 of file lis2mdl_reg.c.

int32_t lis2mdl_offset_temp_comp_set ( lis2mdl_ctx_t *  ctx,
uint8_t  val 
)

Enables the magnetometer temperature compensation.

[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of comp_temp_en in reg CFG_REG_A
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 334 of file lis2mdl_reg.c.

int32_t lis2mdl_operating_mode_get ( lis2mdl_ctx_t *  ctx,
lis2mdl_md_t *  val 
)

Operating mode selection.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valGet the values of md in reg CFG_REG_A.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 194 of file lis2mdl_reg.c.

int32_t lis2mdl_operating_mode_set ( lis2mdl_ctx_t *  ctx,
lis2mdl_md_t  val 
)

Operating mode selection.

[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of md in reg CFG_REG_A
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 171 of file lis2mdl_reg.c.

int32_t lis2mdl_power_mode_get ( lis2mdl_ctx_t *  ctx,
lis2mdl_lp_t *  val 
)

Enables high-resolution/low-power mode.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valGet the values of lp in reg CFG_REG_A.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 306 of file lis2mdl_reg.c.

int32_t lis2mdl_power_mode_set ( lis2mdl_ctx_t *  ctx,
lis2mdl_lp_t  val 
)

Enables high-resolution/low-power mode.

[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of lp in reg CFG_REG_A
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 283 of file lis2mdl_reg.c.

int32_t lis2mdl_set_rst_mode_get ( lis2mdl_ctx_t *  ctx,
lis2mdl_set_rst_t *  val 
)

Reset mode.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
valGet the values of set_rst in reg CFG_REG_B.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 452 of file lis2mdl_reg.c.

int32_t lis2mdl_set_rst_mode_set ( lis2mdl_ctx_t *  ctx,
lis2mdl_set_rst_t  val 
)

Reset mode.

[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of set_rst in reg CFG_REG_B
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 429 of file lis2mdl_reg.c.

int32_t lis2mdl_set_rst_sensor_single_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  val 
)

Enables offset cancellation in single measurement mode.

The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.[get]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of off_canc_one_shot in reg CFG_REG_B.(ptr)
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 514 of file lis2mdl_reg.c.

int32_t lis2mdl_set_rst_sensor_single_set ( lis2mdl_ctx_t *  ctx,
uint8_t  val 
)

Enables offset cancellation in single measurement mode.

The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.[set]

Parameters:
ctxread / write interface definitions.(ptr)
valchange the values of off_canc_one_shot in reg CFG_REG_B
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 487 of file lis2mdl_reg.c.

int32_t lis2mdl_temperature_raw_get ( lis2mdl_ctx_t *  ctx,
uint8_t *  buff 
)

Temperature output value.

[get]

Parameters:
ctxread / write interface definitions.(ptr)
buffthat stores data read
Return values:
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 628 of file lis2mdl_reg.c.