Class TLx493DBase

Inheritance Relationships

Derived Types

Class Documentation

class TLx493DBase

The class TLx493DBase is the base class of the different TLx493D sensors variants. It defines all available functions of the sensors and routes the member function calls to the underlying c-function calls, which will be executed in the end.

Subclassed by ifx::tlx493d::TLx493D< BoardSupportClass, BusWrapper, sensorType >, ifx::tlx493d::TLx493D< BoardSupport, SPIClassWrapper, sensorType >, ifx::tlx493d::TLx493D< BoardSupport, TwoWireWrapper, sensorType >

Public Functions

inline ~TLx493DBase()

The function ~TLx493DBase is the destructor of the TLx493DBase class object.

inline bool readRegisters()

The function readRegisters reads registers from a TLx493D sensor. It is reading out the complete register map of the sensor and is saving the current values to the “internal” register map of the sensor object.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function readRegisters is returning a boolean value.

inline bool getRawTemperature(int16_t *temperature)

The function getRawTemperature retrieves the raw temperature from a TLx493D sensor. It is reading out the temperature registers of the sensor and is returning its value as LSB.

Parameters:

temperature[inout] A pointer to an int16_t variable where the raw temperature value will be stored.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function tlx493d_getRawTemperature is returning a boolean value.

inline bool getRawMagneticField(int16_t *x, int16_t *y, int16_t *z)

The function getRawMagneticField retrieves the raw magnetic field values from a TLx493D sensor. It is reading the magnetic field value registers of the sensor and is returning them as LSB for the X, Y, Z-direction.

Parameters:
  • x[inout] A pointer to a variable where the raw magnetic field value along the x-axis will be stored.

  • y[inout] A pointer to a variable where the raw magnetic field value along the y-axis will be stored.

  • z[inout] A pointer to a variable where the raw magnetic field value along the z-axis will be stored.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function getRawMagneticField is returning a boolean value.

inline bool getRawMagneticFieldAndTemperature(int16_t *x, int16_t *y, int16_t *z, int16_t *temp)

The function getRawMagneticFieldAndTemperature retrieves the raw magnetic field and temperature values from a TLx493D sensor. It is reading out the magnetic field value registers, as well as the temperature value registers of the sensor and is returning them as LSB.

Parameters:
  • x[inout] A pointer to a variable where the raw magnetic field value along the x-axis will be stored.

  • y[inout] A pointer to a variable where the raw magnetic field value along the y-axis will be stored.

  • z[inout] A pointer to a variable where the raw magnetic field value along the z-axis will be stored.

  • temp[inout] A pointer to a variable where the raw temperature value will be stored.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function getRawMagneticFieldAndTemperature is returning a boolean value.

inline bool getTemperature(double *temperature)

The function getTemperature retrieves the temperature from a TLx493D sensor in °C. It is reading out the temperature registers of the sensor and converts the values into °C with the formula that is provided in the datasheet of the sensor.

Parameters:

temperature[inout] A pointer to a double variable where the temperature value will be stored in °C.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function getTemperature is returning a boolean value.

inline bool getMagneticField(double *x, double *y, double *z)

The function getMagneticField retrieves the magnetic field values from a TLx493D sensor. It is reading out the magnetic field value registers of the sensor and is converting the retrieved data into values in mT for each magnetic field axis.

Parameters:
  • x[inout] A pointer to a variable where the magnetic field value in mT along the x-axis will be stored.

  • y[inout] A pointer to a variable where the magnetic field value in mT along the y-axis will be stored.

  • z[inout] A pointer to a variable where the magnetic field value in mT along the z-axis will be stored.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function getMagneticField is returning a boolean value.

inline bool getMagneticFieldAndTemperature(double *x, double *y, double *z, double *temp)

The function getMagneticFieldAndTemperature retrieves the magnetic field and temperature readings from a TLx493D sensor. It combines the two functions getMagneticFieldAndTemperature and tlx493d_getMagneticField in order to have one function which is providing the temperature as well as the magnetic field values of the sensor.

Parameters:
  • x[inout] A pointer to a variable where the magnetic field value in mT along the x-axis will be stored.

  • y[inout] A pointer to a variable where the magnetic field value in mT along the y-axis will be stored.

  • z[inout] A pointer to a variable where the magnetic field value in mT along the z-axis will be stored.

  • temp[inout] A pointer to a double variable where the temperature value in °C will be stored.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function getMagneticFieldAndTemperature is returning a boolean value.

inline bool setMeasurement(TLx493D_MeasurementType_t meas)

The function setMeasurement sets the measurement type for a TLx493D sensor. It is writing to the corresponding bitfields in the config-register in order to set the desired measuring mode of the sensor.

Parameters:

meas[in] The meas parameter is of type TLx493D_MeasurementType_t, which is an enumeration type representing different measurement types for the TLx493D sensor. All available options can be found in the enum TLx493D_MeasurementType_t in the library file tlx493d_types.h.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setMeasurement is returning a boolean value.

inline bool setTrigger(TLx493D_TriggerType_t bits)

The function setTrigger sets the trigger type for a TLx493D sensor. It is writing to the corresponding bitfields in the config-register in order to set the desired trigger mode of the sensor.

Parameters:

bits[in] The bits parameter is of type TLx493D_TriggerType_t, which is an enumeration type representing different trigger types for the TLx493D sensor. All the available options can be found in the enum TLx493D_TriggerType_t in the library file tlx493d_types.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setTrigger is returning a boolean value.

inline bool setSensitivity(TLx493D_SensitivityType_t range)

The function setSensitivity sets the sensitivity of a TLx493D sensor. It is writing to the corresponding bitfields in the registers of the sensor in order to set the desired measuring range.

Parameters:

range[in] The range parameter is of type `TLx493D_SensitivityType_t, which is an enumeration type that represents the sensitivity range of the sensor. All available options can be found in the enum TLx493D_SensitivityType_t in the library file tlx493d_types.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setSensitivity is returning a boolean value.

inline bool setDefaultConfig()

The function setDefaultConfig sets the default configuration for a TLx493D sensor. It puts the sensor into the 1-Byte-Read-Mode and turns off the interrupt. This is required to guarantee the proper functionality of the sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setDefaultConfig is returning a boolean value.

inline bool setIICAddress(TLx493D_IICAddressType_t addr)

The function setIICAddress sets the IIC address of a TLx493D sensor. It is writing to the corresponding bitfields of the sensor in order to change the I2C-Default-Address of the sensor to the desired address of the user.

Parameters:

addr[in] The addr parameter is of type TLx493D_IICAddressType_t , which is an enumeration type representing the I2C address of the sensor. You can see all available addresses in the enum TLx493D_IICAddressType_t in the library file tlx493d_types.h.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setIICAddress is returning a boolean value.

inline bool enableCollisionAvoidance()

The function enableCollisionAvoidance enables collision avoidance for a TLx493D sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function enableCollisionAvoidance is returning a boolean value.

inline bool disableCollisionAvoidance()

The function disableCollisionAvoidance disables collision avoidance for a TLx493D sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function disableCollisionAvoidance is returning a boolean value.

inline bool enableInterrupt()

The function enableInterrupt enables interrupts for a TLx493D sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function enableInterrupt is returning a boolean value.

inline bool disableInterrupt()

The function disableInterrupt is used to disable interrupts for a TLx493D sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function disableInterrupt is returning a boolean value.

inline bool setPowerMode(TLx493D_PowerModeType_t mode)

The function setPowerMode sets the power mode of a TLx493D sensor. It is writing to the corresponding bitfields of the sensor in order to set one of the three available power modes of the sensor.

Parameters:

mode[in] The mode parameter is of type TLx493D_PowerModeType_t, which is an enumeration type representing different power modes for the TLx493D sensor. All available options can be found in the enum TLx493D_PowerModeType_t in the library file tlx493d_types.h.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setPowerMode is returning a boolean value.

inline bool setUpdateRate(TLx493D_UpdateRateType_t bit)

The function setUpdateRate sets the update rate of a TLx493D sensor. It is writing to the corresponding bitfields of the sensor in order to set the desired update frequency, with which the sensor will update his measured values.

Parameters:

bit[in] The bit parameter is of type TLx493D_UpdateRateType_t, which is an enumeration type representing different update rates for the sensor. All available options can be found in the enum TLx493D_UpdateRateType_t in the library file ´tlx493d_types.h`.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setUpdateRate is returning a boolean value.

inline bool hasValidData()

The function hasValidData checks if the TLx493D sensor has valid data. It is checking the corresponding bitfield of the sensor which indicates if the acquired measurement data is valid or not.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function hasValidData is returning a boolean value.

inline bool isFunctional()

The function isFunctional checks if a TLx493D sensor is functional. It checks the internal fuse parity bit as well as the config parity bit in order to confirm that the sensor is still functional.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function isFunctional is returning a boolean value.

inline bool hasWakeUp()

The function hasWakeUp checks if a TLx493D sensor has wake-up functionality. It simply checks the bitfield which indicates if the sensor has a wake-up functionality or not.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function hasWakeUp is returning a boolean value.

inline bool isWakeUpEnabled()

The function isWakeUpEnabled checks if wake-up mode is enabled for a TLx493D sensor. It checks the bitfield of the sensor which gives you the information if the wake-up is enabled or not.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function isWakeUpEnabled is returning a boolean value.

inline bool enableWakeUpMode()

The function enableWakeUpMode enables the wake-up mode for the TLx493D sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function enableWakeUpMode is returning a boolean value.

inline bool disableWakeUpMode()

The function disableWakeUpMode disables the wake-up mode of a TLx493D sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function disableWakeUpMode is returning a boolean value.

inline bool setWakeUpThresholdsAsInteger(int16_t xl_th, int16_t xh_th, int16_t yl_th, int16_t yh_th, int16_t zl_th, int16_t zh_th)

The function setWakeUpThresholdsAsInteger sets the wake-up thresholds for a TLx493D sensor using integer values. It sets the lower and upper threshold for each of three axis. If one of these thresholds is exceeded the sensor will trigger an interrupt. It will continue to trigger interrupts as long as the threshold is exceeded.

Parameters:
  • xl_th[in] The lower threshold value for the magnetic field in x-axis.

  • xh_th[in] The upper threshold value for the magnetic field in x-axis.

  • yl_th[in] The lower threshold value for the magnetic field in y-axis.

  • yh_th[in] The upper threshold value for the magnetic field in y-axis.

  • zl_th[in] The lower threshold value for the magnetic field in z-axis.

  • zh_th[in] The upper threshold value for the magnetic field in z-axis.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setWakeUpThresholdsAsInteger is returning a boolean value.

inline bool setWakeUpThresholds(double temperature, double xl_th, double xh_th, double yl_th, double yh_th, double zl_th, double zh_th)

The function setWakeUpThresholds sets the wake-up thresholds for the TLx493D sensor in mT. It sets the lower and upper threshold for each of three axis in mT. If one of these thresholds is exceeded the sensor will trigger an interrupt. It will continue to trigger interrupts as long as the threshold is exceeded.

Parameters:
  • temperature[in] The temperature to be used for derating the field values.

  • xl_th[in] The lower threshold value for the magnetic field in x-axis.

  • xh_th[in] The upper threshold value for the magnetic field in x-axis.

  • yl_th[in] The lower threshold value for the magnetic field in y-axis.

  • yh_th[in] The upper threshold value for the magnetic field in y-axis.

  • zl_th[in] The lower threshold value for the magnetic field in z-axis.

  • zh_th[in] The upper threshold value for the magnetic field in z-axis.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function setWakeUpThresholds is returning a boolean value.

inline bool softwareReset()

The function softwareReset performs a software reset on the TLx493D sensor.

Return values:
  • false – Error.

  • true – Function execution was successful.

Returns:

The function softwareReset is returning a boolean value.

inline const char *getTypeAsString()

The function getTypeAsString returns the type of the TLx493D sensor as a string.

Returns:

The function tlx493d_getTypeAsString returns a pointer to a constant character string.

inline void calculateRawMagneticFieldAtTemperature(int16_t rawTemp, TLx493D_SensitivityType_t sens, double xInmT, double yInmT, double zInmT, int16_t *x, int16_t *y, int16_t *z)

The function calculateRawMagneticFieldAtTemperature calculates the raw magnetic field at a given temperature.

Parameters:
  • rawTemp[in] The raw temperature value obtained from the sensor.

  • sens[in] The parameter sens is of type TLx493D_SensitivityType_t, which is an enumeration type representing the sensitivity level of the sensor. It is used to specify the desired sensitivity level for calculating the raw magnetic field.

  • xInmT[in] The parameter xInmT represents the magnetic field strength in Millitesla (mT) along the x-axis.

  • yInmT[in] The parameter yInmT represents the magnetic field strength in Millitesla (mT) along the y-axis.

  • zInmT[in] The parameter zInmT represents the magnetic field strength in Millitesla (mT) along the z-axis.

  • x[inout] A pointer to a variable where the calculated raw magnetic field in the x-axis will be stored.

  • y[inout] A pointer to a variable where the calculated raw magnetic field in the y-axis will be stored.

  • z[inout] A pointer to a variable where the calculated raw magnetic field in the z-axis will be stored.

inline void printRegisters()

The function printRegisters prints out the internal registers of the sensor object. It can be used to check certain values of the sensor register map.

inline TLx493D_t *getSensor()

The function getSensor retrieves the sensor object of the class.

Returns:

A pointer to the sensor structure TLx493D_t.

inline TLx493D_SupportedSensorType_t getSensorType()

The function getSensorType retrieves the specific sensor type from the sensor object.

Returns:

A TLx493D_SupportedSensorType_t enum which contains the specific sensor type.

inline TLx493D_SupportedComLibraryInterfaceType_t getComLibIFType()

The function getComLibIFType is returning the communication interface of the sensor. It is reading out the corresponding structure member of the sensor object.

Return values:
  • TLx493D_I2C_e – If the sensor communication interface is set to I2C.

  • TLx493D_SPI_e – If the sensor communication interface is set to SPI.

Returns:

A TLx493D_SupportedComLibraryInterfaceType_t enum which contains the communication interface type.

inline uint8_t *getRegisterMap()

The function getRegisterMap gets the internal register map of the sensor object.

Returns:

A pointer to the register map array with its saved values.

inline uint8_t getRegisterMapSize()

The function getRegisterMapSize returns the register map size of the internal register map of the sensor object.

Returns:

Size of the internal register map.

inline uint8_t getI2CAddress()

The function getI2CAddress is returning the I2C address of the sensor. It is reading out the I2C address stored within the sensor object.

Returns:

I2C address of the sensor.

Protected Functions

inline TLx493DBase()

The function TLx493DBase is the constructor of the class.

Protected Attributes

TLx493D_t sensor

Declaration of the sensor object structure.