Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
Loading...
Searching...
No Matches
Activity/Inactivity_detection

This section groups all the functions concerning activity/inactivity detection. More...

Collaboration diagram for Activity/Inactivity_detection:

Functions

int32_t lsm6dso32_gy_sleep_mode_set (stmdev_ctx_t *ctx, uint8_t val)
 Enables gyroscope Sleep mode.[set].
 
int32_t lsm6dso32_gy_sleep_mode_get (stmdev_ctx_t *ctx, uint8_t *val)
 Enables gyroscope Sleep mode.[get].
 
int32_t lsm6dso32_act_pin_notification_set (stmdev_ctx_t *ctx, lsm6dso32_sleep_status_on_int_t val)
 Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).[set].
 
int32_t lsm6dso32_act_pin_notification_get (stmdev_ctx_t *ctx, lsm6dso32_sleep_status_on_int_t *val)
 Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).[get].
 
int32_t lsm6dso32_act_mode_set (stmdev_ctx_t *ctx, lsm6dso32_inact_en_t val)
 Enable inactivity function.[set].
 
int32_t lsm6dso32_act_mode_get (stmdev_ctx_t *ctx, lsm6dso32_inact_en_t *val)
 Enable inactivity function.[get].
 
int32_t lsm6dso32_act_sleep_dur_set (stmdev_ctx_t *ctx, uint8_t val)
 Duration to go in sleep mode.[set] 1 LSb = 512 / ODR.
 
int32_t lsm6dso32_act_sleep_dur_get (stmdev_ctx_t *ctx, uint8_t *val)
 Duration to go in sleep mode.[get] 1 LSb = 512 / ODR.
 
int32_t lsm6dso32_6d_threshold_set (stmdev_ctx_t *ctx, lsm6dso32_sixd_ths_t val)
 Threshold for 4D/6D function.[set].
 
int32_t lsm6dso32_6d_threshold_get (stmdev_ctx_t *ctx, lsm6dso32_sixd_ths_t *val)
 Threshold for 4D/6D function.[get].
 
int32_t lsm6dso32_4d_mode_set (stmdev_ctx_t *ctx, uint8_t val)
 4D orientation detection enable.[set]
 
int32_t lsm6dso32_4d_mode_get (stmdev_ctx_t *ctx, uint8_t *val)
 4D orientation detection enable.[get]
 
int32_t lsm6dso32_mag_sensitivity_set (stmdev_ctx_t *ctx, uint16_t val)
 External magnetometer sensitivity value register.[set].
 
int32_t lsm6dso32_mag_sensitivity_get (stmdev_ctx_t *ctx, uint16_t *val)
 External magnetometer sensitivity value register.[get].
 
int32_t lsm6dso32_mag_offset_set (stmdev_ctx_t *ctx, int16_t *val)
 Offset for hard-iron compensation register (r/w).[set].
 
int32_t lsm6dso32_mag_offset_get (stmdev_ctx_t *ctx, int16_t *val)
 Offset for hard-iron compensation register (r/w).[get].
 
int32_t lsm6dso32_mag_soft_iron_set (stmdev_ctx_t *ctx, int16_t *val)
 Soft-iron (3x3 symmetric) matrix correction register (r/w). The value is expressed as half-precision floating-point format: SEEEEEFFFFFFFFFF S: 1 sign bit; E: 5 exponent bits; F: 10 fraction bits).[set].
 
int32_t lsm6dso32_mag_soft_iron_get (stmdev_ctx_t *ctx, int16_t *val)
 Soft-iron (3x3 symmetric) matrix correction register (r/w). The value is expressed as half-precision floating-point format: SEEEEEFFFFFFFFFF S: 1 sign bit; E: 5 exponent bits; F: 10 fraction bits.[get].
 
int32_t lsm6dso32_mag_z_orient_set (stmdev_ctx_t *ctx, lsm6dso32_mag_z_axis_t val)
 Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[set].
 
int32_t lsm6dso32_mag_z_orient_get (stmdev_ctx_t *ctx, lsm6dso32_mag_z_axis_t *val)
 Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[get].
 
int32_t lsm6dso32_mag_y_orient_set (stmdev_ctx_t *ctx, lsm6dso32_mag_y_axis_t val)
 Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[set].
 
int32_t lsm6dso32_mag_y_orient_get (stmdev_ctx_t *ctx, lsm6dso32_mag_y_axis_t *val)
 Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[get].
 
int32_t lsm6dso32_mag_x_orient_set (stmdev_ctx_t *ctx, lsm6dso32_mag_x_axis_t val)
 Magnetometer X-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[set].
 
int32_t lsm6dso32_mag_x_orient_get (stmdev_ctx_t *ctx, lsm6dso32_mag_x_axis_t *val)
 Magnetometer X-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[get].
 

Detailed Description

This section groups all the functions concerning activity/inactivity detection.

This section groups all the functions that manage additional magnetometer sensor.

This section groups all the functions concerning six position detection (6D).

Function Documentation

