Lite SBC Library  v1.0.0
TLE94x1.h File Reference

Main header declaration file for TLE94x1 SBC family device. More...

#include "TLE94x1_DEFINES.h"
#include "TLE94x1_ISR.h"
#include "TLE94x1_SPI.h"
#include <stdint.h>
Include dependency graph for TLE94x1.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  __SBC_ErrorCode
 A structure for simple error readout. More...
 

Macros

#define SBC_Write_Bit   (0x80U)
 This bit has to be set in order to write to a register.
 
#define SBC_Read_Mask   (0x7FU)
 A mask to prevent the user from accidentally writing to a register.
 

Typedefs

typedef struct __SBC_ErrorCode SBC_ErrorCode
 A structure for simple error readout. More...
 
typedef void(* SBC_Func_Callback) (uint8_t callbackHandler)
 Typedef for interrupt callbacks.
 

Functions

SBC_ErrorCode SBC_WD_Trigger (void)
 This method will trigger the watchdog. More...
 
uint16_t SBC_Read_Command (uint8_t SBC_Reg)
 This method will proceed a readout of a register. More...
 
uint8_t SBC_Read_RegField (uint8_t SBC_Reg, uint8_t SBC_FieldMsk, uint8_t SBC_FieldPos)
 This method will proceed a readout of a dedicated bitfield within a register. More...
 
SBC_ErrorCode SBC_Write_Reg (uint8_t SBC_Reg, uint8_t SBC_Val, uint16_t *returnval)
 Writes a whole byte to a register and verifies it. More...
 
SBC_ErrorCode SBC_Write_RegField (uint8_t SBC_Reg, uint8_t SBC_FieldMsk, uint8_t SBC_FieldPos, uint8_t SBC_FieldVal, uint16_t *returnval)
 This method can be used for manipulating a single bit-field in a control-register. More...
 
SBC_ErrorCode SBC_Init (void)
 This method must be called one time at startup of the microcontroller. More...
 
void SBC_Register_Callback (uint32_t ISR_Vector, void(*Callback_Handler)(uint8_t callbackHandler))
 This function can register a self-defined function to a specific interrupt-event of the SBC. More...
 
SBC_ErrorCode SBC_ISR (void)
 Interrupt Service Routine for handling interrupts. More...
 
SBC_ErrorCode SBC_Mode_Normal (void)
 Enters SBC normal mode. More...
 
SBC_ErrorCode SBC_Mode_Stop (void)
 Enters SBC stop mode. More...
 
SBC_ErrorCode SBC_Mode_Sleep (void)
 Clears all wake status registers and enter SBC sleep mode. Depending on configuration also the selective-wake feature will be initialized before entering sleep mode. In case, the SWK option is enabled and the internal CAN protocol handler is not in sync when calling this function, the sleep mode will be not entered. More...
 
SBC_ErrorCode SBC_Set_DutyCycle_PWM (uint8_t PWM_DC)
 Sets the duty-cycle of the internal PWM generator. More...
 
SBC_ErrorCode SBC_Set_Timer_On (uint8_t OnTime)
 Sets the OnTime of the internal timer. More...
 
SBC_ErrorCode SBC_Set_Timer_Period (uint8_t Period)
 Sets the Period time of the internal timer. More...
 
SBC_ErrorCode SBC_FO_Test_On (void)
 FO output activated by software for testing. Only working if FO/GPIO is configured as FO. More...
 
SBC_ErrorCode SBC_FO_Test_Off (void)
 FO output deactivated by software for testing. Only working if FO/GPIO is configured as FO. More...
 
SBC_ErrorCode SBC_CP_On (void)
 Charge-Pump (VCP-Pin) is enabled. See chapter 5.3 in datasheet. More...
 
SBC_ErrorCode SBC_CP_Off (void)
 Charge-Pump (VCP-Pin) is disabled. See chapter 5.3 in datasheet. More...
 
SBC_ErrorCode SBC_WK_MEAS_On (void)
 Enable Voltage Sensing. No wake-up events are generated. See chapter 9.2.4 in datasheet. More...
 
SBC_ErrorCode SBC_WK_MEAS_Off (void)
 Disable Voltage Sensing and enable wake-up functionality. See chapter 9.2.4 in datasheet. More...
 
SBC_ErrorCode SBC_TIMER_WK_EN_On (void)
 WK is enabled as wake source. See chapter 5.2. More...
 
SBC_ErrorCode SBC_TIMER_WK_EN_Off (void)
 WK wake-up disabled. See chapter 5.2. More...
 
uint16_t SBC_SYS_STAT_Read (void)
 Reads System Status Control, both lower and higher bits. See page 138 in datasheet. More...
 
SBC_ErrorCode SBC_SYS_STAT_Write (uint16_t SystemStatus)
 Writes System Status Control, both lower and higher bits. See page 138 in datasheet. More...
 
SBC_ErrorCode SBC_Lock_Configuration (void)
 Locks CP_EN, GPIO configuration and 'rwl'-bits. More...
 
SBC_ErrorCode SBC_Unlock_Configuration (void)
 Unlocks CP_EN, GPIO configuration and 'rwl'-bits. More...
 
SBC_ErrorCode SBC_Clear_Wake_Status (void)
 Clears both Wake Status registers. More...
 

Detailed Description

Main header declaration file for TLE94x1 SBC family device.

Version
V1.0.0
Date
15. April 2019
Author
Markus Noll / marku.nosp@m.s.no.nosp@m.ll@in.nosp@m.fine.nosp@m.on.co.nosp@m.m
Yannek Micha Rixen / Yanne.nosp@m.k.Ri.nosp@m.xen@i.nosp@m.nfin.nosp@m.eon.c.nosp@m.om

Typedef Documentation

◆ SBC_ErrorCode

A structure for simple error readout.

    flippedBitsMask is greater than 0 if the value read from the register at SBC_Register differs from expectedValue.

Function Documentation

◆ SBC_Clear_Wake_Status()

SBC_ErrorCode SBC_Clear_Wake_Status ( void  )

Clears both Wake Status registers.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_CP_Off()

SBC_ErrorCode SBC_CP_Off ( void  )

Charge-Pump (VCP-Pin) is disabled. See chapter 5.3 in datasheet.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_CP_On()

SBC_ErrorCode SBC_CP_On ( void  )

Charge-Pump (VCP-Pin) is enabled. See chapter 5.3 in datasheet.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_FO_Test_Off()

SBC_ErrorCode SBC_FO_Test_Off ( void  )

FO output deactivated by software for testing. Only working if FO/GPIO is configured as FO.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_FO_Test_On()

SBC_ErrorCode SBC_FO_Test_On ( void  )

FO output activated by software for testing. Only working if FO/GPIO is configured as FO.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Init()

SBC_ErrorCode SBC_Init ( void  )

This method must be called one time at startup of the microcontroller.

     This method will initialize all registers of the SBC with the configuration-data of SBC_TLE94x1.h.
     After this, the SBC can be used as normal.
Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.

◆ SBC_ISR()

SBC_ErrorCode SBC_ISR ( void  )

Interrupt Service Routine for handling interrupts.

     This method must be called automatically everytime a rising-edge on the INTN pin is recognized.
     In case, the INTN pin is not connected, this method can also be called periodically by the user during runtime.
     The ISR will proceed a readout of all registered interrupts. If a status-bit of a registered interrupt is set,
     it will initiate a callback to the registered function and give the registered function the status-register value
     as a parameter.
Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.

◆ SBC_Lock_Configuration()

SBC_ErrorCode SBC_Lock_Configuration ( void  )

Locks CP_EN, GPIO configuration and 'rwl'-bits.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Mode_Normal()

SBC_ErrorCode SBC_Mode_Normal ( void  )

Enters SBC normal mode.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Mode_Sleep()

SBC_ErrorCode SBC_Mode_Sleep ( void  )

Clears all wake status registers and enter SBC sleep mode. Depending on configuration also the selective-wake feature will be initialized before entering sleep mode. In case, the SWK option is enabled and the internal CAN protocol handler is not in sync when calling this function, the sleep mode will be not entered.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Mode_Stop()

SBC_ErrorCode SBC_Mode_Stop ( void  )

Enters SBC stop mode.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Read_Command()

uint16_t SBC_Read_Command ( uint8_t  SBC_Reg)

This method will proceed a readout of a register.

Parameters
SBC_RegAddress of the register to be read out. See TLE94x1_DEFINES.h for definitions
Return values
A16 bit value will be returned. Bit[15:8] is the Status-Information-Field, Bit [7:0] is the read register-value. For furhter information of the Status-Information-Field see chapter 13.3 in the datasheet.
Here is the call graph for this function:

◆ SBC_Read_RegField()

uint8_t SBC_Read_RegField ( uint8_t  SBC_Reg,
uint8_t  SBC_FieldMsk,
uint8_t  SBC_FieldPos 
)

This method will proceed a readout of a dedicated bitfield within a register.

Parameters
SBC_RegAddress of the register to be readout. See TLE94x1_DEFINES.h for definitions
SBC_FieldMskBit mask of the field to be readout. See TLE94x1_DEFINES.h for definitions
SBC_FieldPosBit position of the field to be readout. See TLE94x1_DEFINES.h for definitions
Return values
A8 bit value will be returned and includes the data of the bitfield to be read out *
Here is the call graph for this function:

◆ SBC_Register_Callback()

void SBC_Register_Callback ( uint32_t  ISR_Vector,
void(*)(uint8_t callbackHandler)  Callback_Handler 
)

This function can register a self-defined function to a specific interrupt-event of the SBC.

     Everytime the SBC_ISR() method is called and the associated status-bit is set, it will consider to
     proceed a callback to this function later.
     See all the possible ISR_Vectors in the TLE94x1_ISR.h
Parameters
ISR_VectorDefinition of the interrupt event. See all possible events in TLE94x1_ISR.h
*Callback_HandlerPointer to the function which will be called back. The function must accept a uint8_t as first argument.

◆ SBC_Set_DutyCycle_PWM()

SBC_ErrorCode SBC_Set_DutyCycle_PWM ( uint8_t  PWM_DC)

Sets the duty-cycle of the internal PWM generator.

Parameters
PWM_DCSet the duty-cycle with values of 0-255 for 0% to 100%
Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Set_Timer_On()

SBC_ErrorCode SBC_Set_Timer_On ( uint8_t  OnTime)

Sets the OnTime of the internal timer.

Parameters
OnTimeOn time which will be configured to the timer. See TLE94x1_DEFINES.h for enumerations.
Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Set_Timer_Period()

SBC_ErrorCode SBC_Set_Timer_Period ( uint8_t  Period)

Sets the Period time of the internal timer.

Parameters
PeriodPeriod time which will be configured to the timer. See TLE94x1_DEFINES.h for enumerations.
Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_SYS_STAT_Read()

uint16_t SBC_SYS_STAT_Read ( void  )

Reads System Status Control, both lower and higher bits. See page 138 in datasheet.

Return values
Upper8 bit are read from register SBC_SYS_STATUS_CTRL_1 and the lower 8 bit from SBC_SYS_STATUS_CTRL_0
Here is the call graph for this function:

◆ SBC_SYS_STAT_Write()

SBC_ErrorCode SBC_SYS_STAT_Write ( uint16_t  SystemStatus)

Writes System Status Control, both lower and higher bits. See page 138 in datasheet.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_TIMER_WK_EN_Off()

SBC_ErrorCode SBC_TIMER_WK_EN_Off ( void  )

WK wake-up disabled. See chapter 5.2.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_TIMER_WK_EN_On()

SBC_ErrorCode SBC_TIMER_WK_EN_On ( void  )

WK is enabled as wake source. See chapter 5.2.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Unlock_Configuration()

SBC_ErrorCode SBC_Unlock_Configuration ( void  )

Unlocks CP_EN, GPIO configuration and 'rwl'-bits.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_WD_Trigger()

SBC_ErrorCode SBC_WD_Trigger ( void  )

This method will trigger the watchdog.

     The function must be called periodically according to the configured watchdog-time.
Here is the call graph for this function:

◆ SBC_WK_MEAS_Off()

SBC_ErrorCode SBC_WK_MEAS_Off ( void  )

Disable Voltage Sensing and enable wake-up functionality. See chapter 9.2.4 in datasheet.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_WK_MEAS_On()

SBC_ErrorCode SBC_WK_MEAS_On ( void  )

Enable Voltage Sensing. No wake-up events are generated. See chapter 9.2.4 in datasheet.

Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Write_Reg()

SBC_ErrorCode SBC_Write_Reg ( uint8_t  SBC_Reg,
uint8_t  SBC_Val,
uint16_t *  returnval 
)

Writes a whole byte to a register and verifies it.

Parameters
SBC_RegAddress of the register to be manipulated. See TLE94x1_DEFINES.h for definitions
SBC_ValByte to write to SBC_Reg
*returnvalA 16 bit value will be returned. Bit[15:8] is the Status-Information-Field, Bit [7:0] is the value of the manipulated register before write For furhter information of the Status-Information-Field see chapter 13.3 in the datasheet.
Return values
Seedescription of SBC_ErrorCode.
Here is the call graph for this function:

◆ SBC_Write_RegField()

SBC_ErrorCode SBC_Write_RegField ( uint8_t  SBC_Reg,
uint8_t  SBC_FieldMsk,
uint8_t  SBC_FieldPos,
uint8_t  SBC_FieldVal,
uint16_t *  returnval 
)

This method can be used for manipulating a single bit-field in a control-register.

     It will readout the old value of the registers, manipulate the desired bit-field and keep
     the other bit-configuration as it was.
     For usage examples have a look at the implementations of different API calls below.
Parameters
SBC_RegAddress of the register to be manipulated. See TLE94x1_DEFINES.h for definitions
SBC_FieldMskBit mask of the field to manipulate. See TLE94x1_DEFINES.h for definitions
SBC_FieldPosBit position of the field to manipulate. See TLE94x1_DEFINES.h for definitions
SBC_FieldValNew value which will be written to the bit-field. See TLE94x1_DEFINES.h for enumerations
*returnvalA 16 bit value will be returned. Bit[15:8] is the Status-Information-Field, Bit [7:0] is the value of the manipulated register before write For furhter information of the Status-Information-Field see chapter 13.3 in the datasheet.
Return values
SBC_ErrorCodeSee description of SBC_ErrorCode.
Here is the call graph for this function: