Sensor driver for NBP8FD4S sensor written in C programming language. This repository contains the sensor driver files (.h and .c) to be included, in your project. The driver is MISRA compliant and the documentation can be generated using the Doxygen tool.
The driver is platform-independent, you only need to define two functions for read and write transactions from the sensor hardware bus (SPI) and an optional one to implement a delay of millisecond granularity. A few devices integrate an extra bit in the communication protocol in order to enable multi read/write access, this bit must be managed in the read and write functions defined by the user. Please refer to the read and write implementation in the nbp8fd4s_STdC\examples folder.
- Include in your project the driver files of the sensor (.h and .c)
- Define in your code the read and write functions that use the SPI platform driver like the following:
/** Please note that is MANDATORY: return 0 -> no Error.**/
int32_t platform_read_write(void *handle, uint8_t* TxBuf, uint8_t *Rxbuf, uint16_t len)
/** Optional (may be required by driver) **/
void platform_delay(uint32_t millisec)
- Declare and initialize the structure of the device interface:
xxxxxxx_ctx_t dev_ctx; /** xxxxxxx is the used part number **/
dev_ctx.write_reg = platform_read_write;
dev_ctx.read_reg = platform_read_write;
dev_ctx.mdelay = platform_delay;
- If needed by the platform read and write functions, initialize the handle parameter:
dev_ctx.handle = &platform_handle;
Some integration examples can be found under fxls8964af_STdC\examples folder.
- A standard C language compiler for the target MCU
- A C library for the target MCU and the desired interface (ie. SPI, I²C)
More Information: http://www.st.com
Copyright (C) 2026 STMicroelectronics