◆ lsm6dso32_4d_mode_get()

int32_t lsm6dso32_4d_mode_get ( stmdev_ctx_t ctx,
uint8_t *  val 
)

4D orientation detection enable.[get]

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

Definition at line 4905 of file lsm6dso32_reg.c.

4906{
4908 int32_t ret;
4909
4910 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_THS_6D, (uint8_t *)&reg, 1);
4911 *val = reg.d4d_en;
4912
4913 return ret;
4914}
int32_t __weak lsm6dso32_read_reg(stmdev_ctx_t *ctx, uint8_t reg, uint8_t *data, uint16_t len)
Read generic device register.
#define LSM6DSO32_TAP_THS_6D

References lsm6dso32_tap_ths_6d_t::d4d_en, lsm6dso32_read_reg(), and LSM6DSO32_TAP_THS_6D.

Here is the call graph for this function:

◆ lsm6dso32_4d_mode_set()

int32_t lsm6dso32_4d_mode_set ( stmdev_ctx_t ctx,
uint8_t  val 
)

4D orientation detection enable.[set]

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

Definition at line 4881 of file lsm6dso32_reg.c.

4882{
4884 int32_t ret;
4885
4886 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_THS_6D, (uint8_t *)&reg, 1);
4887
4888 if (ret == 0)
4889 {
4890 reg.d4d_en = val;
4891 ret = lsm6dso32_write_reg(ctx, LSM6DSO32_TAP_THS_6D, (uint8_t *)&reg, 1);
4892 }
4893
4894 return ret;
4895}
int32_t __weak lsm6dso32_write_reg(stmdev_ctx_t *ctx, uint8_t reg, uint8_t *data, uint16_t len)
Write generic device register.

References lsm6dso32_tap_ths_6d_t::d4d_en, lsm6dso32_read_reg(), LSM6DSO32_TAP_THS_6D, and lsm6dso32_write_reg().

Here is the call graph for this function:

◆ lsm6dso32_6d_threshold_get()

int32_t lsm6dso32_6d_threshold_get ( stmdev_ctx_t ctx,
lsm6dso32_sixd_ths_t val 
)

Threshold for 4D/6D function.[get].

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

Definition at line 4847 of file lsm6dso32_reg.c.

4849{
4851 int32_t ret;
4852
4853 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_THS_6D, (uint8_t *)&reg, 1);
4854
4855 switch (reg.sixd_ths)
4856 {
4857 case LSM6DSO32_DEG_68:
4858 *val = LSM6DSO32_DEG_68;
4859 break;
4860
4861 case LSM6DSO32_DEG_47:
4862 *val = LSM6DSO32_DEG_47;
4863 break;
4864
4865 default:
4866 *val = LSM6DSO32_DEG_68;
4867 break;
4868 }
4869
4870 return ret;
4871}
@ LSM6DSO32_DEG_68
@ LSM6DSO32_DEG_47

References LSM6DSO32_DEG_47, LSM6DSO32_DEG_68, lsm6dso32_read_reg(), LSM6DSO32_TAP_THS_6D, and lsm6dso32_tap_ths_6d_t::sixd_ths.

Here is the call graph for this function:

◆ lsm6dso32_6d_threshold_set()

int32_t lsm6dso32_6d_threshold_set ( stmdev_ctx_t ctx,
lsm6dso32_sixd_ths_t  val 
)

Threshold for 4D/6D function.[set].

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

Definition at line 4822 of file lsm6dso32_reg.c.

4824{
4826 int32_t ret;
4827
4828 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_THS_6D, (uint8_t *)&reg, 1);
4829
4830 if (ret == 0)
4831 {
4832 reg.sixd_ths = (uint8_t)val;
4833 ret = lsm6dso32_write_reg(ctx, LSM6DSO32_TAP_THS_6D, (uint8_t *)&reg, 1);
4834 }
4835
4836 return ret;
4837}

References lsm6dso32_read_reg(), LSM6DSO32_TAP_THS_6D, lsm6dso32_write_reg(), and lsm6dso32_tap_ths_6d_t::sixd_ths.

Here is the call graph for this function:

◆ lsm6dso32_act_mode_get()

int32_t lsm6dso32_act_mode_get ( stmdev_ctx_t ctx,
lsm6dso32_inact_en_t val 
)

Enable inactivity function.[get].

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

Definition at line 4145 of file lsm6dso32_reg.c.

4147{
4149 int32_t ret;
4150
4151 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_CFG2, (uint8_t *)&reg, 1);
4152
4153 switch (reg.inact_en)
4154 {
4157 break;
4158
4161 break;
4162
4165 break;
4166
4169 break;
4170
4171 default:
4173 break;
4174 }
4175
4176 return ret;
4177}
#define LSM6DSO32_TAP_CFG2
@ LSM6DSO32_XL_12Hz5_GY_NOT_AFFECTED
@ LSM6DSO32_XL_12Hz5_GY_PD
@ LSM6DSO32_XL_AND_GY_NOT_AFFECTED
@ LSM6DSO32_XL_12Hz5_GY_SLEEP

