TLE5012B  3.1.0
The TLE5012B is a pre-calibrated 360° angle sensor that detects the orientation of a magnetic field. The raw signals (sine and cosine) are digitally processed internally to calculate the angle orientation of the magnetic field (magnet).
useMultipleSensors.cpp File Reference
Include dependency graph for useMultipleSensors.cpp:

useMultipleSensors

Testscript for using up to four sensors on one SPI channel.

Author
Infineon Technologies AG
Version
3.1.0

This example program starts one to four sensors on one SPI line with different CS pins and returns the angle value together with the safety word and the status register SNR. Due to the selected slave number the SNR will be set to 0x00, 0x01, 0x10 or 0x11. When you fetch a value from the sensor with safety word on, than the safety word register RESP will indicate the sensor who is responding. This should be the same than you have ask for. The loop function will than print out the individual sensor(s) angle values.

This example also demonstrates how to handle more than on sensor in an array setup.

SPDX-License-Identifier: MIT

#define SENSOR_NUM   1
 number of connected sensors More...
 
#define CS_PIN_SENSOR_1   10
 define more unique chipselect pins for more connected Sensors More...
 
#define CS_PIN_SENSOR_2   5
 This is also a setup for the Sensor2Go kit but with a second sensor attached. More...
 
Tle5012Wiced sensor [SENSOR_NUM]
 Tle5012b Object, set/remove depending on the number of connected sensors. More...
 
errorTypes checkError = NO_ERROR
 Sensor IFX SIL(TM) errorCheck. More...
 
double d [4] = {0.0, 0.0, 0.0, 0.0}
 array if the read angle values and revolutions More...
 
int16_t r [4] = {0, 0, 0, 0}
 
void setup ()
 
void loop ()
 
void application_start ()
 

Macro Definition Documentation

◆ SENSOR_NUM

#define SENSOR_NUM   1

number of connected sensors

◆ CS_PIN_SENSOR_1

#define CS_PIN_SENSOR_1   10

define more unique chipselect pins for more connected Sensors

This is a setup for the default Arduino, use 3 for the Sensor2Go kit

◆ CS_PIN_SENSOR_2

#define CS_PIN_SENSOR_2   5

This is also a setup for the Sensor2Go kit but with a second sensor attached.

Function Documentation

◆ setup()

void setup ( )
Here is the call graph for this function:

◆ loop()

void loop ( )
Here is the call graph for this function:

◆ application_start()

void application_start ( )
Here is the call graph for this function:

Variable Documentation

◆ sensor

Initial value:
= {
(Tle5012Wiced(WICED_GPIO_7,sensor[1].TLE5012B_S0)),
}
represents a basic TLE5012b Wiced class.
Definition: TLE5012-pal-wiced.hpp:53
Tle5012Wiced sensor[SENSOR_NUM]
Tle5012b Object, set/remove depending on the number of connected sensors.
Definition: useMultipleSensors.cpp:37

Tle5012b Object, set/remove depending on the number of connected sensors.

◆ checkError

errorTypes checkError = NO_ERROR

Sensor IFX SIL(TM) errorCheck.

◆ d

double d[4] = {0.0, 0.0, 0.0, 0.0}

array if the read angle values and revolutions

◆ r

int16_t r[4] = {0, 0, 0, 0}