Infineon MOTIX™ MCU TLE987x Device Family SDK
Data Structures | Typedefs | Functions
uart.h File Reference

Go to the source code of this file.

Detailed Description

UART low level access library.

Version
V0.2.4
Date
18. Oct 2022

Include Graph

Include dependency graph for uart.h:

Data Structures

struct  Uart
 

Typedefs

typedef struct Uart TUart
 

Functions

INLINE void UART1_BaudRate_Value_Set (uint16 br_val)
 Writes the baudrate timer register (UART1). More...
 
INLINE void UART1_BaudRateGen_Dis (void)
 disables Baud-rate generator (UART1). More...
 
INLINE void UART1_BaudRateGen_En (void)
 enables Baud-rate generator (UART1). More...
 
INLINE void UART2_BaudRate_Value_Set (uint16 br_val)
 Writes the baudrate timer register (UART2). More...
 
INLINE void UART2_BaudRateGen_Dis (void)
 disables Baud-rate generator (UART2). More...
 
INLINE void UART2_BaudRateGen_En (void)
 enables Baud-rate generator (UART2). More...
 
INLINE void UART1_Buffer_Set (uint8 data)
 Sends a Byte via UART1. More...
 
INLINE void UART2_Buffer_Set (uint8 data)
 Sends a Byte via UART2. More...
 
INLINE uint8 UART1_Buffer_Get (void)
 Reads UART1 Buffer. More...
 
INLINE uint8 UART2_Buffer_Get (void)
 Reads UART2 Buffer. More...
 
INLINE uint8 UART1_RX_Sts (void)
 reads the receive interrupt flag of UART1. More...
 
INLINE uint8 UART1_TX_Sts (void)
 reads the transmit interrupt flag of UART1. More...
 
INLINE uint8 UART2_RX_Sts (void)
 reads the receive interrupt flag of UART2. More...
 
INLINE uint8 UART2_TX_Sts (void)
 reads the transmit interrupt flag of UART2. More...
 
INLINE void UART1_Receiver_En (void)
 enables Receiver of Serial Port (UART1). More...
 
INLINE void UART1_Receiver_Dis (void)
 disables Receiver of Serial Port (UART1). More...
 
INLINE void UART2_Receiver_En (void)
 enables Receiver of Serial Port (UART2). More...
 
INLINE void UART2_Receiver_Dis (void)
 disables Receiver of Serial Port (UART2). More...
 
INLINE void UART1_RX_Int_Clr (void)
 clears receive interrupt flag for UART1. More...
 
INLINE void UART1_TX_Int_Clr (void)
 clears transmit interrupt flag of UART1. More...
 
INLINE void UART2_RX_Int_Clr (void)
 clears receive interrupt flag of UART2. More...
 
INLINE void UART2_TX_Int_Clr (void)
 clears transmit interrupt flag of UART2. More...
 
INLINE void UART1_RX_Int_En (void)
 enables receive interrupt of UART1. More...
 
INLINE void UART1_RX_Int_Dis (void)
 disables receive interrupt of UART1. More...
 
INLINE void UART1_TX_Int_En (void)
 enables transmit interrupt of UART1. More...
 
INLINE void UART1_TX_Int_Dis (void)
 disables transmit interrupt of UART1. More...
 
INLINE void UART2_RX_Int_En (void)
 enables receive interrupt of UART2. More...
 
INLINE void UART2_RX_Int_Dis (void)
 disables receive interrupt of UART2. More...
 
INLINE void UART2_TX_Int_En (void)
 enables transmit interrupt of UART2. More...
 
INLINE void UART2_TX_Int_Dis (void)
 disables transmit interrupt of UART2. More...
 
void UART1_Init (void)
 Initializes the UART1 module based on the Config Wizard for MOTIX MCU configuration. More...
 
void UART2_Init (void)
 Initializes the UART2 module based on the Config Wizard for MOTIX MCU configuration. More...
 
void UART1_BaudRate_Set (uint32 baudrate)
 Sets the baudrate of UART1. More...
 
void UART2_BaudRate_Set (uint32 baudrate)
 Sets the baudrate of UART2. More...
 
INLINE void UART1_Send_Byte (uint8 c)
 clears the UART1 Transmit interrupt and sends a Byte via UART1. More...
 
INLINE uint8 UART1_Get_Byte (void)
 Clears the UART1 receive interrupt and returns the UART1 buffer. More...
 
INLINE bool UART1_isByteReceived (void)
 checks if UART1 has received Byte or not. More...
 
INLINE bool UART1_isByteTransmitted (void)
 checks if UART1 has transmitted a Byte or not. More...
 
INLINE void UART2_Send_Byte (uint8 c)
 clears the UART2 Transmit interrupt and sends a Byte via UART2. More...
 
INLINE uint8 UART2_Get_Byte (void)
 Clears the UART2 receive interrupt and returns the UART2 buffer. More...
 
INLINE bool UART2_isByteReceived (void)
 checks if UART2 has received Byte or not. More...
 
INLINE bool UART2_isByteTransmitted (void)
 checks if UART2 has transmitted a Byte or not. More...
 

Typedef Documentation

◆ TUart

typedef struct Uart TUart

Function Documentation

◆ UART1_BaudRate_Set()

void UART1_BaudRate_Set ( uint32  baudrate)

Sets the baudrate of UART1.

Parameters
baudratebaudrate, e.g. 19200, or 115200; range: 1221 to 5000000 (a value out of this range will not be applied)

Example

This example sets UART1 BAUDRATE to 19200.

void Example_Function(void)
{
}
void UART1_BaudRate_Set(uint32 baudrate)
Sets the baudrate of UART1.

◆ UART1_BaudRate_Value_Set()

INLINE void UART1_BaudRate_Value_Set ( uint16  br_val)

Writes the baudrate timer register (UART1).

Note
Setting new Baud-rate value must be when BaudRateGen is disabled.

Example

This example receives a Byte via UART1 (baud-rate is equal to 19200 when frequency is equal to 40MHz).

void Example_Function(void)
{
uint8 ch;
if (UART1_isByteReceived() == TRUE)
{
}
}
uint8_t uint8
8 bit unsigned value
Definition: types.h:153
INLINE void UART1_Receiver_Dis(void)
disables Receiver of Serial Port (UART1).
Definition: uart.h:532
INLINE void UART1_Receiver_En(void)
enables Receiver of Serial Port (UART1).
Definition: uart.h:507
INLINE uint8 UART1_Get_Byte(void)
Clears the UART1 receive interrupt and returns the UART1 buffer.
Definition: uart.h:981
INLINE bool UART1_isByteReceived(void)
checks if UART1 has received Byte or not.
Definition: uart.h:1009
INLINE void UART1_BaudRateGen_Dis(void)
disables Baud-rate generator (UART1).
Definition: uart.h:165
INLINE void UART1_BaudRateGen_En(void)
enables Baud-rate generator (UART1).
Definition: uart.h:194
INLINE void UART1_BaudRate_Value_Set(uint16 br_val)
Writes the baudrate timer register (UART1).
Definition: uart.h:136

◆ UART1_BaudRateGen_Dis()

INLINE void UART1_BaudRateGen_Dis ( void  )

disables Baud-rate generator (UART1).

Note
Setting new Baud-rate value must be when BaudRateGen is disabled.

Example

This example receives a Byte via UART1 (baud-rate is equal to 19200 when frequency is equal to 40MHz).

◆ UART1_BaudRateGen_En()

INLINE void UART1_BaudRateGen_En ( void  )

enables Baud-rate generator (UART1).

Note
Setting new Baud-rate value must be when BaudRateGen is disabled.

Example

This example receives a Byte via UART1 (baud-rate is equal to 19200 when frequency is equal to 40MHz).

◆ UART1_Buffer_Get()

INLINE uint8 UART1_Buffer_Get ( void  )

Reads UART1 Buffer.

Returns
Received Byte

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_isByteReceived() == TRUE)
{
}
}
INLINE uint8 UART1_Buffer_Get(void)
Reads UART1 Buffer.
Definition: uart.h:355
INLINE void UART1_RX_Int_Clr(void)
clears receive interrupt flag for UART1.
Definition: uart.h:607

◆ UART1_Buffer_Set()

INLINE void UART1_Buffer_Set ( uint8  data)

Sends a Byte via UART1.

Parameters
dataByte to send

Example

This example sends "A" via UART1.

void Example_Function(void)
{
if (UART1_isByteTransmitted() == TRUE)
{
}
}
INLINE void UART1_TX_Int_Clr(void)
clears transmit interrupt flag of UART1.
Definition: uart.h:629
INLINE bool UART1_isByteTransmitted(void)
checks if UART1 has transmitted a Byte or not.
Definition: uart.h:1040
INLINE void UART1_Buffer_Set(uint8 data)
Sends a Byte via UART1.
Definition: uart.h:304

◆ UART1_Get_Byte()

INLINE uint8 UART1_Get_Byte ( void  )

Clears the UART1 receive interrupt and returns the UART1 buffer.

Returns
Received Byte

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_isByteReceived() == TRUE)
{
}
}

◆ UART1_Init()

void UART1_Init ( void  )

Initializes the UART1 module based on the Config Wizard for MOTIX MCU configuration.

◆ UART1_isByteReceived()

INLINE bool UART1_isByteReceived ( void  )

checks if UART1 has received Byte or not.

Return values
TRUEa byte was received
FALSEno byte was received

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_isByteReceived() == TRUE)
{
}
}

◆ UART1_isByteTransmitted()

INLINE bool UART1_isByteTransmitted ( void  )

checks if UART1 has transmitted a Byte or not.

Return values
TRUEa byte was transmitted
FALSEno byte was transmitted

Example

This example sends "A" via UART1.

void Example_Function(void)
{
if (UART1_isByteTransmitted() == TRUE)
{
}
}
INLINE void UART1_Send_Byte(uint8 c)
clears the UART1 Transmit interrupt and sends a Byte via UART1.
Definition: uart.h:954

◆ UART1_Receiver_Dis()

INLINE void UART1_Receiver_Dis ( void  )

disables Receiver of Serial Port (UART1).

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_isByteReceived() == TRUE)
{
}
}

◆ UART1_Receiver_En()

INLINE void UART1_Receiver_En ( void  )

enables Receiver of Serial Port (UART1).

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_isByteReceived() == TRUE)
{
}
}

◆ UART1_RX_Int_Clr()

INLINE void UART1_RX_Int_Clr ( void  )

clears receive interrupt flag for UART1.

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_isByteReceived() == TRUE)
{
}
}

◆ UART1_RX_Int_Dis()

INLINE void UART1_RX_Int_Dis ( void  )

disables receive interrupt of UART1.

Example

This example treats the receive interrupt for UART1.

void Example_Function(void)
{
if (UART1_RX_Sts() == (uint8)1u)
{
UART1_RX_CALLBACK();
}
}
INLINE uint8 UART1_RX_Sts(void)
reads the receive interrupt flag of UART1.
Definition: uart.h:408
INLINE void UART1_RX_Int_En(void)
enables receive interrupt of UART1.
Definition: uart.h:699
INLINE void UART1_RX_Int_Dis(void)
disables receive interrupt of UART1.
Definition: uart.h:722

◆ UART1_RX_Int_En()

INLINE void UART1_RX_Int_En ( void  )

enables receive interrupt of UART1.

Example

This example treats the receive interrupt for UART1.

void Example_Function(void)
{
if (UART1_RX_Sts() == (uint8)1u)
{
UART1_RX_CALLBACK();
}
}

◆ UART1_RX_Sts()

INLINE uint8 UART1_RX_Sts ( void  )

reads the receive interrupt flag of UART1.

Returns
Receive Interrupt Flag Status

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_RX_Sts() == (uint8)1u)
{
}
}

◆ UART1_Send_Byte()

INLINE void UART1_Send_Byte ( uint8  c)

clears the UART1 Transmit interrupt and sends a Byte via UART1.

Parameters
cByte to send

Example

This example sends "A" via UART1.

void Example_Function(void)
{
if (UART1_isByteTransmitted() == TRUE)
{
}
}

◆ UART1_TX_Int_Clr()

INLINE void UART1_TX_Int_Clr ( void  )

clears transmit interrupt flag of UART1.

Example

This example sends "A" via UART1.

void Example_Function(void)
{
if (UART1_isByteTransmitted() == TRUE)
{
}
}

◆ UART1_TX_Int_Dis()

INLINE void UART1_TX_Int_Dis ( void  )

disables transmit interrupt of UART1.

Example

This example treats the transmit interrupt for UART1.

void Example_Function(void)
{
if (UART1_TX_Sts() == (uint8)1u)
{
UART1_TX_CALLBACK();
}
}
INLINE void UART1_TX_Int_Dis(void)
disables transmit interrupt of UART1.
Definition: uart.h:767
INLINE uint8 UART1_TX_Sts(void)
reads the transmit interrupt flag of UART1.
Definition: uart.h:434
INLINE void UART1_TX_Int_En(void)
enables transmit interrupt of UART1.
Definition: uart.h:744

◆ UART1_TX_Int_En()

INLINE void UART1_TX_Int_En ( void  )

enables transmit interrupt of UART1.

Example

This example treats the transmit interrupt for UART1.

void Example_Function(void)
{
if (UART1_TX_Sts() == (uint8)1u)
{
UART1_TX_CALLBACK();
}
}

◆ UART1_TX_Sts()

INLINE uint8 UART1_TX_Sts ( void  )

reads the transmit interrupt flag of UART1.

Returns
Receive Interrupt Flag Status

Example

This example receives a Byte via UART1.

void Example_Function(void)
{
uint8 ch;
if (UART1_RX_Sts() == (uint8)1u)
{
}
}

◆ UART2_BaudRate_Set()

void UART2_BaudRate_Set ( uint32  baudrate)

Sets the baudrate of UART2.

Parameters
baudratebaudrate, e.g. 19200, or 115200; range: 1221 to 5000000 (a value out of this range will not be applied)

Example

This example sets UART2 BAUDRATE to 19200.

void Example_Function(void)
{
}
void UART2_BaudRate_Set(uint32 baudrate)
Sets the baudrate of UART2.

◆ UART2_BaudRate_Value_Set()

INLINE void UART2_BaudRate_Value_Set ( uint16  br_val)

Writes the baudrate timer register (UART2).

Note
Setting new Baud-rate value must be when BaudRateGen is disabled.

Example

This example receives a Byte via UART1 (baud-rate is equal to 19200 when frequency is equal to 40MHz).

void Example_Function(void)
{
uint8 ch;
if (UART2_isByteReceived() == TRUE)
{
}
}
INLINE void UART2_BaudRateGen_En(void)
enables Baud-rate generator (UART2).
Definition: uart.h:280
INLINE void UART2_Receiver_Dis(void)
disables Receiver of Serial Port (UART2).
Definition: uart.h:581
INLINE void UART2_BaudRateGen_Dis(void)
disables Baud-rate generator (UART2).
Definition: uart.h:252
INLINE uint8 UART2_Get_Byte(void)
Clears the UART2 receive interrupt and returns the UART2 buffer.
Definition: uart.h:1097
INLINE void UART2_Receiver_En(void)
enables Receiver of Serial Port (UART2).
Definition: uart.h:556
INLINE void UART2_BaudRate_Value_Set(uint16 br_val)
Writes the baudrate timer register (UART2).
Definition: uart.h:223
INLINE bool UART2_isByteReceived(void)
checks if UART2 has received Byte or not.
Definition: uart.h:1125

◆ UART2_BaudRateGen_Dis()

INLINE void UART2_BaudRateGen_Dis ( void  )

disables Baud-rate generator (UART2).

Note
Setting new Baud-rate value must be when BaudRateGen is disabled.

Example

This example receives a Byte via UART2 (baud-rate is equal to 19200 when frequency is equal to 40MHz).

◆ UART2_BaudRateGen_En()

INLINE void UART2_BaudRateGen_En ( void  )

enables Baud-rate generator (UART2).

Note
Setting new Baud-rate value must be when BaudRateGen is disabled.

Example

This example receives a Byte via UART2 (baud-rate is equal to 19200 when frequency is equal to 40MHz).

◆ UART2_Buffer_Get()

INLINE uint8 UART2_Buffer_Get ( void  )

Reads UART2 Buffer.

Returns
Received Byte

Example

This example receives a Byte via UART2.

void Example_Function(void)
{
uint8 ch;
if (UART2_isByteReceived() == TRUE)
{
}
}
INLINE void UART2_RX_Int_Clr(void)
clears receive interrupt flag of UART2.
Definition: uart.h:654
INLINE uint8 UART2_Buffer_Get(void)
Reads UART2 Buffer.
Definition: uart.h:382

◆ UART2_Buffer_Set()

INLINE void UART2_Buffer_Set ( uint8  data)

Sends a Byte via UART2.

Parameters
dataByte to send

Example

This example sends "A" via UART2.

void Example_Function(void)
{
if (UART2_isByteTransmitted() == TRUE)
{
}
}
INLINE void UART2_TX_Int_Clr(void)
clears transmit interrupt flag of UART2.
Definition: uart.h:676
INLINE void UART2_Buffer_Set(uint8 data)
Sends a Byte via UART2.
Definition: uart.h:328
INLINE bool UART2_isByteTransmitted(void)
checks if UART2 has transmitted a Byte or not.
Definition: uart.h:1156

◆ UART2_Get_Byte()

INLINE uint8 UART2_Get_Byte ( void  )

Clears the UART2 receive interrupt and returns the UART2 buffer.

Returns
Received Byte

Example

This example receives a Byte via UART2.

void Example_Function(void)
{
uint8 ch;
if (UART2_isByteReceived() == TRUE)
{
}
}

◆ UART2_Init()

void UART2_Init ( void  )

Initializes the UART2 module based on the Config Wizard for MOTIX MCU configuration.

◆ UART2_isByteReceived()

INLINE bool UART2_isByteReceived ( void  )

checks if UART2 has received Byte or not.

Return values
TRUEa byte was received
FALSEno byte was receive

Example

This example receives a Byte via UART2.

void Example_Function(void)
{
uint8 ch;
if (UART2_isByteReceived() == TRUE)
{
}
}

◆ UART2_isByteTransmitted()

INLINE bool UART2_isByteTransmitted ( void  )

checks if UART2 has transmitted a Byte or not.

Return values
TRUEa byte was transmitted
FALSEno byte was transmitted

Example

This example sends "A" via UART2.

void Example_Function(void)
{
if (UART2_isByteTransmitted() == TRUE)
{
}
}
INLINE void UART2_Send_Byte(uint8 c)
clears the UART2 Transmit interrupt and sends a Byte via UART2.
Definition: uart.h:1070

◆ UART2_Receiver_Dis()

INLINE void UART2_Receiver_Dis ( void  )

disables Receiver of Serial Port (UART2).

Example

This example receives a Byte via UART2.

void Example_Function(void)
{
uint8 ch;
if (UART2_isByteReceived() == TRUE)
{
}
}

◆ UART2_Receiver_En()

INLINE void UART2_Receiver_En ( void  )

enables Receiver of Serial Port (UART2).

Example

This example receives a Byte via UART2.

void Example_Function(void)
{
uint8 ch;
if (UART2_isByteReceived() == TRUE)
{
}
}

◆ UART2_RX_Int_Clr()

INLINE void UART2_RX_Int_Clr ( void  )

clears receive interrupt flag of UART2.

Example

This example receives a Byte via UART2.

void Example_Function(void)
{
uint8 ch;
if (UART2_isByteReceived() == TRUE)
{
}
}

◆ UART2_RX_Int_Dis()

INLINE void UART2_RX_Int_Dis ( void  )

disables receive interrupt of UART2.

Example

This example treats the receive interrupt for UART2.

void Example_Function(void)
{
if (UART2_RX_Sts() == (uint8)1u)
{
UART2_RX_CALLBACK();
}
}
INLINE void UART2_RX_Int_Dis(void)
disables receive interrupt of UART2.
Definition: uart.h:812
INLINE void UART2_RX_Int_En(void)
enables receive interrupt of UART2.
Definition: uart.h:789
INLINE uint8 UART2_RX_Sts(void)
reads the receive interrupt flag of UART2.
Definition: uart.h:460

◆ UART2_RX_Int_En()

INLINE void UART2_RX_Int_En ( void  )

enables receive interrupt of UART2.

Example

This example treats the receive interrupt for UART2.

void Example_Function(void)
{
if (UART2_RX_Sts() == (uint8)1u)
{
UART2_RX_CALLBACK();
}
}

◆ UART2_RX_Sts()

INLINE uint8 UART2_RX_Sts ( void  )

reads the receive interrupt flag of UART2.

Returns
Receive Interrupt Flag Status

Example

This example receives a Byte via UART2.

void Example_Function(void)
{
uint8 ch;
if (UART2_RX_Sts() == (uint8)1u)
{
}
}

◆ UART2_Send_Byte()

INLINE void UART2_Send_Byte ( uint8  c)

clears the UART2 Transmit interrupt and sends a Byte via UART2.

Parameters
cByte to send

Example

This example sends "A" via UART2.

void Example_Function(void)
{
if (UART2_isByteTransmitted() == TRUE)
{
}
}

◆ UART2_TX_Int_Clr()

INLINE void UART2_TX_Int_Clr ( void  )

clears transmit interrupt flag of UART2.

Example

This example sends "A" via UART2.

void Example_Function(void)
{
if (UART2_isByteTransmitted() == TRUE)
{
}
}

◆ UART2_TX_Int_Dis()

INLINE void UART2_TX_Int_Dis ( void  )

disables transmit interrupt of UART2.

Example

This example treats the transmit interrupt for UART2.

void Example_Function(void)
{
if (UART2_TX_Sts() == (uint8)1u)
{
UART2_TX_CALLBACK();
}
}
INLINE uint8 UART2_TX_Sts(void)
reads the transmit interrupt flag of UART2.
Definition: uart.h:483
INLINE void UART2_TX_Int_Dis(void)
disables transmit interrupt of UART2.
Definition: uart.h:857
INLINE void UART2_TX_Int_En(void)
enables transmit interrupt of UART2.
Definition: uart.h:834

◆ UART2_TX_Int_En()

INLINE void UART2_TX_Int_En ( void  )

enables transmit interrupt of UART2.

Example

This example treats the transmit interrupt for UART2.

void Example_Function(void)
{
if (UART2_TX_Sts() == (uint8)1u)
{
UART2_TX_CALLBACK();
}
}

◆ UART2_TX_Sts()

INLINE uint8 UART2_TX_Sts ( void  )

reads the transmit interrupt flag of UART2.

Returns
Transmit Interrupt Flag Status

Example

This example sends "A" via UART2.

void Example_Function(void)
{
if (UART2_TX_Sts() == (uint8)1u)
{
}
}