References lsm6dso32_tap_cfg2_t::inact_en, lsm6dso32_read_reg(), LSM6DSO32_TAP_CFG2, LSM6DSO32_XL_12Hz5_GY_NOT_AFFECTED, LSM6DSO32_XL_12Hz5_GY_PD, LSM6DSO32_XL_12Hz5_GY_SLEEP, and LSM6DSO32_XL_AND_GY_NOT_AFFECTED.

Here is the call graph for this function:

◆ lsm6dso32_act_mode_set()

int32_t lsm6dso32_act_mode_set ( stmdev_ctx_t ctx,
lsm6dso32_inact_en_t  val 
)

Enable inactivity function.[set].

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

Definition at line 4120 of file lsm6dso32_reg.c.

4122{
4124 int32_t ret;
4125
4126 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_CFG2, (uint8_t *)&reg, 1);
4127
4128 if (ret == 0)
4129 {
4130 reg.inact_en = (uint8_t)val;
4131 ret = lsm6dso32_write_reg(ctx, LSM6DSO32_TAP_CFG2, (uint8_t *)&reg, 1);
4132 }
4133
4134 return ret;
4135}

References lsm6dso32_tap_cfg2_t::inact_en, lsm6dso32_read_reg(), LSM6DSO32_TAP_CFG2, and lsm6dso32_write_reg().

Here is the call graph for this function:

◆ lsm6dso32_act_pin_notification_get()

int32_t lsm6dso32_act_pin_notification_get ( stmdev_ctx_t ctx,
lsm6dso32_sleep_status_on_int_t val 
)

Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).[get].

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

Definition at line 4086 of file lsm6dso32_reg.c.

4088{
4090 int32_t ret;
4091
4092 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_CFG0, (uint8_t *)&reg, 1);
4093
4094 switch (reg.sleep_status_on_int)
4095 {
4098 break;
4099
4102 break;
4103
4104 default:
4106 break;
4107 }
4108
4109 return ret;
4110}
@ LSM6DSO32_DRIVE_SLEEP_CHG_EVENT
@ LSM6DSO32_DRIVE_SLEEP_STATUS
#define LSM6DSO32_TAP_CFG0

References LSM6DSO32_DRIVE_SLEEP_CHG_EVENT, LSM6DSO32_DRIVE_SLEEP_STATUS, lsm6dso32_read_reg(), LSM6DSO32_TAP_CFG0, and lsm6dso32_tap_cfg0_t::sleep_status_on_int.

Here is the call graph for this function:

◆ lsm6dso32_act_pin_notification_set()

int32_t lsm6dso32_act_pin_notification_set ( stmdev_ctx_t ctx,
lsm6dso32_sleep_status_on_int_t  val 
)

Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).[set].

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

Definition at line 4058 of file lsm6dso32_reg.c.

4060{
4062 int32_t ret;
4063
4064 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_TAP_CFG0, (uint8_t *)&reg, 1);
4065
4066 if (ret == 0)
4067 {
4068 reg.sleep_status_on_int = (uint8_t)val;
4069 ret = lsm6dso32_write_reg(ctx, LSM6DSO32_TAP_CFG0, (uint8_t *)&reg, 1);
4070 }
4071
4072 return ret;
4073}

References lsm6dso32_read_reg(), LSM6DSO32_TAP_CFG0, lsm6dso32_write_reg(), and lsm6dso32_tap_cfg0_t::sleep_status_on_int.

Here is the call graph for this function:

◆ lsm6dso32_act_sleep_dur_get()

int32_t lsm6dso32_act_sleep_dur_get ( stmdev_ctx_t ctx,
uint8_t *  val 
)

Duration to go in sleep mode.[get] 1 LSb = 512 / ODR.

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

Definition at line 4213 of file lsm6dso32_reg.c.

4214{
4216 int32_t ret;
4217
4218 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_WAKE_UP_DUR, (uint8_t *)&reg, 1);
4219 *val = reg.sleep_dur;
4220
4221 return ret;
4222}
#define LSM6DSO32_WAKE_UP_DUR

References lsm6dso32_read_reg(), LSM6DSO32_WAKE_UP_DUR, and lsm6dso32_wake_up_dur_t::sleep_dur.

Here is the call graph for this function:

◆ lsm6dso32_act_sleep_dur_set()

int32_t lsm6dso32_act_sleep_dur_set ( stmdev_ctx_t ctx,
uint8_t  val 
)

Duration to go in sleep mode.[set] 1 LSb = 512 / ODR.

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

Definition at line 4188 of file lsm6dso32_reg.c.

4189{
4191 int32_t ret;
4192
4193 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_WAKE_UP_DUR, (uint8_t *)&reg, 1);
4194
4195 if (ret == 0)
4196 {
4197 reg.sleep_dur = val;
4198 ret = lsm6dso32_write_reg(ctx, LSM6DSO32_WAKE_UP_DUR, (uint8_t *)&reg, 1);
4199 }
4200
4201 return ret;
4202}

