Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

This section describes the programming interface of the LPUART HAL driver.

Data Structures

struct  lpuart_idle_line_config_t
 Structure for idle line configuration settings. More...
 

Enumerations

enum  lpuart_status_t
 Error codes for the LPUART driver. More...
 
enum  lpuart_stop_bit_count_t {
  kLpuartOneStopBit = 0x0U,
  kLpuartTwoStopBit = 0x1U
}
 LPUART number of stop bits. More...
 
enum  lpuart_parity_mode_t {
  kLpuartParityDisabled = 0x0U,
  kLpuartParityEven = 0x2U,
  kLpuartParityOdd = 0x3U
}
 LPUART parity mode. More...
 
enum  lpuart_bit_count_per_char_t {
  kLpuart8BitsPerChar = 0x0U,
  kLpuart9BitsPerChar = 0x1U,
  kLpuart10BitsPerChar = 0x2U
}
 LPUART number of bits in a character. More...
 
enum  lpuart_operation_config_t {
  kLpuartOperates = 0x0U,
  kLpuartStops = 0x1U
}
 LPUART operation configuration constants. More...
 
enum  lpuart_wakeup_method_t {
  kLpuartIdleLineWake = 0x0U,
  kLpuartAddrMarkWake = 0x1U
}
 LPUART wakeup from standby method constants. More...
 
enum  lpuart_idle_line_select_t {
  kLpuartIdleLineAfterStartBit = 0x0U,
  kLpuartIdleLineAfterStopBit = 0x1U
}
 LPUART idle line detect selection types. More...
 
enum  lpuart_break_char_length_t {
  kLpuartBreakChar10BitMinimum = 0x0U,
  kLpuartBreakChar13BitMinimum = 0x1U
}
 LPUART break character length settings for transmit/detect. More...
 
enum  lpuart_singlewire_txdir_t {
  kLpuartSinglewireTxdirIn = 0x0U,
  kLpuartSinglewireTxdirOut = 0x1U
}
 LPUART single-wire mode TX direction. More...
 
enum  lpuart_match_config_t {
  kLpuartAddressMatchWakeup = 0x0U,
  kLpuartIdleMatchWakeup = 0x1U,
  kLpuartMatchOnAndMatchOff = 0x2U,
  kLpuartEnablesRwuOnDataMatch = 0x3U
}
 LPUART Configures the match addressing mode used. More...
 
enum  lpuart_ir_tx_pulsewidth_t {
  kLpuartIrThreeSixteenthsWidth = 0x0U,
  kLpuartIrOneSixteenthWidth = 0x1U,
  kLpuartIrOneThirtysecondsWidth = 0x2U,
  kLpuartIrOneFourthWidth = 0x3U
}
 LPUART infra-red transmitter pulse width options. More...
 
enum  lpuart_idle_char_t {
  kLpuart_1_IdleChar = 0x0U,
  kLpuart_2_IdleChar = 0x1U,
  kLpuart_4_IdleChar = 0x2U,
  kLpuart_8_IdleChar = 0x3U,
  kLpuart_16_IdleChar = 0x4U,
  kLpuart_32_IdleChar = 0x5U,
  kLpuart_64_IdleChar = 0x6U,
  kLpuart_128_IdleChar = 0x7U
}
 LPUART Configures the number of idle characters that must be received before the IDLE flag is set. More...
 
enum  lpuart_cts_source_t {
  kLpuartCtsSourcePin = 0x0U,
  kLpuartCtsSourceInvertedReceiverMatch = 0x1U
}
 LPUART Transmits the CTS Configuration. More...
 
enum  lpuart_cts_config_t {
  kLpuartCtsSampledOnEachChar = 0x0U,
  kLpuartCtsSampledOnIdle = 0x1U
}
 LPUART Transmits CTS Source.Configures if the CTS state is checked at the start of each character or only when the transmitter is idle. More...
 
enum  lpuart_rx_idle_empty_config_t {
  kLpuartRxidDisabled = 0x0U,
  kLpuartRxidEnabledFor1Char = 0x1U,
  kLpuartRxidEnabledFor2Char = 0x2U,
  kLpuartRxidEnabledFor4Char = 0x3U,
  kLpuartRxidEnabledFor8Char = 0x4U,
  kLpuartRxidEnabledFor16Char = 0x5U,
  kLpuartRxidEnabledFor32Char = 0x6U,
  kLpuartRxidEnabledFor64Char = 0x7U
}
 LPUART Receiver Idle Empty Enable constants. More...
 
enum  lpuart_status_flag_t {
  kLpuartTxDataRegEmpty = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_TDRE_SHIFT,
  kLpuartTxComplete = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_TC_SHIFT,
  kLpuartRxDataRegFull = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_RDRF_SHIFT,
  kLpuartIdleLineDetect = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_IDLE_SHIFT,
  kLpuartRxOverrun = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_OR_SHIFT,
  kLpuartNoiseDetect = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_NF_SHIFT,
  kLpuartFrameErr = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_FE_SHIFT,
  kLpuartParityErr = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_PF_SHIFT,
  kLpuartLineBreakDetect = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_LBKDE_SHIFT,
  kLpuartRxActiveEdgeDetect = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_RXEDGIF_SHIFT,
  kLpuartRxActive = LPUART_STAT_REG_ID << LPUART_SHIFT | LPUART_STAT_RAF_SHIFT,
  kLpuartNoiseInCurrentWord = LPUART_DATA_REG_ID << LPUART_SHIFT | LPUART_DATA_NOISY_SHIFT,
  kLpuartParityErrInCurrentWord = LPUART_DATA_REG_ID << LPUART_SHIFT | LPUART_DATA_PARITYE_SHIFT
}
 LPUART status flags. More...
 
enum  lpuart_interrupt_t {
  kLpuartIntLinBreakDetect = LPUART_BAUD_REG_ID << LPUART_SHIFT | LPUART_BAUD_LBKDIE_SHIFT,
  kLpuartIntRxActiveEdge = LPUART_BAUD_REG_ID << LPUART_SHIFT | LPUART_BAUD_RXEDGIE_SHIFT,
  kLpuartIntTxDataRegEmpty = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_TIE_SHIFT,
  kLpuartIntTxComplete = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_TCIE_SHIFT,
  kLpuartIntRxDataRegFull = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_RIE_SHIFT,
  kLpuartIntIdleLine = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_ILIE_SHIFT,
  kLpuartIntRxOverrun = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_ORIE_SHIFT,
  kLpuartIntNoiseErrFlag = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_NEIE_SHIFT,
  kLpuartIntFrameErrFlag = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_FEIE_SHIFT,
  kLpuartIntParityErrFlag = LPUART_CTRL_REG_ID << LPUART_SHIFT | LPUART_CTRL_PEIE_SHIFT
}
 LPUART interrupt configuration structure, default settings are 0 (disabled) More...
 

LPUART Common Configurations

void LPUART_HAL_Init (LPUART_Type *base)
 Initializes the LPUART controller to known state. More...
 
static void LPUART_HAL_SetTransmitterCmd (LPUART_Type *base, bool enable)
 Enables/disables the LPUART transmitter. More...
 
static bool LPUART_HAL_GetTransmitterCmd (LPUART_Type *base)
 Gets the LPUART transmitter enabled/disabled configuration. More...
 
static void LPUART_HAL_SetReceiverCmd (LPUART_Type *base, bool enable)
 Enables/disables the LPUART receiver. More...
 
static bool LPUART_HAL_GetReceiverCmd (LPUART_Type *base)
 Gets the LPUART receiver enabled/disabled configuration. More...
 
lpuart_status_t LPUART_HAL_SetBaudRate (LPUART_Type *base, uint32_t sourceClockInHz, uint32_t desiredBaudRate)
 Configures the LPUART baud rate. More...
 
static void LPUART_HAL_SetBaudRateDivisor (LPUART_Type *base, uint32_t baudRateDivisor)
 Sets the LPUART baud rate modulo divisor. More...
 
void LPUART_HAL_SetBitCountPerChar (LPUART_Type *base, lpuart_bit_count_per_char_t bitCountPerChar)
 Configures the number of bits per character in the LPUART controller. More...
 
void LPUART_HAL_SetParityMode (LPUART_Type *base, lpuart_parity_mode_t parityModeType)
 Configures parity mode in the LPUART controller. More...
 
static void LPUART_HAL_SetStopBitCount (LPUART_Type *base, lpuart_stop_bit_count_t stopBitCount)
 Configures the number of stop bits in the LPUART controller. More...
 
static uint32_t LPUART_HAL_GetDataRegAddr (LPUART_Type *base)
 Gets the LPUART transmit/receive data register address. More...
 

LPUART Interrupts and DMA

void LPUART_HAL_SetIntMode (LPUART_Type *base, lpuart_interrupt_t interrupt, bool enable)
 Configures the LPUART module interrupts to enable/disable various interrupt sources. More...
 
bool LPUART_HAL_GetIntMode (LPUART_Type *base, lpuart_interrupt_t interrupt)
 Returns whether the LPUART module interrupts is enabled/disabled. More...
 

LPUART Transfer Functions

static void LPUART_HAL_Putchar (LPUART_Type *base, uint8_t data)
 Sends the LPUART 8-bit character. More...
 
void LPUART_HAL_Putchar9 (LPUART_Type *base, uint16_t data)
 Sends the LPUART 9-bit character. More...
 
lpuart_status_t LPUART_HAL_Putchar10 (LPUART_Type *base, uint16_t data)
 Sends the LPUART 10-bit character. More...
 
static void LPUART_HAL_Getchar (LPUART_Type *base, uint8_t *readData)
 Gets the LPUART 8-bit character. More...
 
void LPUART_HAL_Getchar9 (LPUART_Type *base, uint16_t *readData)
 Gets the LPUART 9-bit character. More...
 
void LPUART_HAL_Getchar10 (LPUART_Type *base, uint16_t *readData)
 Gets the LPUART 10-bit character. More...
 
void LPUART_HAL_SendDataPolling (LPUART_Type *base, const uint8_t *txBuff, uint32_t txSize)
 Sends out multiple bytes of data using the polling method. More...
 
lpuart_status_t LPUART_HAL_ReceiveDataPolling (LPUART_Type *base, uint8_t *rxBuff, uint32_t rxSize)
 Receives multiple bytes of data using the polling method. More...
 

LPUART Status Flags

bool LPUART_HAL_GetStatusFlag (LPUART_Type *base, lpuart_status_flag_t statusFlag)
 LPUART get status flag. More...
 
lpuart_status_t LPUART_HAL_ClearStatusFlag (LPUART_Type *base, lpuart_status_flag_t statusFlag)
 LPUART clears an individual status flag (see lpuart_status_flag_t for list of status bits). More...
 

LPUART Special Feature Configurations

static void LPUART_HAL_SetIdleChar (LPUART_Type *base, lpuart_idle_char_t idleConfig)
 Configures the number of idle characters that must be received before the IDLE flag is set. More...
 
static lpuart_idle_char_t LPUART_HAL_GetIdleChar (LPUART_Type *base)
 Gets the configuration of the number of idle characters that must be received before the IDLE flag is set. More...
 
static bool LPUART_HAL_IsCurrentDataWithNoise (LPUART_Type *base)
 Checks whether the current data word was received with noise. More...
 
static bool LPUART_HAL_IsCurrentDataWithFrameError (LPUART_Type *base)
 Checks whether the current data word was received with frame error. More...
 
static void LPUART_HAL_SetTxSpecialChar (LPUART_Type *base, uint8_t specialChar)
 Indicates a break or that the idle character is to be transmitted instead of the contents in DATA[T9:T0]. More...
 
static bool LPUART_HAL_IsCurrentDataWithParityError (LPUART_Type *base)
 Checks whether the current data word was received with parity error. More...
 
static bool LPUART_HAL_IsReceiveBufferEmpty (LPUART_Type *base)
 Checks whether the receive buffer is empty. More...
 
static bool LPUART_HAL_WasPreviousReceiverStateIdle (LPUART_Type *base)
 Checks whether the previous BUS state was idle before this byte is received. More...
 
static void LPUART_HAL_SetWaitModeOperation (LPUART_Type *base, lpuart_operation_config_t mode)
 Configures the LPUART operation in wait mode (operates or stops operations in wait mode). More...
 
static lpuart_operation_config_t LPUART_HAL_GetWaitModeOperation (LPUART_Type *base)
 Gets the LPUART operation in wait mode (operates or stops operations in wait mode). More...
 
void LPUART_HAL_SetLoopbackCmd (LPUART_Type *base, bool enable)
 Configures the LPUART loopback operation (enables/disables the loopback operation). More...
 
void LPUART_HAL_SetSingleWireCmd (LPUART_Type *base, bool enable)
 Configures the LPUART single-wire operation (enables/disables the single-wire mode). More...
 
static void LPUART_HAL_SetTxdirInSinglewireMode (LPUART_Type *base, lpuart_singlewire_txdir_t direction)
 Configures the LPUART transmit direction while in single-wire mode. More...
 
lpuart_status_t LPUART_HAL_SetReceiverInStandbyMode (LPUART_Type *base)
 Places the LPUART receiver in standby mode. More...
 
static void LPUART_HAL_PutReceiverInNormalMode (LPUART_Type *base)
 Places the LPUART receiver in a normal mode (disable standby mode operation). More...
 
static bool LPUART_HAL_IsReceiverInStandby (LPUART_Type *base)
 Checks whether the LPUART receiver is in a standby mode. More...
 
static void LPUART_HAL_SetReceiverWakeupMode (LPUART_Type *base, lpuart_wakeup_method_t method)
 LPUART receiver wakeup method (idle line or addr-mark) from standby mode. More...
 
static lpuart_wakeup_method_t LPUART_HAL_GetReceiverWakeupMode (LPUART_Type *base)
 Gets the LPUART receiver wakeup method (idle line or addr-mark) from standby mode. More...
 
void LPUART_HAL_SetIdleLineDetect (LPUART_Type *base, const lpuart_idle_line_config_t *config)
 LPUART idle-line detect operation configuration (idle line bit-count start and wake up affect on IDLE status bit). More...
 
static void LPUART_HAL_SetBreakCharTransmitLength (LPUART_Type *base, lpuart_break_char_length_t length)
 LPUART break character transmit length configuration. More...
 
static void LPUART_HAL_SetBreakCharDetectLength (LPUART_Type *base, lpuart_break_char_length_t length)
 LPUART break character detect length configuration. More...
 
static void LPUART_HAL_QueueBreakCharToSend (LPUART_Type *base, bool enable)
 LPUART transmit sends break character configuration. More...
 
static void LPUART_HAL_SetMatchAddressMode (LPUART_Type *base, lpuart_match_config_t config)
 LPUART configures match address mode control. More...
 
void LPUART_HAL_SetMatchAddressReg1 (LPUART_Type *base, bool enable, uint8_t value)
 Configures address match register 1. More...
 
void LPUART_HAL_SetMatchAddressReg2 (LPUART_Type *base, bool enable, uint8_t value)
 Configures address match register 2. More...
 
static void LPUART_HAL_SetSendMsbFirstCmd (LPUART_Type *base, bool enable)
 LPUART sends the MSB first configuration. More...
 
static void LPUART_HAL_SetReceiveResyncCmd (LPUART_Type *base, bool enable)
 LPUART enable/disable re-sync of received data configuration. More...
 

Data Structure Documentation

struct lpuart_idle_line_config_t

Data Fields

unsigned idleLineType: 1
 ILT, Idle bit count start: 0 - after start bit (default), 1 - after stop bit.
 
unsigned rxWakeIdleDetect: 1
 RWUID, Receiver Wake Up Idle Detect. More...
 

Field Documentation

unsigned lpuart_idle_line_config_t::rxWakeIdleDetect

IDLE status bit operation during receive standbyControls whether idle character that wakes up receiver will also set IDLE status bit 0 - IDLE status bit doesn't get set (default), 1 - IDLE status bit gets set

Enumeration Type Documentation

Enumerator
kLpuartOneStopBit 

one stop bit

kLpuartTwoStopBit 

two stop bits

Enumerator
kLpuartParityDisabled 

parity disabled

kLpuartParityEven 

parity enabled, type even, bit setting: PE|PT = 10

kLpuartParityOdd 

parity enabled, type odd, bit setting: PE|PT = 11

Enumerator
kLpuart8BitsPerChar 

8-bit data characters

kLpuart9BitsPerChar 

9-bit data characters

kLpuart10BitsPerChar 

10-bit data characters

Enumerator
kLpuartOperates 

LPUART continues to operate normally.

kLpuartStops 

LPUART stops operation.

Enumerator
kLpuartIdleLineWake 

Idle-line wakes the LPUART receiver from standby.

kLpuartAddrMarkWake 

Addr-mark wakes LPUART receiver from standby.

Enumerator
kLpuartIdleLineAfterStartBit 

LPUART idle character bit count start after start bit.

kLpuartIdleLineAfterStopBit 

LPUART idle character bit count start after stop bit.

The actual maximum bit times may vary depending on the LPUART instance.

Enumerator
kLpuartBreakChar10BitMinimum 

LPUART break char length 10 bit times (if M = 0, SBNS = 0) or 11 (if M = 1, SBNS = 0 or M = 0, SBNS = 1) or 12 (if M = 1, SBNS = 1 or M10 = 1, SNBS = 0) or 13 (if M10 = 1, SNBS = 1)

kLpuartBreakChar13BitMinimum 

LPUART break char length 13 bit times (if M = 0, SBNS = 0 or M10 = 0, SBNS = 1) or 14 (if M = 1, SBNS = 0 or M = 1, SBNS = 1) or 15 (if M10 = 1, SBNS = 1 or M10 = 1, SNBS = 0)

Enumerator
kLpuartSinglewireTxdirIn 

LPUART Single Wire mode TXDIR input.

kLpuartSinglewireTxdirOut 

LPUART Single Wire mode TXDIR output.

Enumerator
kLpuartAddressMatchWakeup 

Address Match Wakeup.

kLpuartIdleMatchWakeup 

Idle Match Wakeup.

kLpuartMatchOnAndMatchOff 

Match On and Match Off.

kLpuartEnablesRwuOnDataMatch 

Enables RWU on Data Match and Match On/Off for transmitter CTS input.

Enumerator
kLpuartIrThreeSixteenthsWidth 

3/16 pulse

kLpuartIrOneSixteenthWidth 

1/16 pulse

kLpuartIrOneThirtysecondsWidth 

1/32 pulse

kLpuartIrOneFourthWidth 

1/4 pulse

Enumerator
kLpuart_1_IdleChar 

1 idle character

kLpuart_2_IdleChar 

2 idle character

kLpuart_4_IdleChar 

4 idle character

kLpuart_8_IdleChar 

8 idle character

kLpuart_16_IdleChar 

16 idle character

kLpuart_32_IdleChar 

32 idle character

kLpuart_64_IdleChar 

64 idle character

kLpuart_128_IdleChar 

128 idle character

Configures the source of the CTS input.

Enumerator
kLpuartCtsSourcePin 

CTS input is the LPUART_CTS pin.

kLpuartCtsSourceInvertedReceiverMatch 

CTS input is the inverted Receiver Match result.

Enumerator
kLpuartCtsSampledOnEachChar 

CTS input is sampled at the start of each character.

kLpuartCtsSampledOnIdle 

CTS input is sampled when the transmitter is idle.

Enumerator
kLpuartRxidDisabled 

Disable RDRF assertion due to partially filled FIFO when receiver is idle.

kLpuartRxidEnabledFor1Char 

Enable RDRF assertion due to partially filled FIFO when receiver is idle for 1 character.

kLpuartRxidEnabledFor2Char 

Enable RDRF assertion due to partially filled FIFO when receiver is idle for 2 characters.

kLpuartRxidEnabledFor4Char 

Enable RDRF assertion due to partially filled FIFO when receiver is idle for 4 characters.

kLpuartRxidEnabledFor8Char 

Enable RDRF assertion due to partially filled FIFO when receiver is idle for 8 characters.

kLpuartRxidEnabledFor16Char 

Enable RDRF assertion due to partially filled FIFO when receiver is idle for 16 characters.

kLpuartRxidEnabledFor32Char 

Enable RDRF assertion due to partially filled FIFO when receiver is idle for 32 characters.

kLpuartRxidEnabledFor64Char 

Enable RDRF assertion due to partially filled FIFO when receiver is idle for 64 characters.

This provides constants for the LPUART status flags for use in the UART functions.

Enumerator
kLpuartTxDataRegEmpty 

Transmit data register empty flag, sets when transmit buffer is empty.

kLpuartTxComplete 

Transmission complete flag, sets when transmission activity complete.

kLpuartRxDataRegFull 

Receive data register full flag, sets when the receive data buffer is full.

