STMicroelectronics / iis3dwb-pid

iis3dwb platform independent driver based on Standard C language and compliant with MISRA standard
BSD 3-Clause "New" or "Revised" License
12 stars 9 forks source link

iis3dwb_fifo_out_multi_raw_get dont work #7

Closed Steffen-W closed 1 year ago

Steffen-W commented 2 years ago

Unfortunately, the iis3dwb_fifo_out_multi_raw_get function does not work correctly. Most likely it is due to sizeof(iis3dwb_fifo_out_raw_t).

  typedef struct
  {
    enum
    {
      IIS3DWB_XL_TAG = 2,
      IIS3DWB_TEMPERATURE_TAG,
      IIS3DWB_TIMESTAMP_TAG,
    } tag;
    uint8_t data[6];
  } iis3dwb_fifo_out_raw_t;

int32_t iis3dwb_fifo_out_multi_raw_get(stmdev_ctx_t *ctx,
                                       iis3dwb_fifo_out_raw_t *fdata,
                                       uint16_t num)
{
  int32_t ret;

  /* read out all FIFO entries in a single read */
  ret = iis3dwb_read_reg(ctx, IIS3DWB_FIFO_DATA_OUT_TAG,
                         (uint8_t *)fdata,
                         sizeof(iis3dwb_fifo_out_raw_t) * num);

  return ret;
}

The enum has the size 4 byte. Probably the size 1 byte was expected. The flag "-fshort-enums" is not a option for me.

escherstair commented 2 years ago

Hello @Steffen-W this is another problem related to what I described in #6, with the same root reason

avisconti commented 1 year ago

Closed via PR #9