Lite SBC Library
v1.0.0
|
Implementation of main library functions. More...
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... | |
Implementation of main library functions.
SBC_ErrorCode SBC_Clear_Wake_Status | ( | void | ) |
Clears both Wake Status registers.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_CP_Off | ( | void | ) |
Charge-Pump (VCP-Pin) is disabled. See chapter 5.3 in datasheet.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_CP_On | ( | void | ) |
Charge-Pump (VCP-Pin) is enabled. See chapter 5.3 in datasheet.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_FO_Test_Off | ( | void | ) |
FO output deactivated by software for testing. Only working if FO/GPIO is configured as FO.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_FO_Test_On | ( | void | ) |
FO output activated by software for testing. Only working if FO/GPIO is configured as FO.
SBC_ErrorCode | See description of SBC_ErrorCode. |
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.
SBC_ErrorCode | See description of SBC_ErrorCode. |
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.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_Lock_Configuration | ( | void | ) |
Locks CP_EN, GPIO configuration and 'rwl'-bits.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_Mode_Normal | ( | void | ) |
Enters SBC normal mode.
SBC_ErrorCode | See description of SBC_ErrorCode. |
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.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_Mode_Stop | ( | void | ) |
Enters SBC stop mode.
SBC_ErrorCode | See description of SBC_ErrorCode. |
uint16_t SBC_Read_Command | ( | uint8_t | SBC_Reg | ) |
This method will proceed a readout of a register.
SBC_Reg | Address of the register to be read out. See TLE94x1_DEFINES.h for definitions |
A | 16 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. |
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.
SBC_Reg | Address of the register to be readout. See TLE94x1_DEFINES.h for definitions |
SBC_FieldMsk | Bit mask of the field to be readout. See TLE94x1_DEFINES.h for definitions |
SBC_FieldPos | Bit position of the field to be readout. See TLE94x1_DEFINES.h for definitions |
A | 8 bit value will be returned and includes the data of the bitfield to be read out * |
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
ISR_Vector | Definition of the interrupt event. See all possible events in TLE94x1_ISR.h |
*Callback_Handler | Pointer to the function which will be called back. The function must accept a uint8_t as first argument. |
SBC_ErrorCode SBC_Set_DutyCycle_PWM | ( | uint8_t | PWM_DC | ) |
Sets the duty-cycle of the internal PWM generator.
PWM_DC | Set the duty-cycle with values of 0-255 for 0% to 100% |
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_Set_Timer_On | ( | uint8_t | OnTime | ) |
Sets the OnTime of the internal timer.
OnTime | On time which will be configured to the timer. See TLE94x1_DEFINES.h for enumerations. |
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_Set_Timer_Period | ( | uint8_t | Period | ) |
Sets the Period time of the internal timer.
Period | Period time which will be configured to the timer. See TLE94x1_DEFINES.h for enumerations. |
SBC_ErrorCode | See description of SBC_ErrorCode. |
uint16_t SBC_SYS_STAT_Read | ( | void | ) |
Reads System Status Control, both lower and higher bits. See page 138 in datasheet.
Upper | 8 bit are read from register SBC_SYS_STATUS_CTRL_1 and the lower 8 bit from SBC_SYS_STATUS_CTRL_0 |
SBC_ErrorCode SBC_SYS_STAT_Write | ( | uint16_t | SystemStatus | ) |
Writes System Status Control, both lower and higher bits. See page 138 in datasheet.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_TIMER_WK_EN_Off | ( | void | ) |
WK wake-up disabled. See chapter 5.2.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_TIMER_WK_EN_On | ( | void | ) |
WK is enabled as wake source. See chapter 5.2.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_Unlock_Configuration | ( | void | ) |
Unlocks CP_EN, GPIO configuration and 'rwl'-bits.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_WD_Trigger | ( | void | ) |
This method will trigger the watchdog.
The function must be called periodically according to the configured watchdog-time.
SBC_ErrorCode SBC_WK_MEAS_Off | ( | void | ) |
Disable Voltage Sensing and enable wake-up functionality. See chapter 9.2.4 in datasheet.
SBC_ErrorCode | See description of SBC_ErrorCode. |
SBC_ErrorCode SBC_WK_MEAS_On | ( | void | ) |
Enable Voltage Sensing. No wake-up events are generated. See chapter 9.2.4 in datasheet.
SBC_ErrorCode | See description of SBC_ErrorCode. |
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.
SBC_Reg | Address of the register to be manipulated. See TLE94x1_DEFINES.h for definitions |
SBC_Val | Byte to write to SBC_Reg |
*returnval | A 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. |
See | description of SBC_ErrorCode. |
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.
SBC_Reg | Address of the register to be manipulated. See TLE94x1_DEFINES.h for definitions |
SBC_FieldMsk | Bit mask of the field to manipulate. See TLE94x1_DEFINES.h for definitions |
SBC_FieldPos | Bit position of the field to manipulate. See TLE94x1_DEFINES.h for definitions |
SBC_FieldVal | New value which will be written to the bit-field. See TLE94x1_DEFINES.h for enumerations |
*returnval | A 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. |
SBC_ErrorCode | See description of SBC_ErrorCode. |