Commit fa481784 authored by Armando Visconti's avatar Armando Visconti Committed by Maureen Helm
Browse files

sensor/stmemsc: Align stmemsc i/f to v1.02



Align stmemsc HAL i/f to v1.02.

Signed-off-by: default avatarArmando Visconti <armando.visconti@st.com>
parent 55cf9ad2
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -6,8 +6,10 @@

set(stmems_pids
  a3g4250d
  ais2dw12
  ais328dq
  ais3624dq
  asm330lhh
  h3lis331dl
  hts221
  i3g4250d
@@ -16,12 +18,16 @@ set(stmems_pids
  iis2mdc
  iis328dq
  iis3dhhc
  iis3dwb
  ism303dac
  ism330dhcx
  ism330dlc
  l20g20is
  l3gd20h
  lis2de12
  lis2dh12
  lis2ds12
  lis2dtw12
  lis2dw12
  lis2hh12
  lis2mdl
@@ -33,14 +39,18 @@ set(stmems_pids
  lps22hb
  lps22hh
  lps25hb
  lps27hhw
  lps33hw
  lps33w
  lsm303agr
  lsm303ah
  lsm6ds3
  lsm6ds3tr_c
  lsm6dsl
  lsm6dsm
  lsm6dso
  lsm6dsox
  lsm6dsr
  lsm9ds1
  stts751
  )
+5 −5
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ Origin:
   https://www.st.com/en/embedded-software/c-driver-mems.html

Status:
   version v1.00
   version v1.02

Purpose:
   ST Microelectronics standard C platform-independent drivers for MEMS
@@ -34,9 +34,9 @@ Description:
   int platform_wr(void *handle, u8_t reg, u8_t *bufp, u16_t len);
   int platform_rd(void *handle, u8_t reg, u8_t *bufp, u16_t len);

   xyz_ctx_t xyz_ctx = {
       .read_reg = (xyz_read_ptr) platform_rd,
       .write_reg = (xyz_write_ptr) platform_wr,
   stmdev_ctx_t stmdev_ctx = {
       .read_reg = (stmdev_read_ptr) platform_rd,
       .write_reg = (stmdev_write_ptr) platform_wr,
   };

Dependencies:
@@ -46,7 +46,7 @@ URL:
   https://www.st.com/en/embedded-software/c-driver-mems.html

commit:
   version v1.00
   version v1.02

Maintained-by:
   ST Microelectronics
+923 −0

File added.

Preview size limit exceeded, changes collapsed.

+151 −0
Original line number Diff line number Diff line
/*
 ******************************************************************************
 * @file    fifo_utility.h
 * @author  Sensor Solutions Software Team
 * @brief   This file contains all the functions prototypes for the
 *          fifo_utility.c.
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *   1. Redistributions of source code must retain the above copyright notice,
 *      this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *   3. Neither the name of STMicroelectronics nor the names of its
 *      contributors may be used to endorse or promote products derived from
 *      this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ST_FIFO_H
#define ST_FIFO_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include <stdint.h>

/** @addtogroup FIFO utility
  * @{
  *
  */

/** @defgroup FIFO_pubblic_definitions
  * @{
  *
  */

typedef enum {
  ST_FIFO_OK = 0,
  ST_FIFO_ERR
} st_fifo_status;

typedef enum {
  ST_FIFO_GYROSCOPE,
  ST_FIFO_ACCELEROMETER,
  ST_FIFO_TEMPERATURE,
  ST_FIFO_EXT_SENSOR0,
  ST_FIFO_EXT_SENSOR1,
  ST_FIFO_EXT_SENSOR2,
  ST_FIFO_EXT_SENSOR3,
  ST_FIFO_STEP_COUNTER,
  ST_FIFO_6X_GAME_RV,
  ST_FIFO_6X_GEOM_RV,
  ST_FIFO_9X_RV,
  ST_FIFO_GYRO_BIAS,
  ST_FIFO_GRAVITY,
  ST_FIFO_MAGNETOMETER_CALIB,
  ST_FIFO_EXT_SENSOR_NACK,
  ST_FIFO_NONE
} st_fifo_sensor_type;

typedef struct {
  uint8_t fifo_data_out[7]; /* output fifo registers */
} st_fifo_raw_slot;

typedef struct {
  uint32_t timestamp;
  st_fifo_sensor_type sensor_tag;
  uint8_t raw_data[6];
} st_fifo_out_slot;

/**
  * @defgroup axisXbitXX_t
  * @brief    This union is useful to represent different sensors data type.
  *           This union are not need by the driver.
  *
  *           REMOVING the union you are compliant with:
  *           MISRA-C 2012 [Rule 19.2] -> " Union are not allowed "
  *
  * @{
  *
  */

typedef union {
  int16_t data[3];       /* 3 axes mems */
  int16_t temp;          /* temperature sensor */
  uint16_t steps;        /* step counter */
  uint16_t quat[3];      /* quaternion 3 axes format [x,y,z] */
  uint8_t nack;          /* ext sensor nack index */
  uint8_t raw_data[6];   /* raw data */
} sensor_data_t;

/**
  * @}
  *
  */

/**
  * @}
  *
  */

st_fifo_status st_fifo_init(float_t bdr_xl, float_t bdr_gy, float_t bdr_vsens);

st_fifo_status st_fifo_decompress(st_fifo_out_slot *fifo_out_slot,
                                  st_fifo_raw_slot *fifo_raw_slot,
                                  uint16_t *out_slot_size,
                                  uint16_t stream_size);

void st_fifo_sort(st_fifo_out_slot *fifo_out_slot, uint16_t out_slot_size);

uint16_t st_fifo_get_sensor_occurrence(st_fifo_out_slot *fifo_out_slot,
                                       uint16_t out_slot_size,
                                       st_fifo_sensor_type sensor_type);

void st_fifo_extract_sensor(st_fifo_out_slot *sensor_out_slot,
                            st_fifo_out_slot *fifo_out_slot,
                            uint16_t out_slot_size,
                            st_fifo_sensor_type sensor_type);

#ifdef __cplusplus
}
#endif

#endif /* ST_FIFO_H */

/**
  * @}
  *
  */
+69 −86

File changed.

Preview size limit exceeded, changes collapsed.

Loading