
3 Host integration
As described in chapter
the Sensors SDK has a platform independent driver component
and Raspberry-pi specific examples which demonstrate the use of these drivers. In the fol-
lowing, the steps involved in porting the drivers to a custom platform is described.
The contents of the
drivers
directory has to be directly integrated into the custom project.
For example, in case of WSEN_PADS, include the WSEN_PADS_2511020213301.h and
WSEN_PADS_2511020213301.c files to the custom project.
The file
platform.h
declares platform specific functions that has to be implemented by the
user on the custom host. For example, the access to I
2
C interface of the host is declared
with the following functions.
/* *
* @brief
Initialize the I2C Interface
* @param I2C address
* @retval Error Code
*/
int8_t I2CInit (
int
address);
/* *
* @brief
Read data starting from the addressed register
* @param
−
RegAdr : the register address to read from
*
−
NumByteToRead : number of bytes to read
*
−
pointer Data : the address store the data
* @retval Error Code
int8_t ReadReg(uint8_t RegAdr, int NumByteToRead, uint8_t *Data);
/**
* @brief Write data strarting from the addressed register
* @param
−
RegAdr : Address to write in
*
−
NumByteToWrite : number of bytes to write
*
−
pointer Data : Address of the data to be written
* @retval Error Code
*/
int8_t WriteReg(
int
RegAdr,
int
NumByteToWrite, uint8_t *Data);
Code 1: Code snippet for I
2
C interface
Here the definition of these functions, depending on the host peripherals, has to be imple-
mented by the user. The function
I2CInit()
should initialize the I
2
C peripheral on the custom
MCU and the functions
ReadReg()
and
WriteReg()
should enable reading/writing data bytes
over the I
2
C bus.
Please refer to the user manual of the corresponding sensor for a detailed
description of the characteristics of the digital interface being used.
Sensors SDK, User manual
Version 1.1
© October 2019
8