Multi Half-Bridge 4.0.0
Library of Infineon's Multi Half-Bridge IC controllers family
 
Loading...
Searching...
No Matches
TLE94112 API
Collaboration diagram for TLE94112 API:

Data Structures

class  Tle94112
 represents a basic TLE94112 More...
 

Macros

#define TLE94112_NUM_HB   13
 the number of halfbridges on a TLE94112 (including no halfbridge)
 
#define TLE94112_NUM_PWM   4
 the number of pwm modes for a halfbridge (including no pwm)
 
#define TLE94112_NUM_CTRL_REGS   12
 the number of control registers in a TLE94112
 
#define TLE94112_NUM_STATUS_REGS   7
 the number of status registers in a TLE94112
 

Error codes

enum  tle94112::Error_t {
  tle94112::OK = 0 , tle94112::INTF_ERROR = -1 , tle94112::CONF_ERROR = -2 , tle94112::READ_ERROR = -3 ,
  tle94112::WRITE_ERROR = -4
}
 
#define REG_ACT_1   0x03
 
#define REG_ACT_2   0x43
 
#define REG_ACT_3   0x23
 
#define REG_MODE_1   0x63
 
#define REG_MODE_2   0x13
 
#define REG_MODE_3   0x53
 
#define REG_PWM_CH_FREQ   0x33
 
#define REG_PWM_DC_1   0x73
 
#define REG_PWM_DC_2   0x0B
 
#define REG_PWM_DC_3   0x4B
 
#define REG_SYS_DIAG   0x1B
 
#define REG_ERR1   0x5B
 
#define REG_ERR2   0x3B
 
#define REG_ERR3   0x7B
 
#define REG_ERR4   0x07
 
#define REG_ERR5   0x47
 
#define REG_ERR6   0x27
 
#define REG_FW_OL   0x2B
 
#define REG_FW_CTRL   0x6B
 
#define HL_HL   0b10011001
 
#define HL_LH   0b10010110
 
#define LH_HL   0b01101001
 
#define LH_LH   0b01100110
 
#define HH_LL   0b10100101
 
#define LL_HH   0b01011010
 

Detailed Description


Data Structure Documentation

◆ Tle94112

class Tle94112

represents a basic TLE94112

This class provides a simple API for connecting and controlling motors. Each motor is assigned to a Tle94112 which acts as output driver. Calls to Tle94112Motor instances are mapped to calls to Tle94112. Therefore, this class does not bring new features, it does only provide further abstraction.

See also
Tle94112
Inheritance diagram for Tle94112:
Collaboration diagram for Tle94112:

Public Types

enum  HalfBridge {
  TLE_NOHB = 0 , TLE_HB1 , TLE_HB2 , TLE_HB3 ,
  TLE_HB4 , TLE_HB5 , TLE_HB6 , TLE_HB7 ,
  TLE_HB8 , TLE_HB9 , TLE_HB10 , TLE_HB11 ,
  TLE_HB12
}
 enum for the halfbridges on a TLE94112 More...
 
enum  PWMChannel { TLE_NOPWM = 0 , TLE_PWM1 , TLE_PWM2 , TLE_PWM3 }
 enum for the PWM channels of a halfbridge on TLE94112 More...
 
enum  HBState { TLE_FLOATING = 0b00 , TLE_LOW = 0b01 , TLE_HIGH = 0b10 }
 enum for the output states of a halfbridge More...
 
enum  HBOCState { TLE_NONE = 0b00 , TLE_LOWSIDE = 0b01 , TLE_HIGHSIDE = 0b10 }
 enum for the overcurrent states of a halfbridge More...
 
enum  PWMFreq { TLE_FREQOFF = 0b00 , TLE_FREQ80HZ , TLE_FREQ100HZ , TLE_FREQ200HZ }
 enum for the frequencies of a PWM channel More...
 