References lsm6dso32_read_reg(), LSM6DSO32_WAKE_UP_DUR, lsm6dso32_write_reg(), and lsm6dso32_wake_up_dur_t::sleep_dur.

Here is the call graph for this function:

◆ lsm6dso32_gy_sleep_mode_get()

int32_t lsm6dso32_gy_sleep_mode_get ( stmdev_ctx_t ctx,
uint8_t *  val 
)

Enables gyroscope Sleep mode.[get].

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

Definition at line 4036 of file lsm6dso32_reg.c.

4037{
4039 int32_t ret;
4040
4041 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_CTRL4_C, (uint8_t *)&reg, 1);
4042 *val = reg.sleep_g;
4043
4044 return ret;
4045}
#define LSM6DSO32_CTRL4_C

References LSM6DSO32_CTRL4_C, lsm6dso32_read_reg(), and lsm6dso32_ctrl4_c_t::sleep_g.

Here is the call graph for this function:

◆ lsm6dso32_gy_sleep_mode_set()

int32_t lsm6dso32_gy_sleep_mode_set ( stmdev_ctx_t ctx,
uint8_t  val 
)

Enables gyroscope Sleep mode.[set].

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

Definition at line 4012 of file lsm6dso32_reg.c.

4013{
4015 int32_t ret;
4016
4017 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_CTRL4_C, (uint8_t *)&reg, 1);
4018
4019 if (ret == 0)
4020 {
4021 reg.sleep_g = val;
4022 ret = lsm6dso32_write_reg(ctx, LSM6DSO32_CTRL4_C, (uint8_t *)&reg, 1);
4023 }
4024
4025 return ret;
4026}

References LSM6DSO32_CTRL4_C, lsm6dso32_read_reg(), lsm6dso32_write_reg(), and lsm6dso32_ctrl4_c_t::sleep_g.

Here is the call graph for this function:

◆ lsm6dso32_mag_offset_get()

int32_t lsm6dso32_mag_offset_get ( stmdev_ctx_t ctx,
int16_t *  val 
)

Offset for hard-iron compensation register (r/w).[get].

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

Definition at line 7615 of file lsm6dso32_reg.c.

7616{
7617 uint8_t buff[6];
7618 int32_t ret;
7619
7621 &buff[0]);
7622
7623 if (ret == 0)
7624 {
7626 &buff[1]);
7627 }
7628
7629 if (ret == 0)
7630 {
7632 &buff[2]);
7633 }
7634
7635 if (ret == 0)
7636 {
7638 &buff[3]);
7639 }
7640
7641 if (ret == 0)
7642 {
7644 &buff[4]);
7645 }
7646
7647 if (ret == 0)
7648 {
7650 &buff[5]);
7651 val[0] = (int16_t)buff[1];
7652 val[0] = (val[0] * 256) + (int16_t)buff[0];
7653 val[1] = (int16_t)buff[3];
7654 val[1] = (val[1] * 256) + (int16_t)buff[2];
7655 val[2] = (int16_t)buff[5];
7656 val[2] = (val[2] * 256) + (int16_t)buff[4];
7657 }
7658
7659 return ret;
7660}
int32_t lsm6dso32_ln_pg_read_byte(stmdev_ctx_t *ctx, uint16_t address, uint8_t *val)
Read a line(byte) in a page.[get].
#define LSM6DSO32_MAG_OFFZ_L
#define LSM6DSO32_MAG_OFFY_L
#define LSM6DSO32_MAG_OFFY_H
#define LSM6DSO32_MAG_OFFZ_H
#define LSM6DSO32_MAG_OFFX_L
#define LSM6DSO32_MAG_OFFX_H

References lsm6dso32_ln_pg_read_byte(), LSM6DSO32_MAG_OFFX_H, LSM6DSO32_MAG_OFFX_L, LSM6DSO32_MAG_OFFY_H, LSM6DSO32_MAG_OFFY_L, LSM6DSO32_MAG_OFFZ_H, and LSM6DSO32_MAG_OFFZ_L.

Here is the call graph for this function:

◆ lsm6dso32_mag_offset_set()

int32_t lsm6dso32_mag_offset_set ( stmdev_ctx_t ctx,
int16_t *  val 
)

Offset for hard-iron compensation register (r/w).[set].

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

Definition at line 7560 of file lsm6dso32_reg.c.

7561{
7562 uint8_t buff[6];
7563 int32_t ret;
7564
7565 buff[1] = (uint8_t)((uint16_t)val[0] / 256U);
7566 buff[0] = (uint8_t)((uint16_t)val[0] - (buff[1] * 256U));
7567 buff[3] = (uint8_t)((uint16_t)val[1] / 256U);
7568 buff[2] = (uint8_t)((uint16_t)val[1] - (buff[3] * 256U));
7569 buff[5] = (uint8_t)((uint16_t)val[2] / 256U);
7570 buff[4] = (uint8_t)((uint16_t)val[2] - (buff[5] * 256U));
7572 &buff[0]);
7573
7574 if (ret == 0)
7575 {
7577 &buff[1]);
7578 }
7579
7580 if (ret == 0)
7581 {
7583 &buff[2]);
7584 }
7585
7586 if (ret == 0)
7587 {
7589 &buff[3]);
7590 }
7591
7592 if (ret == 0)
7593 {
7595 &buff[4]);
7596 }
7597
7598 if (ret == 0)
7599 {
7601 &buff[5]);
7602 }
7603
7604 return ret;
7605}
int32_t lsm6dso32_ln_pg_write_byte(stmdev_ctx_t *ctx, uint16_t address, uint8_t *val)
Write a line(byte) in a page.[set].

References lsm6dso32_ln_pg_write_byte(), LSM6DSO32_MAG_OFFX_H, LSM6DSO32_MAG_OFFX_L, LSM6DSO32_MAG_OFFY_H, LSM6DSO32_MAG_OFFY_L, LSM6DSO32_MAG_OFFZ_H, and LSM6DSO32_MAG_OFFZ_L.

Here is the call graph for this function:

◆ lsm6dso32_mag_sensitivity_get()

int32_t lsm6dso32_mag_sensitivity_get ( stmdev_ctx_t ctx,
uint16_t *  val 
)

External magnetometer sensitivity value register.[get].

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

Definition at line 7532 of file lsm6dso32_reg.c.

7534{
7535 uint8_t buff[2];
7536 int32_t ret;
7537
7539 &buff[0]);
7540
7541 if (ret == 0)
7542 {
7544 &buff[1]);
7545 *val = buff[1];
7546 *val = (*val * 256U) + buff[0];
7547 }
7548
7549 return ret;
7550}
#define LSM6DSO32_MAG_SENSITIVITY_L
#define LSM6DSO32_MAG_SENSITIVITY_H

References lsm6dso32_ln_pg_read_byte(), LSM6DSO32_MAG_SENSITIVITY_H, and LSM6DSO32_MAG_SENSITIVITY_L.

Here is the call graph for this function:

◆ lsm6dso32_mag_sensitivity_set()

int32_t lsm6dso32_mag_sensitivity_set ( stmdev_ctx_t ctx,
uint16_t  val 
)

External magnetometer sensitivity value register.[set].

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

Definition at line 7505 of file lsm6dso32_reg.c.

7506{
7507 uint8_t buff[2];
7508 int32_t ret;
7509
7510 buff[1] = (uint8_t)(val / 256U);
7511 buff[0] = (uint8_t)(val - (buff[1] * 256U));
7513 &buff[0]);
7514
7515 if (ret == 0)
7516 {
7518 &buff[1]);
7519 }
7520
7521 return ret;
7522}

References lsm6dso32_ln_pg_write_byte(), LSM6DSO32_MAG_SENSITIVITY_H, and LSM6DSO32_MAG_SENSITIVITY_L.

Here is the call graph for this function:

◆ lsm6dso32_mag_soft_iron_get()

int32_t lsm6dso32_mag_soft_iron_get ( stmdev_ctx_t ctx,
int16_t *  val 
)

Soft-iron (3x3 symmetric) matrix correction register (r/w). The value is expressed as half-precision floating-point format: SEEEEEFFFFFFFFFF S: 1 sign bit; E: 5 exponent bits; F: 10 fraction bits.[get].

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

Definition at line 7793 of file lsm6dso32_reg.c.

7794{
7795 uint8_t buff[12];
7796 int32_t ret;
7797
7798 uint8_t index;
7799 index = 0x00U;
7801 &buff[index]);
7802
7803 if (ret == 0)
7804 {
7805 index++;
7807 &buff[index]);
7808 }
7809
7810 if (ret == 0)
7811 {
7812 index++;
7814 &buff[index]);
7815 }
7816
7817 if (ret == 0)
7818 {
7819 index++;
7821 &buff[index]);
7822 }
7823
7824 if (ret == 0)
7825 {
7826 index++;
7828 &buff[index]);
7829 }
7830
7831 if (ret == 0)
7832 {
7833 index++;
7835 &buff[index]);
7836 }
7837
7838 if (ret == 0)
7839 {
7840 index++;
7842 &buff[index]);
7843 }
7844
7845 if (ret == 0)
7846 {
7847 index++;
7849 &buff[index]);
7850 }
7851
7852 if (ret == 0)
7853 {
7854 index++;
7856 &buff[index]);
7857 }
7858
7859 if (ret == 0)
7860 {
7861 index++;
7863 &buff[index]);
7864 }
7865
7866 if (ret == 0)
7867 {
7868 index++;
7870 &buff[index]);
7871 }
7872
7873 if (ret == 0)
7874 {
7875 index++;
7877 &buff[index]);
7878 }
7879
7880 val[0] = (int16_t)buff[1];
7881 val[0] = (val[0] * 256) + (int16_t)buff[0];
7882 val[1] = (int16_t)buff[3];
7883 val[1] = (val[1] * 256) + (int16_t)buff[2];
7884 val[2] = (int16_t)buff[5];
7885 val[2] = (val[2] * 256) + (int16_t)buff[4];
7886 val[3] = (int16_t)buff[7];
7887 val[3] = (val[3] * 256) + (int16_t)buff[6];
7888 val[4] = (int16_t)buff[9];
7889 val[4] = (val[4] * 256) + (int16_t)buff[8];
7890 val[5] = (int16_t)buff[11];
7891 val[5] = (val[5] * 256) + (int16_t)buff[10];
7892
7893 return ret;
7894}
#define LSM6DSO32_MAG_SI_YY_H
#define LSM6DSO32_MAG_SI_ZZ_L
#define LSM6DSO32_MAG_SI_YZ_L
#define LSM6DSO32_MAG_SI_ZZ_H
#define LSM6DSO32_MAG_SI_XZ_L
#define LSM6DSO32_MAG_SI_YZ_H
#define LSM6DSO32_MAG_SI_XX_H
#define LSM6DSO32_MAG_SI_XY_L
#define LSM6DSO32_MAG_SI_XY_H
#define LSM6DSO32_MAG_SI_YY_L
#define LSM6DSO32_MAG_SI_XX_L
#define LSM6DSO32_MAG_SI_XZ_H

