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

This section group all the functions concerning the free fall detection. More...

Collaboration diagram for LSM6DSO32_free_fall:

Functions

int32_t lsm6dso32_ff_threshold_set (stmdev_ctx_t *ctx, lsm6dso32_ff_ths_t val)
 Free fall threshold setting.[set].
 
int32_t lsm6dso32_ff_threshold_get (stmdev_ctx_t *ctx, lsm6dso32_ff_ths_t *val)
 Free fall threshold setting.[get].
 
int32_t lsm6dso32_ff_dur_set (stmdev_ctx_t *ctx, uint8_t val)
 Free-fall duration event.[set] 1LSb = 1 / ODR.
 
int32_t lsm6dso32_ff_dur_get (stmdev_ctx_t *ctx, uint8_t *val)
 Free-fall duration event.[get] 1LSb = 1 / ODR.
 

Detailed Description

This section group all the functions concerning the free fall detection.

Function Documentation

◆ lsm6dso32_ff_dur_get()

int32_t lsm6dso32_ff_dur_get ( stmdev_ctx_t ctx,
uint8_t *  val 
)

Free-fall duration event.[get] 1LSb = 1 / ODR.

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

Definition at line 5043 of file lsm6dso32_reg.c.

5044{
5045 lsm6dso32_wake_up_dur_t wake_up_dur;
5046 lsm6dso32_free_fall_t free_fall;
5047 int32_t ret;
5048
5050 (uint8_t *)&wake_up_dur, 1);
5051
5052 if (ret == 0)
5053 {
5055 (uint8_t *)&free_fall, 1);
5056 *val = (wake_up_dur.ff_dur << 5) + free_fall.ff_dur;
5057 }
5058
5059 return ret;
5060}
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_WAKE_UP_DUR
#define LSM6DSO32_FREE_FALL

References lsm6dso32_wake_up_dur_t::ff_dur, LSM6DSO32_FREE_FALL, lsm6dso32_read_reg(), and LSM6DSO32_WAKE_UP_DUR.

Here is the call graph for this function:

◆ lsm6dso32_ff_dur_set()

int32_t lsm6dso32_ff_dur_set ( stmdev_ctx_t ctx,
uint8_t  val 
)

Free-fall duration event.[set] 1LSb = 1 / ODR.

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

Definition at line 5002 of file lsm6dso32_reg.c.

5003{
5004 lsm6dso32_wake_up_dur_t wake_up_dur;
5005 lsm6dso32_free_fall_t free_fall;
5006 int32_t ret;
5007
5009 (uint8_t *)&wake_up_dur, 1);
5010
5011 if (ret == 0)
5012 {
5014 (uint8_t *)&free_fall, 1);
5015 }
5016
5017 if (ret == 0)
5018 {
5019 wake_up_dur.ff_dur = ((uint8_t)val & 0x20U) >> 5;
5020 free_fall.ff_dur = (uint8_t)val & 0x1FU;
5022 (uint8_t *)&wake_up_dur, 1);
5023 }
5024
5025 if (ret == 0)
5026 {
5028 (uint8_t *)&free_fall, 1);
5029 }
5030
5031 return ret;
5032}
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_wake_up_dur_t::ff_dur, lsm6dso32_free_fall_t::ff_dur, LSM6DSO32_FREE_FALL, lsm6dso32_read_reg(), LSM6DSO32_WAKE_UP_DUR, and lsm6dso32_write_reg().

Here is the call graph for this function:

◆ lsm6dso32_ff_threshold_get()

int32_t lsm6dso32_ff_threshold_get ( stmdev_ctx_t ctx,
lsm6dso32_ff_ths_t val 
)

Free fall threshold setting.[get].

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

Definition at line 4963 of file lsm6dso32_reg.c.

4965{
4967 int32_t ret;
4968
4969 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_FREE_FALL, (uint8_t *)&reg, 1);
4970
4971 switch (reg.ff_ths)
4972 {
4975 break;
4976
4979 break;
4980
4983 break;
4984
4985 default:
4987 break;
4988 }
4989
4990 return ret;
4991}
@ LSM6DSO32_FF_TSH_500mg
@ LSM6DSO32_FF_TSH_438mg
@ LSM6DSO32_FF_TSH_312mg

References lsm6dso32_free_fall_t::ff_ths, LSM6DSO32_FF_TSH_312mg, LSM6DSO32_FF_TSH_438mg, LSM6DSO32_FF_TSH_500mg, LSM6DSO32_FREE_FALL, and lsm6dso32_read_reg().

Here is the call graph for this function:

◆ lsm6dso32_ff_threshold_set()

int32_t lsm6dso32_ff_threshold_set ( stmdev_ctx_t ctx,
lsm6dso32_ff_ths_t  val 
)

Free fall threshold setting.[set].

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

Definition at line 4938 of file lsm6dso32_reg.c.

4940{
4942 int32_t ret;
4943
4944 ret = lsm6dso32_read_reg(ctx, LSM6DSO32_FREE_FALL, (uint8_t *)&reg, 1);
4945
4946 if (ret == 0)
4947 {
4948 reg.ff_ths = (uint8_t)val;
4949 ret = lsm6dso32_write_reg(ctx, LSM6DSO32_FREE_FALL, (uint8_t *)&reg, 1);
4950 }
4951
4952 return ret;
4953}

References lsm6dso32_free_fall_t::ff_ths, LSM6DSO32_FREE_FALL, lsm6dso32_read_reg(), and lsm6dso32_write_reg().

Here is the call graph for this function: