The Uart Tx module provides a way to transmit byte sequences over the SSP interface using the UART protocol. This module will hide all details of the SPI driver: it will initialize and configure the driver. The user of the Uart module only needs to use the API functions below to have tracing functionality over a UART interface.
- Diversity
- This module supports diversity, to ease the transmission of data according to each application's needs. Check Diversity settings for all diversity parameters.
- Setup
- Connect the MOSI pin (PIO9) to the RX pin of e.g. an FTDI FT232R.
- Note
- The unused SSP pins (PIOs 2, 6 and 8) can still be used as GPIO for other purposes
- Warning
- When this module is in use, it is not possible to directly access the SPI driver for either transmission or reception. Doing so can result in communication errors or even a hard fault.
- Example 1
◆ NUL
The string demarcation character.
◆ UartTx_Init()
void UartTx_Init |
( |
void |
| ) |
|
Initializes the module.
- Precondition
- This is the module's first function to be called after startup or after UartTx_DeInit has been called.
-
The IOCON driver must have been initialized beforehand. This is already taken care of by the board library initialization function Board_Init.
-
The PIO9 pin is configured for the SSP MOSI functional mode (FUNC_1) using Chip_IOCON_SetPinConfig.
- See also
- Chip_IOCON_Init
◆ UartTx_DeInit()
void UartTx_DeInit |
( |
void |
| ) |
|
De-initializes the module.
- De-initializes the SSP driver
- Configures PIO9 - MOSI - as GPIO with a pull-up or -down, according to BOARD_PIO9_PULL
◆ UartTx_Tx()
void UartTx_Tx |
( |
const uint8_t * |
pData, |
|
|
unsigned int |
length |
|
) |
| |
Transmits the given data over the MOSI line, mimicking the UART protocol. This call is blocking until all data has been sent.
- Parameters
-
pData | : Must point to a contiguous linear array containing the bytes to transmit. |
length | : The number of bytes to transmit. |
- See also
- MODS_NSS_UART_DFT
◆ UartTx_PrintString()
void UartTx_PrintString |
( |
const char * |
s | ) |
|
Convenience function to print a string. Internally, UartTx_Tx is used. This call is blocking until all data has been sent.
- Parameters
-
s | : A NUL-terminated string to print. |
- See also
- PRINTS
◆ UartTx_PrintDec()
void UartTx_PrintDec |
( |
int |
n, |
|
|
char |
end |
|
) |
| |
Convenience function to print a number in decimal format. Internally, UartTx_PrintString is used. Right after the number, the end
character is printed out. This call is blocking until all data has been sent.
- Parameters
-
n | : A signed integer to print. |
end | : The character to print after the number. May be NUL , in which case nothing is printed out after the number. |
- See also
- PRINTD
◆ UartTx_PrintHex()
void UartTx_PrintHex |
( |
unsigned int |
n, |
|
|
char |
end |
|
) |
| |
Convenience function to print a number in hexadecimal format. No prefix (like 0x) or suffix (like h) is printed. Right after the number, the end
character is printed out. Internally, UartTx_PrintString is used. This call is blocking until all data has been sent.
- Parameters
-
n | : An unsigned integer to print. |
end | : The character to print after the number. May be NUL , in which case nothing is printed out after the number. |
- See also
- PRINTH
◆ UartTx_Printf()
void UartTx_Printf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Convenience function to print a string and a variable amount of arguments, replacing the % placeholders. Internally, UartTx_Tx is used.
- Note
- This function does not require the inclusion of an extra library.
-
Only a subset of the full standard
printf
functionality is supported. All formatting options are skipped, and only s
, d
and X
are implemented. x
is aliased to X
. This call is blocking until all data has been sent.
- Parameters
-
fmt | : The unformatted NUL-terminated string to format and to print. |
- See also
- PRINTF