Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

lsm6dso

Open
#141 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
embedded-iot

Research direction

Locate lsm6dso_write_lis2mdl_cx in the LSM6DSO driver sources and inspect its callers and the related lis2mdl_mag_user_offset_set function. Check how the len argument is expected to affect the write operation, then verify that the behavior is covered by the relevant driver checks or examples and that writes with lengths other than one behave correctly.

Written by the indexing model from the issue text.

Description

bug
Device part numbers

lsm6dso

Type of bug

func

static int32_t lsm6dso_write_lis2mdl_cx(void *ctx, uint8_t reg,
                                        const uint8_t *data, uint16_t len)
Describe the bug

the param "len" doesn't use in func "lsm6dso_write_lis2mdl_cx"

Additional context
static int32_t lsm6dso_write_lis2mdl_cx(void *ctx, uint8_t reg,
                                        const uint8_t *data, uint16_t len)
{
  axis3bit16_t data_raw_acceleration;
  int32_t ret;
  uint8_t drdy;
  lsm6dso_status_master_t master_status;
  lsm6dso_sh_cfg_write_t sh_cfg_write;
  /* Configure Sensor Hub to read LIS2MDL. */
  sh_cfg_write.slv0_add = (LIS2MDL_I2C_ADD & 0xFEU) >>
                          1; /* 7bit I2C address */
  sh_cfg_write.slv0_subadd = reg,
  sh_cfg_write.slv0_data = *data,
  ret = lsm6dso_sh_cfg_write(&ag_ctx, &sh_cfg_write);
  /* Disable accelerometer. */
  lsm6dso_xl_data_rate_set(&ag_ctx, LSM6DSO_XL_ODR_OFF);
  /* Enable I2C Master. */
  lsm6dso_sh_master_set(&ag_ctx, PROPERTY_ENABLE);
  /* Enable accelerometer to trigger Sensor Hub operation. */
  lsm6dso_xl_data_rate_set(&ag_ctx, LSM6DSO_XL_ODR_104Hz);
  /* Wait Sensor Hub operation flag set. */
  lsm6dso_acceleration_raw_get(&ag_ctx, data_raw_acceleration.i16bit);

  do {
    HAL_Delay(20);
    lsm6dso_xl_flag_data_ready_get(&ag_ctx, &drdy);
  } while (!drdy);

  do {
    HAL_Delay(20);
    lsm6dso_sh_status_get(&ag_ctx, &master_status);
  } while (!master_status.sens_hub_endop);

  /* Disable I2C master and XL (trigger). */
  lsm6dso_sh_master_set(&ag_ctx, PROPERTY_DISABLE);
  lsm6dso_xl_data_rate_set(&ag_ctx, LSM6DSO_XL_ODR_OFF);
  return ret;
}

that will cause the API write len is not 1, issue coming, like func "lis2mdl_mag_user_offset_set".

Dominant language
C
Stars
883
Forks
539
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from STMicroelectronics/STMems_Standard_C_drivers

All issues in STMicroelectronics/STMems_Standard_C_drivers

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.