/* Number of unread sensor data(TAG + 6 bytes) stored in FIFO..  */
int32_t lsm6dso_fifo_data_level_get(stmdev_ctx_t *ctx, uint16_t *val)
/* Number of unread sensor data(TAG + 6 bytes) stored in FIFO..  */
int32_t lsm6dso_fifo_data_level_get(stmdev_ctx_t *ctx, uint16_t *val)
{
  lsm6dso_fifo_status1_t fifo_status1;
  lsm6dso_fifo_status2_t fifo_status2;
  int32_t ret;
  ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_STATUS1,
                         (uint8_t *)&fifo_status1, 1);
  if (ret == 0) {
    ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_STATUS2,
                           (uint8_t *)&fifo_status2, 1);
    *val = ((uint16_t)fifo_status2.diff_fifo << 8) +
           (uint16_t)fifo_status1.diff_fifo;
  }
  return ret;
}