enum  DiagFlag {
  TLE_SPI_ERROR = 0x80 , TLE_LOAD_ERROR = 0x40 , TLE_UNDER_VOLTAGE = 0x20 , TLE_OVER_VOLTAGE = 0x10 ,
  TLE_POWER_ON_RESET = 0x08 , TLE_TEMP_SHUTDOWN = 0x04 , TLE_TEMP_WARNING = 0x02
}
 enum for the flags in the register SYS_DIAG1 More...
 

Public Member Functions

 Tle94112 ()
 standard constructor with default pin assignment
 
 Tle94112 (SPIC *sBus, GPIOC *cs, GPIOC *en, Timer *timer)
 constructor with pal instances
 
 ~Tle94112 ()
 standard destructor switches shield off
 
void begin (void)
 enables and initializes the TLE94112
 
void end (void)
 deactivates all outputs and disables the TLE94112
 
void configHB (HalfBridge hb, HBState state, PWMChannel pwm)
 sets the output state and the PWM channel for a halfbridge (only for passive freewheeling)
 
void configHB (HalfBridge hb, HBState state, PWMChannel pwm, uint8_t activeFW)
 sets the output state and the PWM channel for a halfbridge (allows active freewheeling)
 
void configPWM (PWMChannel pwm, PWMFreq freq, uint8_t dutyCycle)
 sets the frequency and duty cycle for a PWM channel
 
uint8_t setLedMode (HalfBridge hb, uint8_t active)
 sets LED mode on compatible half bridges (half bridge 1 or 2 of TLE94112)
 
uint8_t getSysDiagnosis ()
 returns a diagnosis value for error detection
 
uint8_t getSysDiagnosis (DiagFlag mask)
 shows if errors of a specific type have occurred
 
uint8_t getSysDiagnosis (uint8_t mask)
 shows if errors of a specific type have occurred
 
uint8_t getHBOverCurrent (HalfBridge hb)
 gets the overcurrent error flag bit for a specific halfbridge
 
uint8_t getHBOpenLoad (HalfBridge hb)
 gets the openload error flag bit for a specific halfbridge
 
void clearErrors ()
 clears all clearable error flags
 
void directWriteReg (uint8_t reg, uint8_t data)
 writes data bits directly to a register of the TLE94112
 
uint8_t readStatusReg (uint8_t reg)
 reads one byte from a status register of the TLE94112
 

Data Fields

SPICsBus
 
GPIOCcs
 
GPIOCen
 
Timertimer
 

Static Public Attributes

static const uint8_t TLE_STATUS_OK = 0U
 Reference value of Status Register.
 

Protected Types

enum  CtrlRegisters {
  HB_ACT_1_CTRL = 0 , HB_ACT_2_CTRL , HB_ACT_3_CTRL , HB_MODE_1_CTRL ,
  HB_MODE_2_CTRL , HB_MODE_3_CTRL , PWM_CH_FREQ_CTRL , PWM1_DC_CTRL ,
  PWM2_DC_CTRL , PWM3_DC_CTRL , FW_OL_CTRL , FW_CTRL
}
 enum for the control registers in a TLE94112 More...
 
enum  StatusRegisters {
  SYS_DIAG1 = 0 , OP_ERROR_1_STAT , OP_ERROR_2_STAT , OP_ERROR_3_STAT ,
  OP_ERROR_4_STAT , OP_ERROR_5_STAT , OP_ERROR_6_STAT
}
 enum for the status registers in a TLE94112 More...
 

Protected Member Functions

void init (void)
 initializes this object, automatically called by begin()
 
void _configHB (uint8_t hb, uint8_t state, uint8_t pwm, uint8_t activeFW)
 sets the output state and the PWM channel for a halfbridge automatically called by the public version of configHB
 
void _configPWM (uint8_t pwm, uint8_t freq, uint8_t dutyCycle)
 sets the frequency and duty cycle for a PWM channel automatically called by the public version of configPWM
 
uint8_t _getHBOverCurrent (uint8_t hb)
 gets the overcurrent error flag bit for a specific halfbridge automatically called by the public version of getHBOverCurrent
 
uint8_t _getHBOpenLoad (uint8_t hb)
 gets the openload error flag bit for a specific halfbridge automatically called by the public version of getHBOpenLoad
 
