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

This section groups all the functions that manage pedometer. More...

Collaboration diagram for LSM6DSO32_Pedometer:

Functions

int32_t lsm6dso32_pedo_sens_set (stmdev_ctx_t *ctx, lsm6dso32_pedo_md_t val)
 Enable pedometer algorithm.[set].
 
int32_t lsm6dso32_pedo_sens_get (stmdev_ctx_t *ctx, lsm6dso32_pedo_md_t *val)
 Enable pedometer algorithm.[get].
 
int32_t lsm6dso32_pedo_step_detect_get (stmdev_ctx_t *ctx, uint8_t *val)
 Interrupt status bit for step detection.[get].
 
int32_t lsm6dso32_pedo_debounce_steps_set (stmdev_ctx_t *ctx, uint8_t *buff)
 Pedometer debounce configuration register (r/w).[set].
 
int32_t lsm6dso32_pedo_debounce_steps_get (stmdev_ctx_t *ctx, uint8_t *buff)
 Pedometer debounce configuration register (r/w).[get].
 
int32_t lsm6dso32_pedo_steps_period_set (stmdev_ctx_t *ctx, uint16_t val)
 Time period register for step detection on delta time (r/w).[set].
 
int32_t lsm6dso32_pedo_steps_period_get (stmdev_ctx_t *ctx, uint16_t *val)
 Time period register for step detection on delta time (r/w).[get].
 
int32_t lsm6dso32_pedo_int_mode_set (stmdev_ctx_t *ctx, lsm6dso32_carry_count_en_t val)
 Set when user wants to generate interrupt on count overflow event/every step.[set].
 
int32_t lsm6dso32_pedo_int_mode_get (stmdev_ctx_t *ctx, lsm6dso32_carry_count_en_t *val)
 Set when user wants to generate interrupt on count overflow event/every step.[get].
 

Detailed Description

This section groups all the functions that manage pedometer.

Function Documentation

◆ lsm6dso32_pedo_debounce_steps_get()

int32_t lsm6dso32_pedo_debounce_steps_get ( stmdev_ctx_t ctx,
uint8_t *  buff 
)

Pedometer debounce configuration 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 7131 of file lsm6dso32_reg.c.

7133{
7134 int32_t ret;
7135
7137 buff);
7138
7139 return ret;
7140}
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_PEDO_DEB_STEPS_CONF

References lsm6dso32_ln_pg_read_byte(), and LSM6DSO32_PEDO_DEB_STEPS_CONF.

Here is the call graph for this function:

◆ lsm6dso32_pedo_debounce_steps_set()

int32_t lsm6dso32_pedo_debounce_steps_set ( stmdev_ctx_t ctx,
uint8_t *  buff 
)

Pedometer debounce configuration 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 7112 of file lsm6dso32_reg.c.

7114{
7115 int32_t ret;
7116
7118 buff);
7119
7120 return ret;
7121}
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(), and LSM6DSO32_PEDO_DEB_STEPS_CONF.

Here is the call graph for this function:

◆ lsm6dso32_pedo_int_mode_get()

int32_t lsm6dso32_pedo_int_mode_get ( stmdev_ctx_t ctx,
lsm6dso32_carry_count_en_t val 
)

Set when user wants to generate interrupt on count overflow event/every step.[get].

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

Definition at line 7235 of file lsm6dso32_reg.c.

7237{
7239 int32_t ret;
7240
7242 (uint8_t *)&reg);
7243
7244 switch (reg.carry_count_en)
7245 {
7247 *val = LSM6DSO32_EVERY_STEP;
7248 break;
7249
7252 break;
7253
7254 default:
7255 *val = LSM6DSO32_EVERY_STEP;
7256 break;
7257 }
7258
7259 return ret;
7260}
#define LSM6DSO32_PEDO_CMD_REG
@ LSM6DSO32_COUNT_OVERFLOW
@ LSM6DSO32_EVERY_STEP

References lsm6dso32_pedo_cmd_reg_t::carry_count_en, LSM6DSO32_COUNT_OVERFLOW, LSM6DSO32_EVERY_STEP, lsm6dso32_ln_pg_read_byte(), and LSM6DSO32_PEDO_CMD_REG.

Here is the call graph for this function:

◆ lsm6dso32_pedo_int_mode_set()

int32_t lsm6dso32_pedo_int_mode_set ( stmdev_ctx_t ctx,
lsm6dso32_carry_count_en_t  val 
)

Set when user wants to generate interrupt on count overflow event/every step.[set].

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

Definition at line 7207 of file lsm6dso32_reg.c.

7209{
7211 int32_t ret;
7212
7214 (uint8_t *)&reg);
7215
7216 if (ret == 0)
7217 {
7218 reg.carry_count_en = (uint8_t)val;
7220 (uint8_t *)&reg);
7221 }
7222
7223 return ret;
7224}