References lsm6dso32_ln_pg_read_byte(), LSM6DSO32_MAG_SI_XX_H, LSM6DSO32_MAG_SI_XX_L, LSM6DSO32_MAG_SI_XY_H, LSM6DSO32_MAG_SI_XY_L, LSM6DSO32_MAG_SI_XZ_H, LSM6DSO32_MAG_SI_XZ_L, LSM6DSO32_MAG_SI_YY_H, LSM6DSO32_MAG_SI_YY_L, LSM6DSO32_MAG_SI_YZ_H, LSM6DSO32_MAG_SI_YZ_L, LSM6DSO32_MAG_SI_ZZ_H, and LSM6DSO32_MAG_SI_ZZ_L.

Here is the call graph for this function:

◆ lsm6dso32_mag_soft_iron_set()

int32_t lsm6dso32_mag_soft_iron_set ( stmdev_ctx_t ctx,
int16_t *  val 
)

Soft-iron (3x3 symmetric) matrix correction register (r/w). The value is expressed as half-precision floating-point format: SEEEEEFFFFFFFFFF S: 1 sign bit; E: 5 exponent bits; F: 10 fraction bits).[set].

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

Definition at line 7676 of file lsm6dso32_reg.c.

7677{
7678 uint8_t buff[12];
7679 int32_t ret;
7680
7681 uint8_t index;
7682 buff[1] = (uint8_t)((uint16_t)val[0] / 256U);
7683 buff[0] = (uint8_t)((uint16_t)val[0] - (buff[1] * 256U));
7684 buff[3] = (uint8_t)((uint16_t)val[1] / 256U);
7685 buff[2] = (uint8_t)((uint16_t)val[1] - (buff[3] * 256U));
7686 buff[5] = (uint8_t)((uint16_t)val[2] / 256U);
7687 buff[4] = (uint8_t)((uint16_t)val[2] - (buff[5] * 256U));
7688 buff[7] = (uint8_t)((uint16_t)val[3] / 256U);
7689 buff[6] = (uint8_t)((uint16_t)val[3] - (buff[7] * 256U));
7690 buff[9] = (uint8_t)((uint16_t)val[4] / 256U);
7691 buff[8] = (uint8_t)((uint16_t)val[4] - (buff[9] * 256U));
7692 buff[11] = (uint8_t)((uint16_t)val[5] / 256U);
7693 buff[10] = (uint8_t)((uint16_t)val[5] - (buff[11] * 256U));
7694 index = 0x00U;
7696 &buff[index]);
7697
7698 if (ret == 0)
7699 {
7700 index++;
7702 &buff[index]);
7703 }
7704
7705 if (ret == 0)
7706 {
7707 index++;
7709 &buff[index]);
7710 }
7711
7712 if (ret == 0)
7713 {
7714 index++;
7716 &buff[index]);
7717 }
7718
7719 if (ret == 0)
7720 {
7721 index++;
7723 &buff[index]);
7724 }
7725
7726 if (ret == 0)
7727 {
7728 index++;
7730 &buff[index]);
7731 }
7732
7733 if (ret == 0)
7734 {
7735 index++;
7737 &buff[index]);
7738 }
7739
7740 if (ret == 0)
7741 {
7742 index++;
7744 &buff[index]);
7745 }
7746
7747 if (ret == 0)
7748 {
7749 index++;
7751 &buff[index]);
7752 }
7753
7754 if (ret == 0)
7755 {
7756 index++;
7758 &buff[index]);
7759 }
7760
7761 if (ret == 0)
7762 {
7763 index++;
7765 &buff[index]);
7766 }
7767
7768 if (ret == 0)
7769 {
7770 index++;
7772 &buff[index]);
7773 }
7774
7775 return ret;
7776}