void writeReg (uint8_t reg, uint8_t mask, uint8_t shift, uint8_t data)
 writes data bits to a control register of the TLE94112
 
uint8_t readStatusReg (uint8_t reg, uint8_t mask, uint8_t shift)
 reads some bits from a status register of the TLE94112
 
void clearStatusReg (uint8_t reg)
 clears a status register by writing 0x00 to it
 

Protected Attributes

HalfBridge_t mHalfBridges [TLE94112_NUM_HB]
 array of register locations for halfbridges
 
PWMchannel_t mPwmChannels [TLE94112_NUM_PWM]
 array of register locations for PWM channels
 
uint8_t mCtrlRegAddresses [TLE94112_NUM_CTRL_REGS]
 mapping array for control register addresses
 
uint8_t mCtrlRegData [TLE94112_NUM_CTRL_REGS]
 mirror array for control register data
 
uint8_t mStatusRegAddresses [TLE94112_NUM_STATUS_REGS]
 mapping array for status register addresses
 
uint8_t mEnabled
 

Member Enumeration Documentation

◆ HalfBridge

enum for the halfbridges on a TLE94112

Enumerator
TLE_NOHB 
TLE_HB1 
TLE_HB2 
TLE_HB3 
TLE_HB4 
TLE_HB5 
TLE_HB6 
TLE_HB7 
TLE_HB8 
TLE_HB9 
TLE_HB10 
TLE_HB11 
TLE_HB12 

◆ PWMChannel

enum for the PWM channels of a halfbridge on TLE94112

Enumerator
TLE_NOPWM 
TLE_PWM1 
TLE_PWM2 
TLE_PWM3 

◆ HBState

enum for the output states of a halfbridge

Enumerator
TLE_FLOATING 
TLE_LOW 
TLE_HIGH 

◆ HBOCState

enum for the overcurrent states of a halfbridge

Enumerator
TLE_NONE 
TLE_LOWSIDE 
TLE_HIGHSIDE 

◆ PWMFreq

enum for the frequencies of a PWM channel

Enumerator
TLE_FREQOFF 
TLE_FREQ80HZ 
TLE_FREQ100HZ 
TLE_FREQ200HZ 

◆ DiagFlag

enum for the flags in the register SYS_DIAG1

Enumerator
TLE_SPI_ERROR 
TLE_LOAD_ERROR 
TLE_UNDER_VOLTAGE 
TLE_OVER_VOLTAGE 
TLE_POWER_ON_RESET 
TLE_TEMP_SHUTDOWN 
TLE_TEMP_WARNING 

◆ CtrlRegisters

enum for the control registers in a TLE94112

Enumerator
HB_ACT_1_CTRL 
HB_ACT_2_CTRL 
HB_ACT_3_CTRL 
HB_MODE_1_CTRL 
HB_MODE_2_CTRL 
HB_MODE_3_CTRL 
PWM_CH_FREQ_CTRL 
PWM1_DC_CTRL 
PWM2_DC_CTRL 
PWM3_DC_CTRL 
FW_OL_CTRL 
FW_CTRL 

◆ StatusRegisters

enum for the status registers in a TLE94112

Enumerator
SYS_DIAG1 
OP_ERROR_1_STAT 
OP_ERROR_2_STAT 
OP_ERROR_3_STAT 
OP_ERROR_4_STAT 
OP_ERROR_5_STAT 
OP_ERROR_6_STAT 

Constructor & Destructor Documentation

◆ Tle94112() [1/2]

Tle94112::Tle94112 ( void  )

standard constructor with default pin assignment

◆ Tle94112() [2/2]

Tle94112::Tle94112 ( SPIC sBus,
GPIOC cs,
GPIOC en,
Timer timer 
)

constructor with pal instances

◆ ~Tle94112()

Tle94112::~Tle94112 ( )

standard destructor switches shield off

Member Function Documentation

◆ begin()

void Tle94112::begin ( void  )

enables and initializes the TLE94112