References lsm6dso32_pedo_cmd_reg_t::carry_count_en, lsm6dso32_ln_pg_read_byte(), lsm6dso32_ln_pg_write_byte(), and LSM6DSO32_PEDO_CMD_REG.

Here is the call graph for this function:

◆ lsm6dso32_pedo_sens_get()

int32_t lsm6dso32_pedo_sens_get ( stmdev_ctx_t ctx,
lsm6dso32_pedo_md_t val 
)

Enable pedometer algorithm.[get].

Parameters
ctxread / write interface definitions
valturn on and configure pedometer
Return values
interfacestatus (MANDATORY: return 0 -> no Error)

Definition at line 7008 of file lsm6dso32_reg.c.

7010{
7011 lsm6dso32_emb_func_en_a_t emb_func_en_a;
7012 lsm6dso32_emb_func_en_b_t emb_func_en_b;
7013 lsm6dso32_pedo_cmd_reg_t pedo_cmd_reg;
7014 int32_t ret;
7015
7017 (uint8_t *)&pedo_cmd_reg);
7018
7019 if (ret == 0)
7020 {
7022 }
7023
7024 if (ret == 0)
7025 {
7027 (uint8_t *)&emb_func_en_a, 1);
7028 }
7029
7030 if (ret == 0)
7031 {
7033 (uint8_t *)&emb_func_en_b, 1);
7034 }
7035
7036 if (ret == 0)
7037 {
7039 }
7040
7041 switch ((pedo_cmd_reg.ad_det_en << 5) | (pedo_cmd_reg.fp_rejection_en
7042 << 4) |
7043 (emb_func_en_b.pedo_adv_en << 1) | emb_func_en_a.pedo_en)
7044 {
7047 break;
7048
7051 break;
7052
7055 break;
7056
7059 break;
7060
7063 break;
7064
7065 default:
7067 break;
7068 }
7069
7070 return ret;
7071}
int32_t __weak lsm6dso32_read_reg(stmdev_ctx_t *ctx, uint8_t reg, uint8_t *data, uint16_t len)
Read generic device register.
int32_t lsm6dso32_mem_bank_set(stmdev_ctx_t *ctx, lsm6dso32_reg_access_t val)
Enable access to the embedded functions/sensor hub configuration registers.[set].
@ LSM6DSO32_USER_BANK
@ LSM6DSO32_EMBEDDED_FUNC_BANK
#define LSM6DSO32_EMB_FUNC_EN_A
@ LSM6DSO32_PEDO_BASE_MODE
@ LSM6DSO32_PEDO_DISABLE
@ LSM6DSO32_PEDO_ADV_MODE
@ LSM6DSO32_FALSE_STEP_REJ
@ LSM6DSO32_FALSE_STEP_REJ_ADV_MODE
#define LSM6DSO32_EMB_FUNC_EN_B

References lsm6dso32_pedo_cmd_reg_t::ad_det_en, lsm6dso32_pedo_cmd_reg_t::fp_rejection_en, LSM6DSO32_EMB_FUNC_EN_A, LSM6DSO32_EMB_FUNC_EN_B, LSM6DSO32_EMBEDDED_FUNC_BANK, LSM6DSO32_FALSE_STEP_REJ, LSM6DSO32_FALSE_STEP_REJ_ADV_MODE, lsm6dso32_ln_pg_read_byte(), lsm6dso32_mem_bank_set(), LSM6DSO32_PEDO_ADV_MODE, LSM6DSO32_PEDO_BASE_MODE, LSM6DSO32_PEDO_CMD_REG, LSM6DSO32_PEDO_DISABLE, lsm6dso32_read_reg(), LSM6DSO32_USER_BANK, lsm6dso32_emb_func_en_b_t::pedo_adv_en, and lsm6dso32_emb_func_en_a_t::pedo_en.

Here is the call graph for this function:

◆ lsm6dso32_pedo_sens_set()

int32_t lsm6dso32_pedo_sens_set ( stmdev_ctx_t ctx,
lsm6dso32_pedo_md_t  val 
)

Enable pedometer algorithm.[set].

Parameters
ctxread / write interface definitions
valturn on and configure pedometer
Return values
interfacestatus (MANDATORY: return 0 -> no Error)

Definition at line 6942 of file lsm6dso32_reg.c.