References lsm6dso32_ln_pg_write_byte(), LSM6DSO32_MAG_SI_XX_H, LSM6DSO32_MAG_SI_XX_L, LSM6DSO32_MAG_SI_XY_H, LSM6DSO32_MAG_SI_XY_L, LSM6DSO32_MAG_SI_XZ_H, LSM6DSO32_MAG_SI_XZ_L, LSM6DSO32_MAG_SI_YY_H, LSM6DSO32_MAG_SI_YY_L, LSM6DSO32_MAG_SI_YZ_H, LSM6DSO32_MAG_SI_YZ_L, LSM6DSO32_MAG_SI_ZZ_H, and LSM6DSO32_MAG_SI_ZZ_L.

Here is the call graph for this function:

◆ lsm6dso32_mag_x_orient_get()

int32_t lsm6dso32_mag_x_orient_get ( stmdev_ctx_t ctx,
lsm6dso32_mag_x_axis_t val 
)

Magnetometer X-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[get].

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

Definition at line 8105 of file lsm6dso32_reg.c.

8107{
8109 int32_t ret;
8110
8112 (uint8_t *)&reg);
8113
8114 switch (reg.mag_x_axis)
8115 {
8116 case LSM6DSO32_X_EQ_Y:
8117 *val = LSM6DSO32_X_EQ_Y;
8118 break;
8119
8121 *val = LSM6DSO32_X_EQ_MIN_Y;
8122 break;
8123
8124 case LSM6DSO32_X_EQ_X:
8125 *val = LSM6DSO32_X_EQ_X;
8126 break;
8127
8129 *val = LSM6DSO32_X_EQ_MIN_X;
8130 break;
8131
8133 *val = LSM6DSO32_X_EQ_MIN_Z;
8134 break;
8135
8136 case LSM6DSO32_X_EQ_Z:
8137 *val = LSM6DSO32_X_EQ_Z;
8138 break;
8139
8140 default:
8141 *val = LSM6DSO32_X_EQ_Y;
8142 break;
8143 }
8144
8145 return ret;
8146}
#define LSM6DSO32_MAG_CFG_B
@ LSM6DSO32_X_EQ_X
@ LSM6DSO32_X_EQ_Z
@ LSM6DSO32_X_EQ_MIN_Z
@ LSM6DSO32_X_EQ_Y
@ LSM6DSO32_X_EQ_MIN_X
@ LSM6DSO32_X_EQ_MIN_Y

References lsm6dso32_ln_pg_read_byte(), LSM6DSO32_MAG_CFG_B, LSM6DSO32_X_EQ_MIN_X, LSM6DSO32_X_EQ_MIN_Y, LSM6DSO32_X_EQ_MIN_Z, LSM6DSO32_X_EQ_X, LSM6DSO32_X_EQ_Y, LSM6DSO32_X_EQ_Z, and lsm6dso32_mag_cfg_b_t::mag_x_axis.

Here is the call graph for this function:

◆ lsm6dso32_mag_x_orient_set()

int32_t lsm6dso32_mag_x_orient_set ( stmdev_ctx_t ctx,
lsm6dso32_mag_x_axis_t  val 
)

Magnetometer X-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[set].

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

Definition at line 8075 of file lsm6dso32_reg.c.

8077{
8079 int32_t ret;
8080
8082 (uint8_t *)&reg);
8083
8084 if (ret == 0)
8085 {
8086 reg.mag_x_axis = (uint8_t)val;
8088 (uint8_t *)&reg);
8089 }
8090
8091 return ret;
8092}

References lsm6dso32_ln_pg_read_byte(), lsm6dso32_ln_pg_write_byte(), LSM6DSO32_MAG_CFG_B, and lsm6dso32_mag_cfg_b_t::mag_x_axis.

Here is the call graph for this function:

◆ lsm6dso32_mag_y_orient_get()

int32_t lsm6dso32_mag_y_orient_get ( stmdev_ctx_t ctx,
lsm6dso32_mag_y_axis_t val 
)

Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[get].

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

Definition at line 8021 of file lsm6dso32_reg.c.

8023{
8025 int32_t ret;
8026
8028 (uint8_t *)&reg);
8029
8030 switch (reg.mag_y_axis)
8031 {
8032 case LSM6DSO32_Y_EQ_Y:
8033 *val = LSM6DSO32_Y_EQ_Y;
8034 break;
8035
8037 *val = LSM6DSO32_Y_EQ_MIN_Y;
8038 break;
8039
8040 case LSM6DSO32_Y_EQ_X:
8041 *val = LSM6DSO32_Y_EQ_X;
8042 break;
8043
8045 *val = LSM6DSO32_Y_EQ_MIN_X;
8046 break;
8047
8049 *val = LSM6DSO32_Y_EQ_MIN_Z;
8050 break;
8051
8052 case LSM6DSO32_Y_EQ_Z:
8053 *val = LSM6DSO32_Y_EQ_Z;
8054 break;
8055
8056 default:
8057 *val = LSM6DSO32_Y_EQ_Y;
8058 break;
8059 }
8060
8061 return ret;
8062}
#define LSM6DSO32_MAG_CFG_A
@ LSM6DSO32_Y_EQ_Y
@ LSM6DSO32_Y_EQ_X
@ LSM6DSO32_Y_EQ_Z
@ LSM6DSO32_Y_EQ_MIN_X
@ LSM6DSO32_Y_EQ_MIN_Y
@ LSM6DSO32_Y_EQ_MIN_Z