Here is the call graph for this function:

◆ end()

void Tle94112::end ( void  )

deactivates all outputs and disables the TLE94112

Here is the call graph for this function:

◆ configHB() [1/2]

void Tle94112::configHB ( HalfBridge  hb,
HBState  state,
PWMChannel  pwm 
)

sets the output state and the PWM channel for a halfbridge (only for passive freewheeling)

Parameters
hbhalfbridge which will be configured
statesets the output voltage to high, low or floating
pwmselects a PWM channel for PWM output
See also
HalfBridge
HBState
PWMChannel
Here is the call graph for this function:

◆ configHB() [2/2]

void Tle94112::configHB ( HalfBridge  hb,
HBState  state,
PWMChannel  pwm,
uint8_t  activeFW 
)

sets the output state and the PWM channel for a halfbridge (allows active freewheeling)

Parameters
hbhalfbridge which will be configured
statesets the output voltage to high, low or floating
pwmselects a PWM channel for PWM output
activeFW1 for active freewheeling 0 for passive freewheeling (default)
See also
HalfBridge
HBState
PWMChannel
Here is the call graph for this function:

◆ configPWM()

void Tle94112::configPWM ( PWMChannel  pwm,
PWMFreq  freq,
uint8_t  dutyCycle 
)

sets the frequency and duty cycle for a PWM channel

Parameters
pwmPWM channel which will be configured
freqselects the PWM output frequency
dutyCyclea value from 0 to 255 which sets the dutyCycle
See also
PWMChannel
PWMFreq
Here is the call graph for this function:

◆ setLedMode()

uint8_t Tle94112::setLedMode ( HalfBridge  hb,
uint8_t  active 
)

sets LED mode on compatible half bridges (half bridge 1 or 2 of TLE94112)

Parameters
hbcompatible half bridge to set LED mode
activeLED mode active (1) or inactive (0)
See also
HalfBridge
Returns
0 if everything is ok 1 if half bridge does not support LED mode
Here is the call graph for this function:

◆ getSysDiagnosis() [1/3]

uint8_t Tle94112::getSysDiagnosis ( )

returns a diagnosis value for error detection

Returns
0 if everything is ok non-zero value if errors occurred
Here is the call graph for this function:

◆ getSysDiagnosis() [2/3]

uint8_t Tle94112::getSysDiagnosis ( DiagFlag  mask)

shows if errors of a specific type have occurred

Parameters
maskmask to filter for a specific flag
Returns
0 if everything is ok non-zero value on error condition
See also
DiagFlag
Here is the call graph for this function:

◆ getSysDiagnosis() [3/3]

uint8_t Tle94112::getSysDiagnosis ( uint8_t  mask)

shows if errors of a specific type have occurred

Parameters
maskmask to filter for one or more specific flags this can be a disjunction of DiagFlag values
Returns
0 if everything is ok non-zero value on error condition
See also
DiagFlag
Here is the call graph for this function:

◆ getHBOverCurrent()

uint8_t Tle94112::getHBOverCurrent ( HalfBridge  hb)

gets the overcurrent error flag bit for a specific halfbridge

Parameters
hbhalfbridge thats overcurrent flag will be returned
Returns
1 if there HalfBridge was shut down because of an overcurrent 0 otherwise
Here is the call graph for this function:

◆ getHBOpenLoad()

uint8_t Tle94112::getHBOpenLoad ( HalfBridge  hb)

gets the openload error flag bit for a specific halfbridge

Parameters
hbhalfbridge thats openload flag will be returned
Returns
1 if there HalfBridge detected an open load 0 otherwise
Here is the call graph for this function:

◆ clearErrors()

void Tle94112::clearErrors ( )

clears all clearable error flags

Here is the call graph for this function:

◆ directWriteReg()

void Tle94112::directWriteReg ( uint8_t  reg,
uint8_t  data 
)

writes data bits directly to a register of the TLE94112

Parameters
regaddress of the register to be written to.
datathe data byte that has to be written.
See also
mCtrlRegAddresses
mCtrlRegData
Here is the call graph for this function:

◆ readStatusReg() [1/2]

uint8_t Tle94112::readStatusReg ( uint8_t  reg)

reads one byte from a status register of the TLE94112

Parameters
regstatus register number(mapping array index / StatusRegisters constant) of the register
Returns
data byte that has been read
See also
StatusRegisters
TLE94112_NUM_STATUS_REGS
mStatusRegAddresses
Here is the call graph for this function:

◆ init()

void Tle94112::init ( void  )
protected

initializes this object, automatically called by begin()

< initial control register configuration

< status register configuration

< bit masking for all halfbridges

< bit masking for all pwm channels

◆ _configHB()

void Tle94112::_configHB ( uint8_t  hb,
uint8_t  state,
uint8_t  pwm,
uint8_t  activeFW 
)
protected

sets the output state and the PWM channel for a halfbridge automatically called by the public version of configHB

Parameters
hbhalfbridge which will be configured
statesets the output voltage to high, low or floating
pwmselects a PWM channel for PWM output
activeFW1 for active freewheeling 0 for passive freewheeling (default)
Here is the call graph for this function:

◆ _configPWM()

void Tle94112::_configPWM ( uint8_t  pwm,
uint8_t  freq,
uint8_t  dutyCycle 
)
protected

sets the frequency and duty cycle for a PWM channel automatically called by the public version of configPWM

Parameters
pwmPWM channel which will be configured
freqselects the PWM output frequency
dutyCyclea value from 0 to 255 which sets the dutyCycle
Here is the call graph for this function:

◆ _getHBOverCurrent()

uint8_t Tle94112::_getHBOverCurrent ( uint8_t  hb)
protected

gets the overcurrent error flag bit for a specific halfbridge automatically called by the public version of getHBOverCurrent

Parameters
hbhalfbridge thats overcurrent flag will be returned
Returns
1 if there HalfBridge was shut down because of an overcurrent 0 otherwise
Here is the call graph for this function:

◆ _getHBOpenLoad()

uint8_t Tle94112::_getHBOpenLoad ( uint8_t  hb)
protected

gets the openload error flag bit for a specific halfbridge automatically called by the public version of getHBOpenLoad

Parameters
hbhalfbridge thats openload flag will be returned
Returns
1 if there HalfBridge detected an open load 0 otherwise
Here is the call graph for this function:

◆ writeReg()

void Tle94112::writeReg ( uint8_t  reg,
uint8_t  mask,
uint8_t  shift,
uint8_t  data 
)
protected

writes data bits to a control register of the TLE94112

Parameters
regcontrol register number(mapping array index / CtrlRegisters constant) of the register
maskmask for the bits that have to be written
shiftdata will be shifted left by this amount before masking. This is for the bit alignment of data
datathe data byte that has to be written. It will be shifted and masked before
See also
CtrlRegisters
TLE94112_NUM_CTRL_REGS
mCtrlRegAddresses
mCtrlRegData
Here is the call graph for this function:

◆ readStatusReg() [2/2]

uint8_t Tle94112::readStatusReg ( uint8_t  reg,
uint8_t  mask,
uint8_t  shift 
)
protected

reads some bits from a status register of the TLE94112

Parameters
regstatus register number(mapping array index / StatusRegisters constant) of the register
maskmask for the bits that have to be read
shiftdata will be shifted right by this amount after masking. This is for the bit alignment of data
Returns
data bits that have been read (after masking and shifting)
See also
StatusRegisters
TLE94112_NUM_STATUS_REGS
mStatusRegAddresses
Here is the call graph for this function:

◆ clearStatusReg()

void Tle94112::clearStatusReg ( uint8_t  reg)
protected

clears a status register by writing 0x00 to it

Parameters
regstatus register number(mapping array index / StatusRegisters constant) of the register
See also
StatusRegisters
TLE94112_NUM_STATUS_REGS
mStatusRegAddresses
Here is the call graph for this function:

Field Documentation

◆ TLE_STATUS_OK