kLpuartIdleLineDetect 

Idle line detect flag, sets when idle line detected.

kLpuartRxOverrun 

Receive Overrun, sets when new data is received before data is read from receive register.

kLpuartNoiseDetect 

Receive takes 3 samples of each received bit.

If any of these samples differ, noise flag sets

kLpuartFrameErr 

Frame error flag, sets if logic 0 was detected where stop bit expected.

kLpuartParityErr 

If parity enabled, sets upon parity error detection.

kLpuartLineBreakDetect 

LIN break detect interrupt flag, sets when LIN break char detected and LIN circuit enabled.

kLpuartRxActiveEdgeDetect 

Receive pin active edge interrupt flag, sets when active edge detected.

kLpuartRxActive 

Receiver Active Flag (RAF), sets at beginning of valid start bit.

kLpuartNoiseInCurrentWord 

NOISY bit, sets if noise detected in current data word.

kLpuartParityErrInCurrentWord 

PARITYE bit, sets if noise detected in current data word.

Enumerator
kLpuartIntLinBreakDetect 

LIN break detect.

kLpuartIntRxActiveEdge 

Receive Active Edge.

kLpuartIntTxDataRegEmpty 

Transmit data register empty.

kLpuartIntTxComplete 

Transmission complete.

kLpuartIntRxDataRegFull 

Receiver data register full.

kLpuartIntIdleLine 

Idle line.

kLpuartIntRxOverrun 

Receiver Overrun.

kLpuartIntNoiseErrFlag 

Noise error flag.

kLpuartIntFrameErrFlag 

Framing error flag.

kLpuartIntParityErrFlag 

Parity error flag.

Function Documentation

void LPUART_HAL_Init ( LPUART_Type *  base)
Parameters
baseLPUART base pointer.
static void LPUART_HAL_SetTransmitterCmd ( LPUART_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseLPUART base pointer.
enableEnable(true) or disable(false) transmitter.
static bool LPUART_HAL_GetTransmitterCmd ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
State of LPUART transmitter enable(true)/disable(false)
static void LPUART_HAL_SetReceiverCmd ( LPUART_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseLPUART base pointer
enableEnable(true) or disable(false) receiver.
static bool LPUART_HAL_GetReceiverCmd ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
State of LPUART receiver enable(true)/disable(false)
lpuart_status_t LPUART_HAL_SetBaudRate ( LPUART_Type *  base,
uint32_t  sourceClockInHz,
uint32_t  desiredBaudRate 
)

In some LPUART instances the user must disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer.
sourceClockInHzLPUART source input clock in Hz.
desiredBaudRateLPUART desired baud rate.
Returns
An error code or kStatus_Success
static void LPUART_HAL_SetBaudRateDivisor ( LPUART_Type *  base,
uint32_t  baudRateDivisor 
)
inlinestatic
Parameters
baseLPUART base pointer.
baudRateDivisorThe baud rate modulo division "SBR"
void LPUART_HAL_SetBitCountPerChar ( LPUART_Type *  base,
lpuart_bit_count_per_char_t  bitCountPerChar 
)

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer.
bitCountPerCharNumber of bits per char (8, 9, or 10, depending on the LPUART instance)
void LPUART_HAL_SetParityMode ( LPUART_Type *  base,
lpuart_parity_mode_t  parityModeType 
)

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer.
parityModeTypeParity mode (enabled, disable, odd, even - see parity_mode_t struct)
static void LPUART_HAL_SetStopBitCount ( LPUART_Type *  base,
lpuart_stop_bit_count_t  stopBitCount 
)
inlinestatic

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer.
stopBitCountNumber of stop bits (1 or 2 - see lpuart_stop_bit_count_t struct)
Returns
An error code (an unsupported setting in some LPUARTs) or kStatus_Success
static uint32_t LPUART_HAL_GetDataRegAddr ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer.
Returns
LPUART transmit/receive data register address.
void LPUART_HAL_SetIntMode ( LPUART_Type *  base,
lpuart_interrupt_t  interrupt,
bool  enable 
)
Parameters
baseLPUART module base pointer.
interruptLPUART interrupt configuration data.
enabletrue: enable, false: disable.
bool LPUART_HAL_GetIntMode ( LPUART_Type *  base,
lpuart_interrupt_t  interrupt 
)
Parameters
baseLPUART module base pointer.
interruptLPUART interrupt configuration data.
Returns
true: enable, false: disable.
static void LPUART_HAL_Putchar ( LPUART_Type *  base,
uint8_t  data 
)
inlinestatic
Parameters
baseLPUART Instance
datadata to send (8-bit)
void LPUART_HAL_Putchar9 ( LPUART_Type *  base,
uint16_t  data 
)
Parameters
baseLPUART Instance
datadata to send (9-bit)
lpuart_status_t LPUART_HAL_Putchar10 ( LPUART_Type *  base,
uint16_t  data 
)

Note that this feature is available on select LPUART instances.

Parameters
baseLPUART Instance
datadata to send (10-bit)
Returns
An error code or kStatus_Success
static void LPUART_HAL_Getchar ( LPUART_Type *  base,
uint8_t *  readData 
)
inlinestatic
Parameters
baseLPUART base pointer
readDataData read from receive (8-bit)
void LPUART_HAL_Getchar9 ( LPUART_Type *  base,
uint16_t *  readData 
)
Parameters
baseLPUART base pointer
readDataData read from receive (9-bit)
void LPUART_HAL_Getchar10 ( LPUART_Type *  base,
uint16_t *  readData 
)
Parameters
baseLPUART base pointer
readDataData read from receive (10-bit)
void LPUART_HAL_SendDataPolling ( LPUART_Type *  base,
const uint8_t *  txBuff,
uint32_t  txSize 
)

This function only supports 8-bit transaction.

Parameters
baseLPUART module base pointer.
txBuffThe buffer pointer which saves the data to be sent.
txSizeSize of data to be sent in unit of byte.
lpuart_status_t LPUART_HAL_ReceiveDataPolling ( LPUART_Type *  base,
uint8_t *  rxBuff,
uint32_t  rxSize 
)

This function only supports 8-bit transaction.

Parameters
baseLPUART module base pointer.
rxBuffThe buffer pointer which saves the data to be received.
rxSizeSize of data need to be received in unit of byte.
Returns
Whether the transaction is success or receive overrun.
bool LPUART_HAL_GetStatusFlag ( LPUART_Type *  base,
lpuart_status_flag_t  statusFlag 
)
Parameters
baseLPUART base pointer
statusFlagThe status flag to query
Returns
Whether the current status flag is set(true) or not(false).
lpuart_status_t LPUART_HAL_ClearStatusFlag ( LPUART_Type *  base,
lpuart_status_flag_t  statusFlag 
)
Parameters
baseLPUART base pointer
statusFlagDesired LPUART status flag to clear
Returns
An error code or kStatus_Success
static void LPUART_HAL_SetIdleChar ( LPUART_Type *  base,
lpuart_idle_char_t  idleConfig 
)
inlinestatic
Parameters
baseLPUART base pointer
idleConfigIdle characters configuration
static lpuart_idle_char_t LPUART_HAL_GetIdleChar ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
idle characters configuration
static bool LPUART_HAL_IsCurrentDataWithNoise ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer.
Returns
The status of the NOISY bit in the LPUART extended data register
static bool LPUART_HAL_IsCurrentDataWithFrameError ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
The status of the FRETSC bit in the LPUART extended data register
static void LPUART_HAL_SetTxSpecialChar ( LPUART_Type *  base,
uint8_t  specialChar 
)
inlinestatic
Parameters
baseLPUART base pointer
specialCharT9 is used to indicate a break character when 0 an idle character when 1, the contents of DATA[T8:T0] should be zero.
static bool LPUART_HAL_IsCurrentDataWithParityError ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
The status of the PARITYE bit in the LPUART extended data register
static bool LPUART_HAL_IsReceiveBufferEmpty ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
TRUE if the receive-buffer is empty, else FALSE.
static bool LPUART_HAL_WasPreviousReceiverStateIdle ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
TRUE if the previous BUS state was IDLE, else FALSE.
static void LPUART_HAL_SetWaitModeOperation ( LPUART_Type *  base,
lpuart_operation_config_t  mode 
)
inlinestatic

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer
modeLPUART wait mode operation - operates or stops to operate in wait mode.
static lpuart_operation_config_t LPUART_HAL_GetWaitModeOperation ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
LPUART wait mode operation configuration
  • kLpuartOperates or KLpuartStops in wait mode
void LPUART_HAL_SetLoopbackCmd ( LPUART_Type *  base,
bool  enable 
)

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer
enableLPUART loopback mode - disabled (0) or enabled (1)
void LPUART_HAL_SetSingleWireCmd ( LPUART_Type *  base,
bool  enable 
)

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer
enableLPUART loopback mode - disabled (0) or enabled (1)
static void LPUART_HAL_SetTxdirInSinglewireMode ( LPUART_Type *  base,
lpuart_singlewire_txdir_t  direction 
)
inlinestatic
Parameters
baseLPUART base pointer
directionLPUART single-wire transmit direction - input or output
lpuart_status_t LPUART_HAL_SetReceiverInStandbyMode ( LPUART_Type *  base)
Parameters
baseLPUART base pointer
Returns
Error code or kStatus_Success
static void LPUART_HAL_PutReceiverInNormalMode ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
static bool LPUART_HAL_IsReceiverInStandby ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
LPUART in normal more (0) or standby (1)
static void LPUART_HAL_SetReceiverWakeupMode ( LPUART_Type *  base,
lpuart_wakeup_method_t  method 
)
inlinestatic
Parameters
baseLPUART base pointer
methodLPUART wakeup method: 0 - Idle-line wake (default), 1 - addr-mark wake
static lpuart_wakeup_method_t LPUART_HAL_GetReceiverWakeupMode ( LPUART_Type *  base)
inlinestatic
Parameters
baseLPUART base pointer
Returns
LPUART wakeup method: kLpuartIdleLineWake: 0 - Idle-line wake (default), kLpuartAddrMarkWake: 1 - addr-mark wake
void LPUART_HAL_SetIdleLineDetect ( LPUART_Type *  base,
const lpuart_idle_line_config_t config 
)

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer
configLPUART configuration data for idle line detect operation
static void LPUART_HAL_SetBreakCharTransmitLength ( LPUART_Type *  base,
lpuart_break_char_length_t  length 
)
inlinestatic

In some LPUART instances, the user should disable the transmitter before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer
lengthLPUART break character length setting: 0 - minimum 10-bit times (default), 1 - minimum 13-bit times
static void LPUART_HAL_SetBreakCharDetectLength ( LPUART_Type *  base,
lpuart_break_char_length_t  length 
)
inlinestatic
Parameters
baseLPUART base pointer
lengthLPUART break character length setting: 0 - minimum 10-bit times (default), 1 - minimum 13-bit times
static void LPUART_HAL_QueueBreakCharToSend ( LPUART_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseLPUART base pointer
enableLPUART normal/queue break char - disabled (normal mode, default: 0) or enabled (queue break char: 1)
static void LPUART_HAL_SetMatchAddressMode ( LPUART_Type *  base,
lpuart_match_config_t  config 
)
inlinestatic
Parameters
baseLPUART base pointer
configMATCFG: Configures the match addressing mode used.
void LPUART_HAL_SetMatchAddressReg1 ( LPUART_Type *  base,
bool  enable,
uint8_t  value 
)

The MAEN bit must be cleared before configuring the MA value. Therefore, the enable/disable and set value must be included inside one function.

Parameters
baseLPUART base pointer
enableMatch address model enable (true)/disable (false)
valueMatch address value to program into match address register 1
void LPUART_HAL_SetMatchAddressReg2 ( LPUART_Type *  base,
bool  enable,
uint8_t  value 
)

The MAEN bit must be cleared before configuring MA value. Therefore, the enable/disable and set value must be included inside one function.

Parameters
baseLPUART base pointer
enableMatch address model enable (true)/disable (false)
valueMatch address value to program into match address register 2
static void LPUART_HAL_SetSendMsbFirstCmd ( LPUART_Type *  base,
bool  enable 
)
inlinestatic

In some LPUART instances, the user should disable the transmitter/receiver before calling this function. Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters
baseLPUART base pointer
enablefalse - LSB (default, disabled), true - MSB (enabled)
static void LPUART_HAL_SetReceiveResyncCmd ( LPUART_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseLPUART base pointer
enablere-sync of received data word configuration: true - re-sync of received data word (default) false - disable the re-sync