All Projects → STMicroelectronics → Stmems_standard_c_drivers

STMicroelectronics / Stmems_standard_c_drivers

Licence: bsd-3-clause
Devices supported: A3G4250D, AIS2DW12, AIS328DQ, AIS3624DQ, ASM330LHH, H3LIS100DL, H3LIS331DL, HTS221, I3G4250D, IIS2DH, IIS2DLPC, IIS2ICLX, IIS2MDC, IIS328DQ, IIS3DHHC, IIS3DWB, ISM303DAC, ISM330DHCX, ISM330DLC, L20G20IS, L3GD20H, LIS25BA, LIS2DE12, LIS2DH12, LIS2DS12, LIS2DTW12, LIS2DW12, LIS2HH12, LIS2MDL, LIS331DLH, LIS3DE, LIS3DHH, LIS3DH, LIS3DSH, LIS3MDL, LPS22CH, LPS22HB, LPS22HH, LPS25HB, LPS27HHW, LPS33HW, LPS33K, LPS33W, LSM303AGR, LSM303AH, LSM6DS3TR_C, LSM6DS3, LSM6DSL, LSM6DSM, LSM6DSO32, LSM6DSOX, LSM6DSO, LSM6DSRX, LSM6DSR, LSM9DS1, STTS22H, STTS751

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Stmems standard c drivers

Organize
The file management automation tool.
Stars: ✭ 883 (+129.35%)
Mutual labels:  platform-independent
Openswe1r
An Open-Source port of the 1999 Game "Star Wars Episode 1: Racer"
Stars: ✭ 236 (-38.7%)
Mutual labels:  platform-independent
autogo
An AutoIt interpreter and runtime package written in Go
Stars: ✭ 30 (-92.21%)
Mutual labels:  platform-independent
Apertusvr
Virtual Reality Software Library
Stars: ✭ 112 (-70.91%)
Mutual labels:  platform-independent
Malagu
Malagu is a Serverless First, component-based, platform-independent, progressive application framework based on TypeScript.
Stars: ✭ 184 (-52.21%)
Mutual labels:  platform-independent
Jogl
Java™ Binding for the OpenGL® API
Stars: ✭ 248 (-35.58%)
Mutual labels:  platform-independent
Felix
The Felix Programming Language
Stars: ✭ 609 (+58.18%)
Mutual labels:  platform-independent
Tiny Process Library
A small platform independent library making it simple to create and stop new processes in C++, as well as writing to stdin and reading from stdout and stderr of a new process
Stars: ✭ 276 (-28.31%)
Mutual labels:  platform-independent
Rayfork
C99 Game Library. XNA-like. Single source. Platform Independent. Allocator Aware.
Stars: ✭ 215 (-44.16%)
Mutual labels:  platform-independent
piu
Cross platform package manager wrapper
Stars: ✭ 33 (-91.43%)
Mutual labels:  platform-independent
Airsim
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
Stars: ✭ 12,528 (+3154.03%)
Mutual labels:  platform-independent
Cidlib
The CIDLib general purpose C++ development environment
Stars: ✭ 179 (-53.51%)
Mutual labels:  platform-independent
hello-kotlin-multiplatform
Multiplatform Kotlin Hello World (Android/Java/JavaScript)
Stars: ✭ 64 (-83.38%)
Mutual labels:  platform-independent
Gluegen
JNI Glue Code Generator
Stars: ✭ 83 (-78.44%)
Mutual labels:  platform-independent
gq-gmc-control
Control tool for the GQ GMC Geiger Counters.
Stars: ✭ 34 (-91.17%)
Mutual labels:  platform-independent
Byob
An open-source post-exploitation framework for students, researchers and developers.
Stars: ✭ 6,949 (+1704.94%)
Mutual labels:  platform-independent
Remi
Python REMote Interface library. Platform independent. In about 100 Kbytes, perfect for your diet.
Stars: ✭ 2,943 (+664.42%)
Mutual labels:  platform-independent
Friceengine
🎮 JVM game engine based on Swing/JavaFX.
Stars: ✭ 330 (-14.29%)
Mutual labels:  platform-independent
Hippocrates
No longer maintained, actually usable implementation of NEAT
Stars: ✭ 59 (-84.68%)
Mutual labels:  platform-independent
Nightingale
It's a Docker Environment for pentesting which having all the required tool for VAPT.
Stars: ✭ 119 (-69.09%)
Mutual labels:  platform-independent

1 - Introduction

This repository contains platform independent drivers for STMicroelectronics sensors. Sensor drivers and examples were written in C programming language.

This repository contains two types of folders, identifiable using the following naming convention:

  • folder that contains the sensor drivers, named xxxxxxx_STdC where xxxxxxx identifies the a sensor part number,
  • folder that contains the demo project, named _prj_XXXXXXXwhere XXXXXXX is the name of the ST evaluation board,

