MKMxxZxxACxx5 Bare Metal Software Drivers  R4.1.6
Reference Manual
UART API Specification

Overview

This section describes functions and macros of the driver's API.

Macros

#define UART_SetBaudRate(module, brate, clk)
 Set communication baud rate. More...
 
#define UART_TxIsrDisable(module)
 Disables transmitter interrupt or DMA transfer. More...
 
#define UART_TxIsrEnable(module)
 Enables transmitter interrupt or DMA transfer. More...
 
#define UART_TxCmplIsrDisable(module)
 Disables transmission complete interrupt. More...
 
#define UART_TxCmplIsrEnable(module)
 Enables transmission complete interrupt. More...
 
#define UART_RxIsrDisable(module)
 Disables receiver full interrupt or DMA transfer. More...
 
#define UART_RxIsrEnable(module)
 Enables receiver full interrupt or DMA transfer. More...
 
#define UART_EdgIsrEnable(module)
 Enables RxD input active edge interrupt. More...
 
#define UART_EdgIsrClr(module)
 Clears RxD input active edge interrupt flag. More...
 
#define UART_EdgIsrClrEnable(module)
 Clears RxD input active edge interrupt flag and enables RxD input active edge interrupt. More...
 
#define UART_EdgIsrDisable(module)
 Disables RxD input active edge interrupt. More...
 
#define UART_TxIdle(module)
 Reads and returns transmitter state. More...
 
#define UART_RxFull(module)
 Reads and returns receiver state. More...
 
#define UART_GetChar(module)
 Reads and returns received character. More...
 
#define UART_PutChar(module, c)
 Sends character. More...
 
#define UART_PutStr(module, str)
 Sends string. More...
 
#define UART_Rd(module, buffer, count)
 Reads count bytes and stores them in a buffer. More...
 
#define UART_Wr(module, buffer, count)
 Writes count bytes from buffer. More...
 
#define UART_LoopModeCtrl(module, ctrl)
 Enables/disables internal loop mode. More...
 
#define UART_InstallCallback(vector, ip, callback)
 Installs callback function. More...
 
#define UART_Init(module, cfg)
 UART initialization. More...
 

Macro Definition Documentation

#define UART_SetBaudRate (   module,
  brate,
  clk 
)

This macro sets new communication baudrate.

Parameters
moduleUART0,UART1,UART2,UART3.
brateBaud rate.
clkModule clock in Hz:
UART0 UART1 UART2 UART3
Bus clockSystem clockBus clockSystem clock
Note
Implemented as an inline macro.
#define UART_TxIsrDisable (   module)

This macro disables transmitter interrupt or DMA transfer for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_TxIsrEnable, UART_TxCmplIsrDisable, UART_TxCmplIsrEnable
#define UART_TxIsrEnable (   module)

This macro enables transmitter interrupt or DMA transfer for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_TxIsrDisable, UART_TxCmplIsrDisable, UART_TxCmplIsrEnable
#define UART_TxCmplIsrDisable (   module)

This macro disables transmission complete interrupt request for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_TxCmplIsrEnable, UART_TxIsrDisable, UART_TxIsrEnable
#define UART_TxCmplIsrEnable (   module)

This macro enables transmission complete interrupt request for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_TxCmplIsrDisable, UART_TxIsrDisable, UART_TxIsrEnable
#define UART_RxIsrDisable (   module)

This macro disables receiver full interrupt or DMA transfer for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_RxIsrEnable
#define UART_RxIsrEnable (   module)

This macro enables receiver full interrupt or DMA transfer for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_RxIsrDisable
#define UART_EdgIsrEnable (   module)

This macro enables RxD input active edge interrupt for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_EdgIsrDisable, UART_EdgIsrClr, UART_EdgIsrClrEnable
#define UART_EdgIsrClr (   module)

This macro clears RxD input active edge interrupt flag for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_EdgIsrDisable, UART_EdgIsrEnable, UART_EdgIsrClrEnable
#define UART_EdgIsrClrEnable (   module)

This macro clears RxD input active edge interrupt flag and it also enables RxD input active edge interrupt for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_EdgIsrDisable, UART_EdgIsrEnable, UART_EdgIsrClr
#define UART_EdgIsrDisable (   module)

This macro disables RxD input active edge interrupt for specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Note
Implemented as an inline macro.
See also
UART_EdgIsrEnable, UART_EdgIsrClrEnable
#define UART_TxIdle (   module)

This macro returns transmitter state of the specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Returns
true (non-zero) transmitter idle,
false transmitter active.
Note
Implemented as an inline macro.
See also
UART_RxFull
#define UART_RxFull (   module)

This macro returns receiver state of the specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Returns
true (non-zero) character ready,
false receiver busy.
Note
Implemented as an inline macro.
See also
UART_TxIdle
#define UART_GetChar (   module)

This macro reads character received by the specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
Returns
int8 received character.
Note
Implemented as an inline macro.
Warning
Doesn't wait for a new byte (until RDRF is set). Insert while(!UART_RxFull(UART?)); statement prior this macro to ensure new byte is returned.
See also
UART_PutChar, UART_PutStr, UART_Rd, UART_Wr
#define UART_PutChar (   module,
 
)

This macro sends character to the specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
cCharacter.
Note
Implemented as an inline macro.
Warning
Doesn't wait until character is sent. Insert while(!UART_TxIdle(UART?)); statement prior this macro to ensure transmitter is idle and able to send new character.
See also
UART_GetChar, UART_PutStr, UART_Rd, UART_Wr
#define UART_PutStr (   module,
  str 
)

This macro sends string to the specified module.

Parameters
moduleUART0,UART1,UART2,UART3.
strString terminated by null character.
Note
Implemented as an inline macro.
Warning
Doesn't terminate until NULL character is read.
See also
UART_GetChar, UART_PutChar, UART_Rd, UART_Wr
#define UART_Rd (   module,
  buffer,
  count 
)

This macro reads count bytes from specified module and stores them in buffer. Returns when count bytes have been read.

Parameters
moduleUART0,UART1,UART2,UART3.
bufferuint8 [] specifies the variable in which to store the data that was read from the selected module.
countspecifies the number of bytes to read from the selected module.
Note
Implemented as an inline macro.
Warning
Doesn't terminate until count bytes are read.
See also
UART_GetChar, UART_PutChar, UART_PutStr, UART_Wr
#define UART_Wr (   module,
  buffer,
  count 
)

This macro writes count bytes from buffer to the specified module. Returns when count bytes are written.

Parameters
moduleUART0,UART1,UART2,UART3.
bufferuint8 [] specifies the variable from which to read the data that will be written to the selected module.
countspecifies the number of bytes to write to the selected module.
Note
Implemented as an inline macro.
See also
UART_GetChar, UART_PutChar, UART_PutStr, UART_Rd
#define UART_LoopModeCtrl (   module,
  ctrl 
)

This macro enables/disables internal loop mode for the specified module. When loop mode is set, the RxD pin is disconnected from the UART and the transmitter output is internally connected to the receiver input. The transmitter and the receiver must be enabled to use the loop function.

Parameters
moduleUART0,UART1,UART2,UART3.
ctrlTRUE (loopback mode enabled, receiver input is internally connected to transmitter output)
FALSE (normal operation).
Note
Implemented as an inline macro.
#define UART_InstallCallback (   vector,
  ip,
  callback 
)

This function installs callback function for interrupt vectors of the UART modules.

Parameters
vectorUART0_UART1 (vector 35 - OR'ed Interrupt UART0 and UART1)
UART2_UART3 (vector 36 - OR'ed Interrupt UART0 and UART1)
ipSelect one of the ARM Cortex-M0+ Interrupt Priority Levels.
callbackPointer to the UART Callback Function.
Note
Implemented as a function call.
Warning
UART0 and UART1 interrupt sources are OR'ed into single interrupt vector. UART2 and UART3 interrupt sources are OR'ed into single interrupt vector.
See also
UART_Init
#define UART_Init (   module,
  cfg 
)

This function initializes selected UART module.

Parameters
moduleUART0,UART1,UART2,UART3.
cfgSelect one of the UART Configuration Structures.
Note
Implemented as a function call.
See also
UART_InstallCallback