Skip to content

Commit 6b1453e

Browse files
committed
ext/hal: 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. Library is located in ext/hal/st/stmemsc/ 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: Armando Visconti <[email protected]>
1 parent 69fc29d commit 6b1453e

File tree

89 files changed

+153112
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+153112
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
/ext/hal/nordic/ @carlescufi @anangl
190190
/ext/hal/nxp/ @MaureenHelm
191191
/ext/hal/st/ @erwango
192+
/ext/hal/st/stmemsc/ @avisconti
192193
/ext/hal/ti/simplelink/ @vanti
193194
/ext/lib/crypto/mbedtls/ @nashif
194195
/ext/lib/crypto/tinycrypt/ @ceolin

ext/hal/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ source "ext/hal/openisa/vega_sdk_riscv/Kconfig"
2828

2929
source "ext/hal/st/stm32cube/Kconfig"
3030

31+
source "ext/hal/st/stmemsc/Kconfig"
32+
3133
source "ext/hal/st/lib/Kconfig"
3234

3335
source "ext/hal/ti/simplelink/Kconfig"

ext/hal/st/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
add_subdirectory_ifdef(CONFIG_HAS_STM32CUBE stm32cube)
2+
add_subdirectory_ifdef(CONFIG_HAS_STMEMSC stmemsc)
23
add_subdirectory_ifdef(CONFIG_HAS_STLIB lib)

ext/hal/st/stmemsc/CMakeLists.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Makefile - STMems_Standard_C_drivers
2+
#
3+
# Copyright (c) 2019 STMicroelectronics
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
set(stmems_pids
8+
a3g4250d
9+
ais328dq
10+
ais3624dq
11+
h3lis331dl
12+
hts221
13+
i3g4250d
14+
iis2dh
15+
iis2dlpc
16+
iis2mdc
17+
iis328dq
18+
iis3dhhc
19+
ism303dac
20+
ism330dlc
21+
l20g20is
22+
lis2de12
23+
lis2dh12
24+
lis2ds12
25+
lis2dw12
26+
lis2hh12
27+
lis2mdl
28+
lis331dlh
29+
lis3de
30+
lis3dhh
31+
lis3dh
32+
lis3mdl
33+
lps22hb
34+
lps22hh
35+
lps25hb
36+
lps33hw
37+
lsm303agr
38+
lsm303ah
39+
lsm6ds3
40+
lsm6dsl
41+
lsm6dsm
42+
lsm6dso
43+
lsm6dsox
44+
lsm9ds1
45+
stts751
46+
)
47+
48+
foreach(stmems_pid ${stmems_pids})
49+
string(TOUPPER ${stmems_pid} pid_to_upper)
50+
if(CONFIG_USE_STDC_${pid_to_upper})
51+
zephyr_include_directories(
52+
${stmems_pid}_STdC/driver/
53+
)
54+
zephyr_sources(
55+
${stmems_pid}_STdC/driver/${stmems_pid}_reg.c
56+
)
57+
endif()
58+
endforeach()