6944{
6945 lsm6dso32_emb_func_en_a_t emb_func_en_a;
6946 lsm6dso32_emb_func_en_b_t emb_func_en_b;
6947 lsm6dso32_pedo_cmd_reg_t pedo_cmd_reg;
6948 int32_t ret;
6949
6951 (uint8_t *)&pedo_cmd_reg);
6952
6953 if (ret == 0)
6954 {
6956 }
6957
6958 if (ret == 0)
6959 {
6961 (uint8_t *)&emb_func_en_a, 1);
6962 }
6963
6964 if (ret == 0)
6965 {
6967 (uint8_t *)&emb_func_en_b, 1);
6968 emb_func_en_a.pedo_en = (uint8_t)val & 0x01U;
6969 emb_func_en_b.pedo_adv_en = ((uint8_t)val & 0x02U) >> 1;
6970 pedo_cmd_reg.fp_rejection_en = ((uint8_t)val & 0x10U) >> 4;
6971 pedo_cmd_reg.ad_det_en = ((uint8_t)val & 0x20U) >> 5;
6972 }
6973
6974 if (ret == 0)
6975 {
6977 (uint8_t *)&emb_func_en_a, 1);
6978 }
6979
6980 if (ret == 0)
6981 {
6983 (uint8_t *)&emb_func_en_b, 1);
6984 }
6985
6986 if (ret == 0)
6987 {
6989 }
6990
6991 if (ret == 0)
6992 {
6994 (uint8_t *)&pedo_cmd_reg);
6995 }
6996
6997 return ret;
6998}
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_pedo_cmd_reg_t::ad_det_en, lsm6dso32_pedo_cmd_reg_t::fp_rejection_en, LSM6DSO32_EMB_FUNC_EN_A, LSM6DSO32_EMB_FUNC_EN_B, LSM6DSO32_EMBEDDED_FUNC_BANK, lsm6dso32_ln_pg_read_byte(), lsm6dso32_ln_pg_write_byte(), lsm6dso32_mem_bank_set(), LSM6DSO32_PEDO_CMD_REG, lsm6dso32_read_reg(), LSM6DSO32_USER_BANK, lsm6dso32_write_reg(), and lsm6dso32_emb_func_en_a_t::pedo_en.

Here is the call graph for this function:

◆ lsm6dso32_pedo_step_detect_get()

int32_t lsm6dso32_pedo_step_detect_get ( stmdev_ctx_t ctx,
uint8_t *  val 
)

Interrupt status bit for step detection.[get].

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

Definition at line 7081 of file lsm6dso32_reg.c.

7083{
7085 int32_t ret;
7086
7088
7089 if (ret == 0)
7090 {
7092 (uint8_t *)&reg, 1);
7093 }
7094
7095 if (ret == 0)
7096 {
7097 *val = reg.is_step_det;
7099 }
7100
7101 return ret;
7102}
#define LSM6DSO32_EMB_FUNC_STATUS

References lsm6dso32_emb_func_status_t::is_step_det, LSM6DSO32_EMB_FUNC_STATUS, LSM6DSO32_EMBEDDED_FUNC_BANK, lsm6dso32_mem_bank_set(), lsm6dso32_read_reg(), and LSM6DSO32_USER_BANK.

Here is the call graph for this function:

◆ lsm6dso32_pedo_steps_period_get()

int32_t lsm6dso32_pedo_steps_period_get ( stmdev_ctx_t ctx,
uint16_t *  val 
)

Time period register for step detection on delta time (r/w).[get].

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

Definition at line 7178 of file lsm6dso32_reg.c.

7180{
7181 uint8_t buff[2];
7182 int32_t ret;
7183
7185 &buff[0]);
7186
7187 if (ret == 0)
7188 {
7190 &buff[1]);
7191 *val = buff[1];
7192 *val = (*val * 256U) + buff[0];
7193 }
7194
7195 return ret;
7196}
#define LSM6DSO32_PEDO_SC_DELTAT_L
#define LSM6DSO32_PEDO_SC_DELTAT_H

References lsm6dso32_ln_pg_read_byte(), LSM6DSO32_PEDO_SC_DELTAT_H, and LSM6DSO32_PEDO_SC_DELTAT_L.

Here is the call graph for this function:

◆ lsm6dso32_pedo_steps_period_set()

int32_t lsm6dso32_pedo_steps_period_set ( stmdev_ctx_t ctx,
uint16_t  val 
)

Time period register for step detection on delta time (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 7150 of file lsm6dso32_reg.c.

7152{
7153 uint8_t buff[2];
7154 int32_t ret;
7155
7156 buff[1] = (uint8_t)(val / 256U);
7157 buff[0] = (uint8_t)(val - (buff[1] * 256U));
7159 &buff[0]);
7160
7161 if (ret == 0)
7162 {
7164 &buff[1]);
7165 }
7166
7167 return ret;
7168}

References lsm6dso32_ln_pg_write_byte(), LSM6DSO32_PEDO_SC_DELTAT_H, and LSM6DSO32_PEDO_SC_DELTAT_L.

Here is the call graph for this function: