To use the Ssimp Sensor board, a Sensor library is available so provide a easy to use software interface. The sensor library consists of driver files for the sensors with the according names. Some drivers need other system drivers such as i2c bus. They also depend on pin definitions from the board.h files (eg. Pc202.h, ssimp192.h)
The ssimpall.c program is now explained as an example how to use the sensor library.
The ssimpall.h contains all necessary files. The sensors to be used have to be included. Sensors that are not necessary for a program are simply not included regardless if they are on the board or not.
The ssimpall.c shows how the sensors are controlled with the drivers. First, the ssimp board attached to the particle core board has to be initialised. The lines
take care of this.
Then, the typical flow of a sensor reading is explained with taking the force sensor as an example. First, the sensor has to be prepared.
The A/D channels are set, the sensor is activated etc. Then the function
reads out the sensor. It returns the sensor value on the referenced parameter. The function has as well a return value that indicated error states. This return value is not used in this program. Then, each driver provides as well a function to place the sensor values in the ACL packet. A user can use the gathered sensor values to any further processing or other usage. But if the sensor value is just to be sent out, it is very comfortable to use the functions like
They place the reading in the correct format (e.g. including correct types) for the sensor in the ACL packet.