Another folder, named _resources, can not be identified with the two types described above and contains other useful resources such as libraries and predefined device configurations used in some examples. In order to clone the complete content of this folder use the command:

git clone --recursive https://github.com/STMicroelectronics/STMems_Standard_C_drivers

1.a - Sensor driver folder structure

Every sensor driver folder contains:

  • xxxxxxx_STdC\driver : the C sensor driver (.h and .c) to be included in your project. Driver documentation can be generated using the Doxigen tool.
  • xxxxxxx_STdC\example: examples showing how to integrate the C driver in a project. They are written for STM32 Microcontrollers using the STM32CubeMX tool, but they can be used as a guideline for every platform.
  • README: additional info about the specific driver.

1.b - Demo project folder structure

Every demo project folder contains a single configuration file for the STM32CubeMX tool named _prj_XXXXXXX\XXXXXX.iocwhere XXXXXXX is the name of the ST evaluation board.

Using the STM32CubeMX tool ( configured with the related MCU Package ) and the .ioc file, it is possible to create a project in which you can easily run the examples available in each sensor drivers folder.


2 - Integration details

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 I²C).

2.a Source code integration

  • Include in your project the driver files of Sensor (.h and .c) located in the xxxxxxx_STdC\driverfolder of the corresponding product

  • Define in your code the read and write functions that use the I²C or SPI platform driver like the following:

/** Please note that is MANDATORY: return 0 -> no Error.**/
int32_t platform_write(void *handle, uint8_t Reg, uint8_t *Bufp, uint16_t len)
int32_t platform_read(void *handle, uint8_t Reg, uint8_t *Bufp, uint16_t len)
  • Declare and initialize the structure of device interface:
xxxxxxx_ctx_t dev_ctx; /** xxxxxxx is the used part number **/
dev_ctx.write_reg = platform_write;
dev_ctx.read_reg = platform_read;
  • If needed by the platform read and write functions, initialize the handle parameter:
dev_ctx.handle = &platform_handle;

2.b Required properties

  • A standard C language compiler for the target MCU
  • A C library for the target MCU and the desired interface (ie. SPI, I2C)

3 - Running Examples

They are written for STM32 Microcontrollers using STM32CubeMX tool, but they can be used as a guideline for every platform.

3.a Using a STMicroelectronics evaluation boards

In case of using the supported STMicroelectronics evaluation boards the examples file(.c) can run without applying any modifications (as is).

In order to do that, please follow the following steps:

  1. Download and install STM32CubeMX tool and the related MCU package (i.e. STM32CubeF4 for NucleoF411 and STEVAL_MKI109V3).
  2. Open the .ioc configuration file associated to the selected evaluation board with the STM32CubeMX tool. The .ioc configuration files for the supported evaluation boards can be found in the related ST evaluation board demo project folder.
  3. Generate the project using the STM32CubeMX tool and select your preferred IDE / Toolchain.
  4. Add to your project the STMicroelectronics sensor driver. Driver files are located in the sensor drivers folder atxxxxxxx_STdC\driver\xxxxxxx_reg.c(.h) where xxxxxxx identifies the sensor part number.
  5. Add to your project the example source file (.c) that you are interested in. Example files are located in the sensor drivers folder at xxxxxxx_STdC\example where xxxxxxx identifies a sensor part number.
  6. Uncomment the selected board definition in section /* STMicroelectronics evaluation boards definition */ in the selected example file (.c).
  7. Add the call to the example function inside the while(1) loop in the main() function themain.c file automatically generated by the STM32CubeMX tool.
  8. Enjoy :-)

3.b Running examples using different hardware

If a different MCU is used, please follow these steps:

  1. Add to your project the STMicroelectronics sensor driver. Driver files are located in the sensor drivers folder atxxxxxxx_STdC\driver\xxxxxxx_reg.c(.h) where xxxxxxx identifies a sensor part number.

  2. Add to your project the example source file (.c) that you are interested in. Example files are located in the sensor drivers folder at xxxxxxx_STdC\example where xxxxxxx identifies the sensor part number.

  3. Comment all the definitions of the boards in section `/* STMicroelectronics evaluation boards definition */ in the selected example file(.c).

  4. Add the call to the example function inside the while(1) loop in yourmain() function.

  5. Modify in the selected example file (.c) the hardware-related functions:

    • platform_write(void *handle, uint8_t Reg, uint8_t *Bufp,uint16_t len)
    • platform_read(void *handle, uint8_t Reg, uint8_t *Bufp, uint16_t len)
    • if needed add/replace the hardware-related functions reported in the example file.
  6. Enjoy :-)


More Information: http://www.st.com

Copyright (C) 2018 STMicroelectronics

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].