MTB CAT1 Peripheral driver library

General Description

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 *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...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetDataWidth (CySCB_Type const *base)
 Returns the value of datawidth. More...
 
void Cy_SCB_UART_SetDataWidth (CySCB_Type *base, uint32_t dataWidth)
 Sets datawidth for UART transaction. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetParity (CySCB_Type const *base)
 Returns the value of parity. More...
 
void Cy_SCB_UART_SetParity (CySCB_Type *base, cy_en_scb_uart_parity_t parity)
 Sets parity for UART transaction. More...
 
__STATIC_INLINE uint32_t Cy_SCB_UART_GetStopBits (CySCB_Type const *base)
 Returns the value of stop bits. More...
 
void Cy_SCB_UART_SetStopBits (CySCB_Type *base, cy_en_scb_uart_stop_bits_t stopBits)
 Sets stop bits for UART transaction. More...
 
__STATIC_INLINE bool Cy_SCB_UART_GetDropOnParityError (CySCB_Type const *base)
 Returns the value of SetDropOnParityError. More...
 
void Cy_SCB_UART_SetDropOnParityError (CySCB_Type *base, bool dropOnParityError)
 Sets SetDropOnParityError for UART transaction. More...
 
__STATIC_INLINE bool Cy_SCB_UART_GetEnableMsbFirst (CySCB_Type const *base)
 Returns the value of enableMsbFirst. More...
 
void Cy_SCB_UART_SetEnableMsbFirst (CySCB_Type *base, bool enableMsbFirst)
 Sets enableMsbFirst for UART transaction. More...
 

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 *  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 when UART TX FIFO and shifter are empty.

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(SCB5, &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(SCB5, &UART_1_config, &UART_1_context);
/* Set oversample value for UART */
(void) Cy_SCB_UART_SetOverSample(SCB5, OverSample, &UART_1_context);
/* Enable UART to operate */

◆ Cy_SCB_UART_GetDataWidth()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetDataWidth ( CySCB_Type const *  base)

Returns the value of datawidth.

Parameters
baseThe pointer to the UART SCB instance.
Returns
The value of datawidth.
Note
Values of Tx and Rx datawidth are same.
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Get current datawidth value for provided SCB */

◆ Cy_SCB_UART_SetDataWidth()

void Cy_SCB_UART_SetDataWidth ( CySCB_Type base,
uint32_t  dataWidth 
)

Sets datawidth for UART transaction.

Parameters
baseThe pointer to the UART SCB instance.
dataWidthThe width of UART data in the UART transaction.
Note
Ensure that the SCB block is disabled before calling this function.
/* Assign appropriate datawidth value for UART */
uint32_t dataWidth = 8UL;
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Set datawidth value for UART */
(void) Cy_SCB_UART_SetDataWidth(SCB5, dataWidth);
/* Enable UART to operate */

◆ Cy_SCB_UART_GetParity()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetParity ( CySCB_Type const *  base)

Returns the value of parity.

Parameters
baseThe pointer to the UART SCB instance.
Returns
The value of parity.
Note
Values of Tx and Rx parity are same.
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Get current parity value for provided SCB */
(void) Cy_SCB_UART_GetParity(SCB5);

◆ Cy_SCB_UART_SetParity()

void Cy_SCB_UART_SetParity ( CySCB_Type base,
cy_en_scb_uart_parity_t  parity 
)

Sets parity for UART transaction.

Parameters
baseThe pointer to the UART SCB instance.
parityThe UART parity bit in the UART transaction.
Note
Ensure that the SCB block is disabled before calling this function.
/* Assign appropriate parity value for UART */
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Set parity value for UART */
(void) Cy_SCB_UART_SetParity(SCB5, parity);
/* Enable UART to operate */

◆ Cy_SCB_UART_GetStopBits()

__STATIC_INLINE uint32_t Cy_SCB_UART_GetStopBits ( CySCB_Type const *  base)

Returns the value of stop bits.

Parameters
baseThe pointer to the UART SCB instance.
Returns
The value of stop bits.
Note
Values of Tx and Rx stop bits are same.
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Get current stop bits value for provided SCB */

◆ Cy_SCB_UART_SetStopBits()

void Cy_SCB_UART_SetStopBits ( CySCB_Type base,
cy_en_scb_uart_stop_bits_t  stopBits 
)

Sets stop bits for UART transaction.

Parameters
baseThe pointer to the UART SCB instance.
stopBitsThe number of stop bits in the UART transaction.
Note
Ensure that the SCB block is disabled before calling this function.
/* Assign appropriate stop bits value for UART */
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Set stop bits value for UART */
(void) Cy_SCB_UART_SetStopBits(SCB5, stopBits);
/* Enable UART to operate */

◆ Cy_SCB_UART_GetDropOnParityError()

__STATIC_INLINE bool Cy_SCB_UART_GetDropOnParityError ( CySCB_Type const *  base)

Returns the value of SetDropOnParityError.

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

◆ Cy_SCB_UART_SetDropOnParityError()

void Cy_SCB_UART_SetDropOnParityError ( CySCB_Type base,
bool  dropOnParityError 
)

Sets SetDropOnParityError for UART transaction.

Parameters
baseThe pointer to the UART SCB instance.
dropOnParityErrorTo enable the hardware to drop data in the RX FIFO when a parity error is detected in the UART transaction.
Note
Ensure that the SCB block is disabled before calling this function.
/* Assign appropriate SetDropOnParityError value for UART */
bool setDropOnParityError = false;
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Set SetDropOnParityError value for UART */
(void) Cy_SCB_UART_SetDropOnParityError(SCB5, setDropOnParityError);
/* Enable UART to operate */

◆ Cy_SCB_UART_GetEnableMsbFirst()

__STATIC_INLINE bool Cy_SCB_UART_GetEnableMsbFirst ( CySCB_Type const *  base)

Returns the value of enableMsbFirst.

Parameters
baseThe pointer to the UART SCB instance.
Returns
The value of enableMsbFirst.
Note
Values of Tx and Rx enableMsbFirst are same.
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Get current enableMsbFirst value for provided SCB */

◆ Cy_SCB_UART_SetEnableMsbFirst()

void Cy_SCB_UART_SetEnableMsbFirst ( CySCB_Type base,
bool  enableMsbFirst 
)

Sets enableMsbFirst for UART transaction.

Parameters
baseThe pointer to the UART SCB instance.
enableMsbFirstEnables the hardware to shift out data element MSB first; otherwise, LSB first in the UART transaction.
Note
Ensure that the SCB block is disabled before calling this function.
/* Assign appropriate enableMsbFirst value for UART */
bool enableMsbFirst = false;
/* Initialize SCB for UART operation */
(void) Cy_SCB_UART_Init(SCB5, &UART_1_config, &UART_1_context);
/* Set enableMsbFirst value for UART */
(void) Cy_SCB_UART_SetEnableMsbFirst(SCB5, enableMsbFirst);
/* Enable UART to operate */