References lsm6dso32_ln_pg_read_byte(), LSM6DSO32_MAG_CFG_A, LSM6DSO32_Y_EQ_MIN_X, LSM6DSO32_Y_EQ_MIN_Y, LSM6DSO32_Y_EQ_MIN_Z, LSM6DSO32_Y_EQ_X, LSM6DSO32_Y_EQ_Y, LSM6DSO32_Y_EQ_Z, and lsm6dso32_mag_cfg_a_t::mag_y_axis.

Here is the call graph for this function:

◆ lsm6dso32_mag_y_orient_set()

int32_t lsm6dso32_mag_y_orient_set ( stmdev_ctx_t ctx,
lsm6dso32_mag_y_axis_t  val 
)

Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[set].

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

Definition at line 7991 of file lsm6dso32_reg.c.

7993{
7995 int32_t ret;
7996
7998 (uint8_t *)&reg);
7999
8000 if (ret == 0)
8001 {
8002 reg.mag_y_axis = (uint8_t)val;
8004 (uint8_t *) &reg);
8005 }
8006
8007 return ret;
8008}

References lsm6dso32_ln_pg_read_byte(), lsm6dso32_ln_pg_write_byte(), LSM6DSO32_MAG_CFG_A, and lsm6dso32_mag_cfg_a_t::mag_y_axis.

Here is the call graph for this function:

◆ lsm6dso32_mag_z_orient_get()

int32_t lsm6dso32_mag_z_orient_get ( stmdev_ctx_t ctx,
lsm6dso32_mag_z_axis_t val 
)

Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[get].

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

Definition at line 7937 of file lsm6dso32_reg.c.

7939{
7941 int32_t ret;
7942
7944 (uint8_t *)&reg);
7945
7946 switch (reg.mag_z_axis)
7947 {
7948 case LSM6DSO32_Z_EQ_Y:
7949 *val = LSM6DSO32_Z_EQ_Y;
7950 break;
7951
7953 *val = LSM6DSO32_Z_EQ_MIN_Y;
7954 break;
7955
7956 case LSM6DSO32_Z_EQ_X:
7957 *val = LSM6DSO32_Z_EQ_X;
7958 break;
7959
7961 *val = LSM6DSO32_Z_EQ_MIN_X;
7962 break;
7963
7965 *val = LSM6DSO32_Z_EQ_MIN_Z;
7966 break;
7967
7968 case LSM6DSO32_Z_EQ_Z:
7969 *val = LSM6DSO32_Z_EQ_Z;
7970 break;
7971
7972 default:
7973 *val = LSM6DSO32_Z_EQ_Y;
7974 break;
7975 }
7976
7977 return ret;
7978}
@ LSM6DSO32_Z_EQ_MIN_Z
@ LSM6DSO32_Z_EQ_MIN_X
@ LSM6DSO32_Z_EQ_Z
@ LSM6DSO32_Z_EQ_MIN_Y
@ LSM6DSO32_Z_EQ_Y
@ LSM6DSO32_Z_EQ_X

References lsm6dso32_ln_pg_read_byte(), LSM6DSO32_MAG_CFG_A, LSM6DSO32_Z_EQ_MIN_X, LSM6DSO32_Z_EQ_MIN_Y, LSM6DSO32_Z_EQ_MIN_Z, LSM6DSO32_Z_EQ_X, LSM6DSO32_Z_EQ_Y, LSM6DSO32_Z_EQ_Z, and lsm6dso32_mag_cfg_a_t::mag_z_axis.

Here is the call graph for this function:

◆ lsm6dso32_mag_z_orient_set()

int32_t lsm6dso32_mag_z_orient_set ( stmdev_ctx_t ctx,
lsm6dso32_mag_z_axis_t  val 
)

Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).[set].

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

Definition at line 7907 of file lsm6dso32_reg.c.

7909{
7911 int32_t ret;
7912
7914 (uint8_t *)&reg);
7915
7916 if (ret == 0)
7917 {
7918 reg.mag_z_axis = (uint8_t) val;
7920 (uint8_t *)&reg);
7921 }
7922
7923 return ret;
7924}

References lsm6dso32_ln_pg_read_byte(), lsm6dso32_ln_pg_write_byte(), LSM6DSO32_MAG_CFG_A, and lsm6dso32_mag_cfg_a_t::mag_z_axis.

Here is the call graph for this function: