Commit 0ec40aed authored by Armando Visconti's avatar Armando Visconti Committed by Anas Nashif
Browse files

sensor/stmemsc: Introduce STMEMS Standard C Drivers

This package contains platform independent drivers written in C
language for STMicroelectronics sensors. The aim of this package
is to provide a common, clean and stable interface to access sensor
registers.

Origin: ST Microelectronics
License: BSD-3-Clause
URL: https://www.st.com/en/embedded-software/c-driver-mems.html


Commit: v1.00
Purpose: provide a common and stable i/f to access sensor registers
Maintained-by: ST Microelectronics

Signed-off-by: default avatarArmando Visconti <armando.visconti@st.com>
parent b6c9262e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -22,3 +22,6 @@ if(CONFIG_HAS_STLIB)
    zephyr_sources(audio/microphone/OpenPDMFilter.c)
  endif()
endif()

# STMEMSC - Hardware Abstraction Layer for ST sensor
add_subdirectory_ifdef(CONFIG_HAS_STMEMSC sensor/stmemsc)
+58 −0
Original line number Diff line number Diff line
# Makefile - STMems_Standard_C_drivers
#
# Copyright (c) 2019 STMicroelectronics
#
# SPDX-License-Identifier: Apache-2.0

set(stmems_pids
  a3g4250d
  ais328dq
  ais3624dq
  h3lis331dl
  hts221
  i3g4250d
  iis2dh
  iis2dlpc
  iis2mdc
  iis328dq
  iis3dhhc
  ism303dac
  ism330dlc
  l20g20is
  lis2de12
  lis2dh12
  lis2ds12
  lis2dw12
  lis2hh12
  lis2mdl
  lis331dlh
  lis3de
  lis3dhh
  lis3dh
  lis3mdl
  lps22hb
  lps22hh
  lps25hb
  lps33hw
  lsm303agr
  lsm303ah
  lsm6ds3
  lsm6dsl
  lsm6dsm
  lsm6dso
  lsm6dsox
  lsm9ds1
  stts751
  )

foreach(stmems_pid ${stmems_pids})
  string(TOUPPER ${stmems_pid} pid_to_upper)
  if(CONFIG_USE_STDC_${pid_to_upper})
    zephyr_include_directories(
        ${stmems_pid}_STdC/driver/
        )
    zephyr_sources(
        ${stmems_pid}_STdC/driver/${stmems_pid}_reg.c
        )
  endif()
endforeach()

sensor/stmemsc/LICENSE

0 → 100644
+29 −0
Original line number Diff line number Diff line
BSD 3-Clause License

Copyright (c) 2019, STMicroelectronics
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* 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.

* Neither the name of the copyright holder 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.

sensor/stmemsc/README

0 → 100644
+58 −0
Original line number Diff line number Diff line
C-Driver-MEMS
#############

Origin:
   ST Microelectronics
   https://www.st.com/en/embedded-software/c-driver-mems.html

Status:
   version v1.00

Purpose:
   ST Microelectronics standard C platform-independent drivers for MEMS
   motion and environmental sensors.

Description:
   This package is an extract (examples have not been retained) of official
   C-Driver-MEMS package written by ST Microelectronics.
   It contains standard drivers for STMicroelectronics MEMS sensors to
   provide a common and stable interface to access sensor registers.
   For each supported sensor following files are provided:

       - xyz_reg.c: contains the function to read/write 'xyz' sensor registers
       - xyz_reg.h: contains structures and defines to describe in details
                    the 'xyz' sensor registers.

   The driver is platform-independent, you only need to define the two
   functions for read and write transactions from the sensor hardware bus
   (ie. SPI or I2C).

   Define in your 'xyz' driver code the read and write functions that use the
   I2C or SPI platform driver like the following:

   /** Please note that is MANDATORY: return 0 -> no Error.**/
   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,
   };

Dependencies:
    None.

URL:
   https://www.st.com/en/embedded-software/c-driver-mems.html

commit:
   version v1.00

Maintained-by:
   ST Microelectronics

License:
   BSD-3-Clause

License Link:
   https://opensource.org/licenses/BSD-3-Clause
+1722 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading