CAT2 Peripheral Driver Library

Functions

__STATIC_INLINE uint32_t Cy_SCB_UART_Put (CySCB_Type *base, uint32_t data)
 Places a single data element in the UART TX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_PutArray (CySCB_Type *base, void const *buffer, uint32_t size)
 Places an array of data in the UART TX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_UART_PutArrayBlocking (CySCB_Type *base, void *buffer, uint32_t size)
 Places an array of data in the UART TX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_UART_PutString (CySCB_Type *base, char_t const string[])
 Places a NULL terminated string in the UART TX FIFO. More...
 
void Cy_SCB_UART_SendBreakBlocking (CySCB_Type *base, uint32_t breakWidth)
 Sends a break condition (logic low) of specified width on UART TX line. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_Get (CySCB_Type const *base)
 Reads a single data element from the UART RX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetArray (CySCB_Type const *base, void *buffer, uint32_t size)
 Reads an array of data out of the UART RX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_UART_GetArrayBlocking (CySCB_Type const *base, void *buffer, uint32_t size)
 Reads an array of data out of the UART RX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetTxFifoStatus (CySCB_Type const *base)
 Returns the current status of the TX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_UART_ClearTxFifoStatus (CySCB_Type *base, uint32_t clearMask)
 Clears the selected statuses of the TX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetRxFifoStatus (CySCB_Type const *base)
 Returns the current status of the RX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_UART_ClearRxFifoStatus (CySCB_Type *base, uint32_t clearMask)
 Clears the selected statuses of the RX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInTxFifo (CySCB_Type const *base)
 Returns the number of data elements in the UART TX FIFO. More...
 
__STATIC_INLINE bool Cy_SCB_UART_IsTxComplete (CySCB_Type const *base)
 Checks whether the TX FIFO and Shifter are empty and there is no more data to send. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInRxFifo (CySCB_Type const *base)
 Returns the number of data elements in the UART RX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_UART_ClearRxFifo (CySCB_Type *base)
 Clears all data out of the UART RX FIFO. More...
 
__STATIC_INLINE void Cy_SCB_UART_ClearTxFifo (CySCB_Type *base)
 Clears all data out of the UART TX FIFO. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetOverSample (CySCB_Type const *base)
 Returns the value of oversample. More...
 
cy_en_scb_uart_status_t Cy_SCB_UART_SetOverSample (CySCB_Type *base, uint32_t overSample, cy_stc_scb_uart_context_t *context)
 Sets oversample bits of UART. More...
 

Detailed Description

Function Documentation

◆ Cy_SCB_UART_Put()

__STATIC_INLINE uint32_t Cy_SCB_UART_Put ( CySCB_Type base,
uint32_t  data 
)

Places a single data element in the UART TX FIFO.

This function does not block and returns how many data elements were placed in the TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
dataData to put in the TX FIFO. The element size is defined by the data type, which depends on the configured data width.
Returns
The number of data elements placed in the TX FIFO: 0 or 1.

◆ Cy_SCB_UART_PutArray()

__STATIC_INLINE uint32_t Cy_SCB_UART_PutArray ( CySCB_Type base,
void const *  buffer,
uint32_t  size 
)

Places an array of data in the UART TX FIFO.

This function does not block. It returns how many data elements were placed in the TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
bufferThe pointer to data to place in the TX FIFO. The element size is defined by the data type, which depends on the configured TX data width.
sizeThe number of data elements to TX.
Returns
The number of data elements placed in the TX FIFO.

◆ Cy_SCB_UART_PutArrayBlocking()

__STATIC_INLINE void Cy_SCB_UART_PutArrayBlocking ( CySCB_Type base,
void *  buffer,
uint32_t  size 
)

Places an array of data in the UART TX FIFO.

This function blocks until the number of data elements specified by the size is placed in the TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
bufferThe pointer to data to place in the TX FIFO. The element size is defined by the data type, which depends on the configured data width.
sizeThe number of data elements to write into the TX FIFO.

◆ Cy_SCB_UART_PutString()

__STATIC_INLINE void Cy_SCB_UART_PutString ( CySCB_Type base,
char_t const  string[] 
)

Places a NULL terminated string in the UART TX FIFO.

This function blocks until the entire string is placed in the TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
stringThe pointer to the null terminated string array.

◆ Cy_SCB_UART_SendBreakBlocking()

void Cy_SCB_UART_SendBreakBlocking ( CySCB_Type base,
uint32_t  breakWidth 
)

Sends a break condition (logic low) of specified width on UART TX line.

Blocks until break is completed. Only call this function if previous transfer is complete: UART TX FIFO and shifter are empty and CY_SCB_TX_INTR_UART_DONE interrupt was trigger.

Parameters
baseThe pointer to the UART SCB instance.
breakWidthWidth of break condition. Valid range is the TX data width (4 to 16 bits)
Note
Before sending break all UART TX interrupt sources are disabled. The state of UART TX interrupt sources is restored before function returns.
Side Effects
If this function is called while there is data in the TX FIFO or shifter that data will be shifted out in packets the size of breakWidth.

◆ Cy_SCB_UART_Get()

__STATIC_INLINE uint32_t Cy_SCB_UART_Get ( CySCB_Type const *  base)

Reads a single data element from the UART RX FIFO.

This function does not check whether the RX FIFO has data before reading it. If the RX FIFO is empty, the function returns CY_SCB_UART_RX_NO_DATA.

Parameters
baseThe pointer to the UART SCB instance.
Returns
Data from the RX FIFO. The data element size is defined by the configured data width.

◆ Cy_SCB_UART_GetArray()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetArray ( CySCB_Type const *  base,
void *  buffer,
uint32_t  size 
)

Reads an array of data out of the UART RX FIFO.

This function does not block. It returns how many data elements were read from the RX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
bufferThe pointer to the location to place the data read from the RX FIFO. The element size is defined by the data type, which depends on the configured data width.
sizeThe number of data elements to read from the RX FIFO.
Returns
The number of data elements read from the RX FIFO.

◆ Cy_SCB_UART_GetArrayBlocking()

__STATIC_INLINE void Cy_SCB_UART_GetArrayBlocking ( CySCB_Type const *  base,
void *  buffer,
uint32_t  size 
)

Reads an array of data out of the UART RX FIFO.

This function blocks until the number of data elements specified by the size has been read from the RX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
bufferThe pointer to the location to place the data read from the RX FIFO. The element size is defined by the data type, which depends on the configured data width.
sizeThe number of data elements to read from the RX FIFO.

◆ Cy_SCB_UART_GetTxFifoStatus()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetTxFifoStatus ( CySCB_Type const *  base)

Returns the current status of the TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
Returns
UART TX FIFO Statuses

◆ Cy_SCB_UART_ClearTxFifoStatus()

__STATIC_INLINE void Cy_SCB_UART_ClearTxFifoStatus ( CySCB_Type base,
uint32_t  clearMask 
)

Clears the selected statuses of the TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
clearMaskThe mask whose statuses to clear. See UART TX FIFO Statuses for the set of constants.
Note

◆ Cy_SCB_UART_GetRxFifoStatus()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetRxFifoStatus ( CySCB_Type const *  base)

Returns the current status of the RX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
Returns
UART RX FIFO status.

◆ Cy_SCB_UART_ClearRxFifoStatus()

__STATIC_INLINE void Cy_SCB_UART_ClearRxFifoStatus ( CySCB_Type base,
uint32_t  clearMask 
)

Clears the selected statuses of the RX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
clearMaskThe mask whose statuses to clear. See UART RX FIFO status. for the set of constants.
Note

◆ Cy_SCB_UART_GetNumInTxFifo()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInTxFifo ( CySCB_Type const *  base)

Returns the number of data elements in the UART TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
Returns
The number of data elements in the TX FIFO. The size of date element defined by the configured data width.
Note
This number does not include any data currently in the TX shifter.

◆ Cy_SCB_UART_IsTxComplete()

__STATIC_INLINE bool Cy_SCB_UART_IsTxComplete ( CySCB_Type const *  base)

Checks whether the TX FIFO and Shifter are empty and there is no more data to send.

Parameters
basePointer to the UART SCB instance.
Returns
If true, transmission complete. If false, transmission is not complete.

◆ Cy_SCB_UART_GetNumInRxFifo()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetNumInRxFifo ( CySCB_Type const *  base)

Returns the number of data elements in the UART RX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
Returns
The number of data elements in the RX FIFO. The size of date element defined by the configured data width.

◆ Cy_SCB_UART_ClearRxFifo()

__STATIC_INLINE void Cy_SCB_UART_ClearRxFifo ( CySCB_Type base)

Clears all data out of the UART RX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
Side Effects
Any data currently in the shifter is cleared and lost.

◆ Cy_SCB_UART_ClearTxFifo()

__STATIC_INLINE void Cy_SCB_UART_ClearTxFifo ( CySCB_Type base)

Clears all data out of the UART TX FIFO.

Parameters
baseThe pointer to the UART SCB instance.
Side Effects
The TX FIFO clear operation also clears the shift register, so that the shifter could be cleared in the middle of a data element transfer, corrupting it. The data element corruption means that all bits that have not been transmitted are transmitted as 1s on the bus.

◆ Cy_SCB_UART_GetOverSample()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetOverSample ( CySCB_Type const *  base)

Returns the value of oversample.

Parameters
baseThe pointer to the UART SCB instance.
Returns
The value of oversample.
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB1, &UART_1_config, &UART_1_context);
/* Get current oversample value for provided SCB */

◆ Cy_SCB_UART_SetOverSample()

cy_en_scb_uart_status_t Cy_SCB_UART_SetOverSample ( CySCB_Type base,
uint32_t  overSample,
cy_stc_scb_uart_context_t context 
)

Sets oversample bits of UART.

Parameters
baseThe pointer to the UART SCB instance.
overSampleValue of oversample to be set.
contextThe pointer to the context structure cy_stc_scb_uart_context_t allocated by the user. The structure is used during the UART operation for internal configuration and data retention. The user must not modify anything in this structure. User should not pass NULL as pointer to context.
Returns
cy_en_scb_uart_status_t
Note
Ensure that the SCB block is disabled before calling this function.
/* Assign appropriate oversample value for UART */
uint32_t OverSample = 8UL;
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB1, &UART_1_config, &UART_1_context);
/* Set oversample value for UART */
(void) Cy_SCB_UART_SetOverSample(SCB1, OverSample, &UART_1_context);
/* Enable UART to operate */