TLx4966 Direction Speed Sensor  1.1.1
C/C++ library of Infineons double Hall-effect direction and speed sensor TLx4966(K)/(G)/(L)/(V) family for magnetic sensing applications.
Arduino API

Functions

 TLx4966::TLx4966 (uint8_t polesPair, TLx4966_SpeedUnit_t speedUnit=TLx4966_SPEED_RPM, ArduinoHwPlatf ardHwPlatf=Shield_2Go, TLx4966_MeasMode_t measMode=TLx4966_MEASMODE_POLLING)
 Double hall switch instance constructor Mandatory hw interfaces: dir, speed, timer. Optional hw interfaces: power (only for switch mode platform). More...
 
 TLx4966::TLx4966 (uint8_t polesPair, TLx4966_PowerMode_t powMode, TLx4966_MeasMode_t measMode, TLx4966_SpeedUnit_t speedUnit, TLx4966_HwIntf_t *hwIntf)
 Double hall switch instance constructor Mandatory hw interfaces: dir, speed, timer. Optional hw interfaces: power (only for switch mode platform). More...
 
TLx4966_Error_t TLx4966::begin ()
 Initilializes the hardware interfaces. More...
 
 TLx4966::~TLx4966 ()
 Double hall switch instance destructor. More...
 
TLx4966_Error_t TLx4966::enable ()
 Enables the sensor. More...
 
TLx4966_Error_t TLx4966::disable ()
 Disables the sensor. More...
 
void TLx4966::measureLoop ()
 Updates the rotation direction and speed. More...
 
TLx4966_Status_t TLx4966::readStatus ()
 Reads the sensor status. More...
 
TLx4966_Dir_t TLx4966::readDirection ()
 Gets the rotation direction The direction definition (clock-wise/anticlock-wise, left/rigth, positive/negative...) is dependant of the mechanical configuration of the sensor with repect to the rotor. The library just provide voltage-low/voltage-high directions. More...
 
double TLx4966::readSpeed ()
 Gets the rotation speed. More...
 

Detailed Description

Function Documentation

◆ begin()

TLx4966_Error_t TLx4966::begin ( void  )

Initilializes the hardware interfaces.

Returns
TLx4966 error code
Return values
TLx4966_OKif success
TLx4966_INTF_ERRORif hardware interface error

◆ disable()

TLx4966_Error_t TLx4966::disable ( )

Disables the sensor.

  • If the "Interrupt measuring mode" is configured, the interrupt are enabled.
  • If the "Switch power mode" is configured, the sensor is powered off.
  • The measuring speed timer is stopped.
    Returns
    TLx4966 error code
    Return values
    TLx4966_OKif success
    TLx4966_INTF_ERRORif hardware interface error

◆ enable()

TLx4966_Error_t TLx4966::enable ( void  )

Enables the sensor.

  • If the "Switch power mode" is configured, the sensor is powered up.
  • If the "Interrupt measuring mode" is configured, the interrupt are enabled.
  • The measuring speed timer is started
    Returns
    TLx4966 error code
    Return values
    TLx4966_OKif success
    TLx4966_INTF_ERRORif hardware interface error

◆ measureLoop()

void TLx4966::measureLoop ( )

Updates the rotation direction and speed.

Note
To be used in super-loop.
Returns
void

◆ readDirection()

TLx4966_Dir_t TLx4966::readDirection ( )

Gets the rotation direction The direction definition (clock-wise/anticlock-wise, left/rigth, positive/negative...) is dependant of the mechanical configuration of the sensor with repect to the rotor. The library just provide voltage-low/voltage-high directions.

Returns
TLx4966 direction
Return values
TLx4966_DIR_UNDEFprior initial rotor movement (after initialization)

◆ readSpeed()

double TLx4966::readSpeed ( )

Gets the rotation speed.

Returns
Speed in the unit specified in the configuration

◆ readStatus()

TLx4966_Status_t TLx4966::readStatus ( )

Reads the sensor status.

Returns
TLx4966 status

◆ TLx4966() [1/2]

TLx4966::TLx4966 ( uint8_t  polesPair,
TLx4966_SpeedUnit_t  speedUnit = TLx4966_SPEED_RPM,
ArduinoHwPlatf  ardHwPlatf = Shield_2Go,
TLx4966_MeasMode_t  measMode = TLx4966_MEASMODE_POLLING 
)

Double hall switch instance constructor Mandatory hw interfaces: dir, speed, timer. Optional hw interfaces: power (only for switch mode platform).

Parameters
[in]polesPairRotor poles pair number
[in]speedUnitSpeed unit
[in]ardHwPlatfArduino hardware platform
[in]measModeMeasuring mode
Returns
void

◆ TLx4966() [2/2]

TLx4966::TLx4966 ( uint8_t  polesPair,
TLx4966_PowerMode_t  powMode,
TLx4966_MeasMode_t  measMode,
TLx4966_SpeedUnit_t  speedUnit,
TLx4966_HwIntf_t hwIntf 
)

Double hall switch instance constructor Mandatory hw interfaces: dir, speed, timer. Optional hw interfaces: power (only for switch mode platform).

Parameters
[in]polesPairRotor poles pair number
[in]powModePower mode
[in]measModeMeasuring mode
[in]speedUnitSpeed unit
[in]*hwIntfPointer to hardware interface handle
Returns
void

◆ ~TLx4966()

TLx4966::~TLx4966 ( void  )

Double hall switch instance destructor.

Disables the switch

Returns
void