const uint8_t Tle94112::TLE_STATUS_OK = 0U
static

Reference value of Status Register.

◆ sBus

SPIC* Tle94112::sBus

◆ cs

GPIOC* Tle94112::cs

◆ en

GPIOC* Tle94112::en

◆ timer

Timer* Tle94112::timer

◆ mHalfBridges

HalfBridge_t Tle94112::mHalfBridges[TLE94112_NUM_HB]
protected

array of register locations for halfbridges

◆ mPwmChannels

PWMchannel_t Tle94112::mPwmChannels[TLE94112_NUM_PWM]
protected

array of register locations for PWM channels

◆ mCtrlRegAddresses

uint8_t Tle94112::mCtrlRegAddresses[TLE94112_NUM_CTRL_REGS]
protected

mapping array for control register addresses

◆ mCtrlRegData

uint8_t Tle94112::mCtrlRegData[TLE94112_NUM_CTRL_REGS]
protected

mirror array for control register data

◆ mStatusRegAddresses

uint8_t Tle94112::mStatusRegAddresses[TLE94112_NUM_STATUS_REGS]
protected

mapping array for status register addresses

◆ mEnabled

uint8_t Tle94112::mEnabled
protected

Macro Definition Documentation

◆ REG_ACT_1

#define REG_ACT_1   0x03

◆ REG_ACT_2

#define REG_ACT_2   0x43

◆ REG_ACT_3

#define REG_ACT_3   0x23

◆ REG_MODE_1

#define REG_MODE_1   0x63

◆ REG_MODE_2

#define REG_MODE_2   0x13

◆ REG_MODE_3

#define REG_MODE_3   0x53

◆ REG_PWM_CH_FREQ

#define REG_PWM_CH_FREQ   0x33

◆ REG_PWM_DC_1

#define REG_PWM_DC_1   0x73

◆ REG_PWM_DC_2

#define REG_PWM_DC_2   0x0B

◆ REG_PWM_DC_3

#define REG_PWM_DC_3   0x4B

◆ REG_SYS_DIAG

#define REG_SYS_DIAG   0x1B

◆ REG_ERR1

#define REG_ERR1   0x5B

◆ REG_ERR2

#define REG_ERR2   0x3B

◆ REG_ERR3

#define REG_ERR3   0x7B

◆ REG_ERR4

#define REG_ERR4   0x07

◆ REG_ERR5

#define REG_ERR5   0x47

◆ REG_ERR6

#define REG_ERR6   0x27

◆ REG_FW_OL

#define REG_FW_OL   0x2B

◆ REG_FW_CTRL

#define REG_FW_CTRL   0x6B

◆ HL_HL

#define HL_HL   0b10011001

◆ HL_LH

#define HL_LH   0b10010110

◆ LH_HL

#define LH_HL   0b01101001

◆ LH_LH

#define LH_LH   0b01100110

◆ HH_LL

#define HH_LL   0b10100101

◆ LL_HH

#define LL_HH   0b01011010

◆ TLE94112_NUM_HB

#define TLE94112_NUM_HB   13

the number of halfbridges on a TLE94112 (including no halfbridge)

See also
mHalfBridges
HalfBridge

◆ TLE94112_NUM_PWM

#define TLE94112_NUM_PWM   4

the number of pwm modes for a halfbridge (including no pwm)

See also
mPwmChannels
PWMChannel

◆ TLE94112_NUM_CTRL_REGS

#define TLE94112_NUM_CTRL_REGS   12

the number of control registers in a TLE94112

See also
CtrlRegisters
mCtrlRegAddresses
mCtrlRegData

◆ TLE94112_NUM_STATUS_REGS

#define TLE94112_NUM_STATUS_REGS   7

the number of status registers in a TLE94112

See also
StatusRegisters
mStatusRegAddresses
mStatusRegData

Enumeration Type Documentation

◆ Error_t

Enumerator
OK 

No error

INTF_ERROR 

Interface error

CONF_ERROR 

Configuration error

READ_ERROR 

Read error

WRITE_ERROR 

Write error