ext/hal/st/stmemsc/Kconfig

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Kconfig - STMems_Standard_C_drivers
2+
#
3+
# Copyright (c) 2019 STMicroelectronics
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
config HAS_STMEMSC
8+
bool
9+
imply NEWLIB_LIBC
10+
imply NEWLIB_LIBC_FLOAT_PRINTF
11+
12+
if HAS_STMEMSC
13+
14+
config USE_STDC_A3G4250D
15+
bool
16+
17+
config USE_STDC_AIS328DQ
18+
bool
19+
20+
config USE_STDC_AIS3624DQ
21+
bool
22+
23+
config USE_STDC_H3LIS331DL
24+
bool
25+
26+
config USE_STDC_HTS221
27+
bool
28+
29+
config USE_STDC_I3G4250D
30+
bool
31+
32+
config USE_STDC_IIS2DH
33+
bool
34+
35+
config USE_STDC_IIS2DLPC
36+
bool
37+
38+
config USE_STDC_IIS2MDC
39+
bool
40+
41+
config USE_STDC_IIS328DQ
42+
bool
43+
44+
config USE_STDC_IIS3DHHC
45+
bool
46+
47+
config USE_STDC_ISM303DAC
48+
bool
49+
50+
config USE_STDC_ISM330DLC
51+
bool
52+
53+
config USE_STDC_L20G20IS
54+
bool
55+
56+
config USE_STDC_LIS2DE12
57+
bool
58+
59+
config USE_STDC_LIS2DH12
60+
bool
61+
62+
config USE_STDC_LIS2DS12
63+
bool
64+
65+
config USE_STDC_LIS2DW12
66+
bool
67+
68+
config USE_STDC_LIS2HH12
69+
bool
70+
71+
config USE_STDC_LIS2MDL
72+
bool
73+
74+
config USE_STDC_LIS331DLH
75+
bool
76+
77+
config USE_STDC_LIS3DE
78+
bool
79+
80+
config USE_STDC_LIS3DHH
81+
bool
82+
83+
config USE_STDC_LIS3DH
84+
bool
85+
86+
config USE_STDC_LIS3MDL
87+
bool
88+
89+
config USE_STDC_LPS22HB
90+
bool
91+
92+
config USE_STDC_LPS22HH
93+
bool
94+
95+
config USE_STDC_LPS25HB
96+
bool
97+
98+
config USE_STDC_LPS33HW
99+
bool
100+
101+
config USE_STDC_LSM303AGR
102+
bool
103+
104+
config USE_STDC_LSM303AH
105+
bool
106+
107+
config USE_STDC_LSM6DS3
108+
bool
109+
110+
config USE_STDC_LSM6DSL
111+
bool
112+
113+
config USE_STDC_LSM6DSM
114+
bool
115+
116+
config USE_STDC_LSM6DSO
117+
bool
118+
119+
config USE_STDC_LSM6DSOX
120+
bool
121+
122+
config USE_STDC_LSM9DS1
123+
bool
124+
125+
config USE_STDC_STTS751
126+
bool
127+
128+
endif #HAS_STMEMSC

ext/hal/st/stmemsc/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2019, STMicroelectronics
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

ext/hal/st/stmemsc/README

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
C-Driver-MEMS
2+
#############
3+
4+
Origin:
5+
ST Microelectronics
6+
https://www.st.com/en/embedded-software/c-driver-mems.html
7+
8+
Status:
9+
version v1.00
10+
11+
Purpose:
12+
ST Microelectronics standard C platform-independent drivers for MEMS
13+
motion and environmental sensors.
14+
15+
Description:
16+
This package is an extract (examples have not been retained) of official
17+
C-Driver-MEMS package written by ST Microelectronics.
18+
It contains standard drivers for STMicroelectronics MEMS sensors to
19+
provide a common and stable interface to access sensor registers.
20+
For each supported sensor following files are provided:
21+
22+
- xyz_reg.c: contains the function to read/write 'xyz' sensor registers
23+
- xyz_reg.h: contains structures and defines to describe in details
24+
the 'xyz' sensor registers.
25+
26+
The driver is platform-independent, you only need to define the two
27+
functions for read and write transactions from the sensor hardware bus
28+
(ie. SPI or I2C).
29+
30+
Define in your 'xyz' driver code the read and write functions that use the
31+
I2C or SPI platform driver like the following:
32+
33+
/** Please note that is MANDATORY: return 0 -> no Error.**/
34+
int platform_wr(void *handle, u8_t reg, u8_t *bufp, u16_t len);
35+
int platform_rd(void *handle, u8_t reg, u8_t *bufp, u16_t len);
36+
37+
xyz_ctx_t xyz_ctx = {
38+
.read_reg = (xyz_read_ptr) platform_rd,
39+
.write_reg = (xyz_write_ptr) platform_wr,
40+
};
41+
42+
Dependencies:
43+
None.
44+
45+
URL:
46+
https://www.st.com/en/embedded-software/c-driver-mems.html
47+
48+
commit:
49+
version v1.00
50+
51+
Maintained-by:
52+
ST Microelectronics
53+
54+
License:
55+
BSD-3-Clause
56+
57+
License Link:
58+
https://opensource.org/licenses/BSD-3-Clause

0 commit comments

Comments
 (0)