| Kinetis SDK API Reference Manual 1.0.0-beta Freescale Semiconductor, Inc.

- Introduction
- Related Pages
- API Usage

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Enumerations
LPUART HAL driver
Low Power Universal Asynchronous Receiver/Transmitter (LPUART)

The section describes the programming interface of the LPUART HAL driver. More...

## Data Structures
struct | lpuart_idle_line_config_t
| Structure for idle line configuration settings. More...
struct | lpuart_status_t
| Structure for all LPUART status flags. More...
struct | lpuart_interrupt_config_t
| LPUART interrupt configuration structure, default settings are 0 (disabled) More...
struct | lpuart_config_t
| LPUART configuration structure. More...

## Enumerations
enum | lpuart_operation_config_t { kLpuartOperates = 0, kLpuartStops = 1 }
| LPUART operation configuration constants. More...
enum | lpuart_wakeup_method_t { kLpuartIdleLineWake = 0, kLpuartAddrMarkWake = 1 }
| LPUART wakeup from standby method constants. More...
enum | lpuart_idle_line_select_t { kLpuartIdleLineAfterStartBit = 0, kLpuartIdleLineAfterStopBit = 1 }
| LPUART idle line detect selection types. More...
enum | lpuart_break_char_length_t { kLpuartBreakChar10BitMinimum = 0, kLpuartBreakChar13BitMinimum = 1 }
| LPUART break character length settings for transmit/detect. More...
enum | lpuart_singlewire_txdir_t { kLpuartSinglewireTxdirIn = 0, kLpuartSinglewireTxdirOut = 1 }
| LPUART single-wire mode TX direction. More...
enum | lpuart_match_config_t { kLpuartAddressMatchWakeup = 0, kLpuartIdleMatchWakeup = 1, kLpuartMatchOnAndMatchOff = 2, kLpuartEnablesRwuOnDataMatch = 3 }
| LPUART Configures the match addressing mode used. More...
enum | lpuart_status_flag_t { kLpuartTransmitDataRegisterEmpty, kLpuartTransmissionComplete, kLpuartReceiveDataRegisterFull, kLpuartIdleLineDetect, kLpuartReceiveOverrun, kLpuartNoiseDetect, kLpuartFrameError, kLpuartParityError, kLpuartLineBreakDetect, kLpuartReceiveActiveEdgeDetect, kLpuartReceiverActive }
| LPUART status flags. More...
enum | lpuart_ir_tx_pulsewidth_t { kLpuartIrThreeSixteenthsWidth = 0, kLpuartIrOneSixteenthWidth = 1, kLpuartIrOneThirtysecondsWidth = 2, kLpuartIrOneFourthWidth = 3 }
| LPUART infrared transmitter pulse width options. More...
enum | lpuart_idle_config_t { kLpuart_1_IdleChar = 0, kLpuart_2_IdleChar = 1, kLpuart_4_IdleChar = 2, kLpuart_8_IdleChar = 3, kLpuart_16_IdleChar = 4, kLpuart_32_IdleChar = 5, kLpuart_64_IdleChar = 6, kLpuart_128_IdleChar = 7 }
| LPUART Configures the number of idle characters that must be received before the IDLE flag is set. More...
enum | lpuart_cts_source_t { kLpuartCtsSourcePin = 0, kLpuartCtsSourceInvertedReceiverMatch = 1 }
| LPUART Transmits the CTS Configuration. More...
enum | lpuart_cts_config_t { kLpuartCtsSampledOnEachCharacter = 0, kLpuartCtsSampledOnIdle = 1 }
| 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...

## LPUART Common Configurations
status_t | lpuart_hal_init (uint32_t lpuartInstance, const lpuart_config_t *config)
| Initializes the LPUART controller (see lpuart_config_t struct for initialization details). More...
status_t | lpuart_hal_set_baud_rate (uint32_t lpuartInstance, uint32_t sourceClockInHz, uint32_t desiredBaudRate)
| Configures the LPUART baud rate. More...
status_t | lpuart_hal_set_baud_rate_divisor (uint32_t lpuartInstance, uint32_t baudRateDivisor)
| Sets the LPUART baud rate modulo divisor. More...
status_t | lpuart_hal_configure_bit_count_per_char (uint32_t lpuartInstance, lpuart_bit_count_per_char_t bitCountPerChar)
| Configures the number of bits per character in the LPUART controller In some LPUART instances, the user should disable the transmitter/receiver before calling this function. More...
void | lpuart_hal_configure_parity_mode (uint32_t lpuartInstance, lpuart_parity_mode_t parityModeType)
| Configures parity mode in the LPUART controller. More...
status_t | lpuart_hal_configure_stop_bit_count (uint32_t lpuartInstance, lpuart_stop_bit_count_t stopBitCount)
| Configures the number of stop bits in the LPUART controller. More...
void | lpuart_hal_configure_tx_rx_inversion (uint32_t lpuartInstance, uint32_t rxInvert, uint32_t txInvert)
| Configures the transmit and receive inversion control in the LPUART controller. More...
void | lpuart_hal_enable_transmitter (uint32_t lpuartInstance)
| Enables the LPUART transmitter. More...
void | lpuart_hal_disable_transmitter (uint32_t lpuartInstance)
| Disables the LPUART transmitter. More...
bool | lpuart_hal_is_transmitter_enabled (uint32_t lpuartInstance)
| Gets the LPUART transmitter enabled/disabled configuration. More...
void | lpuart_hal_enable_receiver (uint32_t lpuartInstance)
| Enables the LPUART receiver. More...
void | lpuart_hal_disable_receiver (uint32_t lpuartInstance)
| Disables the LPUART receiver. More...
bool | lpuart_hal_is_receiver_enabled (uint32_t lpuartInstance)
| Gets the LPUART receiver enabled/disabled configuration. More...

## LPUART Interrupts and DMA
void | lpuart_hal_configure_interrupts (uint32_t lpuartInstance, const lpuart_interrupt_config_t *interruptConfig)
| Configures the LPUART module interrupts to enable/disable various interrupt sources. More...
void | lpuart_hal_enable_break_detect_interrupt (uint32_t lpuartInstance)
| Enables the break_detect_interrupt. More...
void | lpuart_hal_disable_break_detect_interrupt (uint32_t lpuartInstance)
| Disables the break_detect_interrupt. More...
bool | lpuart_hal_is_break_detect_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the break_detect_interrupt enable. More...
void | lpuart_hal_enable_rx_active_edge_interrupt (uint32_t lpuartInstance)
| Enables the rx_active_edge_interrupt. More...
void | lpuart_hal_disable_rx_active_edge_interrupt (uint32_t lpuartInstance)
| Disables the rx_active_edge_interrupt. More...
bool | lpuart_hal_is_rx_active_edge_interrupt_enabled (uint32_t lpuartInstance)
| Enables the configuration of the rx_active_edge_interrupt. More...
void | lpuart_hal_enable_tx_data_register_empty_interrupt (uint32_t lpuartInstance)
| Enables the tx_data_register_empty_interrupt. More...
void | lpuart_hal_disable_tx_data_register_empty_interrupt (uint32_t lpuartInstance)
| Disables the tx_data_register_empty_interrupt. More...
bool | lpuart_hal_is_tx_data_register_empty_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the tx_data_register_empty_interrupt enable. More...
void | lpuart_hal_enable_transmission_complete_interrupt (uint32_t lpuartInstance)
| Enables the transmission_complete_interrupt. More...
void | lpuart_hal_disable_transmission_complete_interrupt (uint32_t lpuartInstance)
| Disables the transmission_complete_interrupt. More...
bool | lpuart_hal_is_transmission_complete_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the transmission_complete_interrupt enable. More...
void | lpuart_hal_enable_rx_data_register_full_interrupt (uint32_t lpuartInstance)
| Enables the rx_data_register_full_interrupt. More...
void | lpuart_hal_disable_rx_data_register_full_interrupt (uint32_t lpuartInstance)
| Disables the rx_data_register_full_interrupt. More...
bool | lpuart_hal_is_receive_data_full_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the rx_data_register_full_interrupt enable. More...
void | lpuart_hal_enable_idle_line_interrupt (uint32_t lpuartInstance)
| Enables the idle_line_interrupt. More...
void | lpuart_hal_disable_idle_line_interrupt (uint32_t lpuartInstance)
| Disables the idle_line_interrupt. More...
bool | lpuart_hal_is_idle_line_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the idle_line_interrupt enable. More...
void | lpuart_hal_enable_rx_overrun_interrupt (uint32_t lpuartInstance)
| Enables the rx_overrun_interrupt. More...
void | lpuart_hal_disable_rx_overrun_interrupt (uint32_t lpuartInstance)
| Disables the rx_overrun_interrupt. More...
bool | lpuart_hal_is_rx_overrun_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the rx_overrun_interrupt enable. More...
void | lpuart_hal_enable_noise_error_interrupt (uint32_t lpuartInstance)
| Enables the noise_error_interrupt. More...
void | lpuart_hal_disable_noise_error_interrupt (uint32_t lpuartInstance)
| Disables the noise_error_interrupt. More...
bool | lpuart_hal_is_noise_error_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the noise_error_interrupt enable. More...
void | lpuart_hal_enable_framing_error_interrupt (uint32_t lpuartInstance)
| Enables the framing_error_interrupt. More...
void | lpuart_hal_disable_framing_error_interrupt (uint32_t lpuartInstance)
| Disables the framing_error_interrupt. More...
bool | lpuart_hal_is_framing_error_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the framing_error_interrupt enable. More...
void | lpuart_hal_enable_parity_error_interrupt (uint32_t lpuartInstance)
| Enables the parity_error_interrupt. More...
void | lpuart_hal_disable_parity_error_interrupt (uint32_t lpuartInstance)
| Disables the parity_error_interrupt. More...
bool | lpuart_hal_is_parity_error_interrupt_enabled (uint32_t lpuartInstance)
| Gets the configuration of the parity_error_interrupt enable. More...
void | lpuart_hal_configure_dma (uint32_t lpuartInstance, bool txDmaConfig, bool rxDmaConfig)
| LPUART configures DMA requests for Transmitter and Receiver. More...
bool | lpuart_hal_is_txdma_enabled (uint32_t lpuartInstance)
| Gets the LPUART Transmit DMA request configuration. More...
bool | lpuart_hal_is_rxdma_enabled (uint32_t lpuartInstance)
| Gets the LPUART receive DMA request configuration. More...

## LPUART Transfer Functions
void | lpuart_hal_putchar (uint32_t lpuartInstance, uint8_t data)
| Sends the LPUART 8-bit character. More...
void | lpuart_hal_putchar9 (uint32_t lpuartInstance, uint16_t data)
| Sends the LPUART 9-bit character. More...
status_t | lpuart_hal_putchar10 (uint32_t lpuartInstance, uint16_t data)
| Sends the LPUART 10-bit character (Note: Feature available on select LPUART instances). More...
void | lpuart_hal_getchar (uint32_t lpuartInstance, uint8_t *readData)
| Gets the LPUART 8-bit character. More...
void | lpuart_hal_getchar9 (uint32_t lpuartInstance, uint16_t *readData)
| Gets the LPUART 9-bit character. More...
status_t | lpuart_hal_getchar10 (uint32_t lpuartInstance, uint16_t *readData)
| Gets the LPUART 10-bit character. More...
void | lpuart_hal_idleconfig (uint32_t lpuartInstance, lpuart_idle_config_t idle_config)
| Configures the number of idle characters that must be received before the IDLE flag is set. More...
lpuart_idle_config_t | lpuart_hal_get_idleconfig (uint32_t lpuartInstance)
| Gets the configuration of the number of idle characters that must be received before the IDLE flag is set. More...

## LPUART Special Feature Configurations
void | lpuart_hal_configure_wait_mode_operation (uint32_t lpuartInstance, lpuart_operation_config_t mode)
| Configures the LPUART operation in wait mode (operates or stops operations in wait mode). More...
lpuart_operation_config_t | lpuart_hal_get_wait_mode_operation_config (uint32_t lpuartInstance)
| Gets the LPUART operation in wait mode (operates or stops operations in wait mode). More...
void | lpuart_hal_configure_loopback_mode (uint32_t lpuartInstance, bool enable)
| Configures the LPUART loopback operation (enable/disable loopback operation) In some LPUART instances, the user should disable the transmitter/receiver before calling this function. More...
void | lpuart_hal_configure_singlewire_mode (uint32_t lpuartInstance, bool enable)
| Configures the LPUART single-wire operation (enable/disable single-wire mode) In some LPUART instances, the user should disable the transmitter/receiver before calling this function. More...
void | lpuart_hal_configure_txdir_in_singlewire_mode (uint32_t lpuartInstance, lpuart_singlewire_txdir_t direction)
| Configures the LPUART transmit direction while in single-wire mode. More...
status_t | lpuart_hal_put_receiver_in_standby_mode (uint32_t lpuartInstance)
| Places the LPUART receiver in standby mode. More...
void | lpuart_hal_put_receiver_in_normal_mode (uint32_t lpuartInstance)
| Places the LPUART receiver in a normal mode (disable standby mode operation). More...
bool | lpuart_hal_is_receiver_in_standby (uint32_t lpuartInstance)
| Checks whether the LPUART receiver is in a standby mode. More...
void | lpuart_hal_select_receiver_wakeup_method (uint32_t lpuartInstance, lpuart_wakeup_method_t method)
| LPUART receiver wakeup method (idle line or addr-mark) from standby mode. More...
lpuart_wakeup_method_t | lpuart_hal_get_receiver_wakeup_method (uint32_t lpuartInstance)
| Gets the LPUART receiver wakeup method (idle line or addr-mark) from standby mode. More...
void | lpuart_hal_configure_idle_line_detect (uint32_t lpuartInstance, 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...
void | lpuart_hal_set_break_char_transmit_length (uint32_t lpuartInstance, lpuart_break_char_length_t length)
| LPUART break character transmit length configuration In some LPUART instances, the user should disable the transmitter before calling this function. More...
void | lpuart_hal_set_break_char_detect_length (uint32_t lpuartInstance, lpuart_break_char_length_t length)
| LPUART break character detect length configuration. More...
void | lpuart_hal_queue_break_char_to_send (uint32_t lpuartInstance, bool enable)
| LPUART transmit send break character configuration. More...
status_t | lpuart_hal_configure_match_address_operation (uint32_t lpuartInstance, bool matchAddrMode1, bool matchAddrMode2, uint8_t matchAddrValue1, uint8_t matchAddrValue2, lpuart_match_config_t config)
| LPUART configure match address mode control (Note: Feature available on select LPUART instances) More...
status_t | lpuart_hal_configure_send_msb_first_operation (uint32_t lpuartInstance, bool enable)
| LPUART sends the MSB first configuration (Note: Feature available on select LPUART instances) In some LPUART instances, the user should disable the transmitter/receiver before calling this function. More...
status_t | lpuart_hal_configure_receive_resync_disable_operation (uint32_t lpuartInstance, bool enable)
| LPUART disables re-sync of received data configuration (Note: Feature available on select LPUART instances). More...

## LPUART Status Flags
void | lpuart_hal_get_all_status_flag (uint32_t lpuartInstance, lpuart_status_t *allStatusFlag)
| LPUART get all status flag. More...
bool | lpuart_hal_is_transmit_data_register_empty (uint32_t lpuartInstance)
| Gets the LPUART transmit data register empty flag. More...
bool | lpuart_hal_is_transmission_complete (uint32_t lpuartInstance)
| Gets the LPUART transmission complete flag. More...
bool | lpuart_hal_is_receive_data_register_full (uint32_t lpuartInstance)
| Gets the LPUART receive data register full flag. More...
bool | lpuart_hal_is_idle_line_detected (uint32_t lpuartInstance)
| Gets the LPUART idle line detect flag. More...
bool | lpuart_hal_is_receive_overrun_detected (uint32_t lpuartInstance)
| Gets the LPUART receiver overrun status. More...
bool | lpuart_hal_is_noise_detected (uint32_t lpuartInstance)
| Gets the LPUART noise flag. More...
bool | lpuart_hal_is_frame_error_detected (uint32_t lpuartInstance)
| Gets the LPUART frame error flag. More...
bool | lpuart_hal_is_parity_error_detected (uint32_t lpuartInstance)
| Gets the LPUART parity error flag. More...
bool | lpuart_hal_is_line_break_detected (uint32_t lpuartInstance)
| Gets the LPUART LIN break detect interrupt flag. More...
bool | lpuart_hal_is_receive_active_edge_detected (uint32_t lpuartInstance)
| Gets the LPUART receive pin active edge interrupt flag. More...
bool | lpuart_hal_is_receiver_active (uint32_t lpuartInstance)
| Gets LPUART Receiver Active Flag (RAF). More...
status_t | lpuart_hal_clear_status_flag (uint32_t lpuartInstance, lpuart_status_flag_t statusFlag)
| LPUART clears an individual status flag (see lpuart_status_flag_t for list of status bits). More...
void | lpuart_hal_clear_all_non_autoclear_status_flags (uint32_t lpuartInstance)
| LPUART clears ALL status flags. 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),.
unsigned | rxWakeIdleDetect: 1
| 1 - after stop bit More...

#### Field Documentation

unsigned lpuart_idle_line_config_t::rxWakeIdleDetect

RWUID, Receiver Wake Up Idle Detect. IDLE status bit

struct lpuart_status_t

### Data Fields
unsigned | transmitDataRegisterEmpty: 1
| Transmit data register empty flag, sets when.
unsigned | transmissionComplete: 1
| transmit buffer is empty More...
unsigned | receiveDataRegisterFull: 1
| is idle (transmission activity complete) More...
unsigned | idleLineDetect: 1
| receive data buffer is full More...
unsigned | receiveOverrun: 1
| Receiver Overrun sets when new data is received.
unsigned | noiseDetect: 1
| before data is read from receive register More...
unsigned | frameError: 1
| If any of these samples differ, noise flag sets. More...
unsigned | parityError: 1
| where stop bit expected More...
unsigned | lineBreakDetect: 1
| error detection More...
unsigned | receiveActiveEdgeDetect: 1
| LIN break char detected and LIN circuit enabled. More...
unsigned | receiverActive: 1
| when active edge detected More...

#### Field Documentation

unsigned lpuart_status_t::transmissionComplete

Transmission complete flag, sets when transmitter

unsigned lpuart_status_t::receiveDataRegisterFull

Receive data register full flag, sets when the

unsigned lpuart_status_t::idleLineDetect

Idle line detect flag, sets when idle line detected

unsigned lpuart_status_t::noiseDetect

Receiver takes 3 samples of each received bit.

unsigned lpuart_status_t::frameError

Frame error flag, sets if logic 0 was detected

unsigned lpuart_status_t::parityError

If parity enabled, will set upon parity

unsigned lpuart_status_t::lineBreakDetect

LIN break detect interrupt flag, sets when

unsigned lpuart_status_t::receiveActiveEdgeDetect

Receive pin active edge interrupt flag, sets

unsigned lpuart_status_t::receiverActive

Receiver Active Flag (RAF), sets a beginning of

struct lpuart_interrupt_config_t

### Data Fields
unsigned | linBreakDetect: 1
| LIN break detect: 0 - disable interrupt,.
unsigned | rxActiveEdge: 1
| 1 - enable interrupt More...
unsigned | transmitDataRegisterEmpty: 1
| 1 - enable interrupt More...
unsigned | transmitComplete: 1
| 0 - disable interrupt, 1 - enable interrupt More...
unsigned | receiverDataRegisterFull: 1
| 1 - enable interrupt More...
unsigned | idleLine: 1
| 0 - disable interrupt, 1 - enable interrupt More...
unsigned | receiverOverrun: 1
| Receiver Overrun: 0 - disable interrupt,.
unsigned | noiseErrorFlag: 1
| 1 - enable interrupt More...
unsigned | frameErrorFlag: 1
| 1 - enable interrupt More...
unsigned | parityErrorFlag: 1
| 1 - enable interrupt More...

#### Field Documentation

unsigned lpuart_interrupt_config_t::rxActiveEdge

RX Active Edge: 0 - disable interrupt,

unsigned lpuart_interrupt_config_t::transmitDataRegisterEmpty

Transmit data register empty:

unsigned lpuart_interrupt_config_t::transmitComplete

Transmission complete: 0 - disable interrupt,

unsigned lpuart_interrupt_config_t::receiverDataRegisterFull

Receiver data register full:

unsigned lpuart_interrupt_config_t::idleLine

Idle line: 0 - disable interrupt, 1 - enable interrupt

unsigned lpuart_interrupt_config_t::noiseErrorFlag

Noise error flag: 0 - disable interrupt,

unsigned lpuart_interrupt_config_t::frameErrorFlag

Framing error flag: 0 - disable interrupt,

unsigned lpuart_interrupt_config_t::parityErrorFlag

Parity error flag: 0 - disable interrupt,

struct lpuart_config_t

### Data Fields
uint32_t | lpuartSourceClockInHz
| LPUART module source clock in Hertz.
uint32_t | baudRate
| LPUART baud rate.
lpuart_parity_mode_t | parityMode
| parity mode, disabled (default), even, odd
lpuart_stop_bit_count_t | stopBitCount
| number of stop bits, 1 stop bit (default)
lpuart_bit_count_per_char_t | bitCountPerChar
| or 2 stop bits More...
unsigned | rxDataInvert: 1
| in a word (up to 10-bits in More...
unsigned | txDataInvert: 1
| 1 - inverted More...

#### Field Documentation

lpuart_bit_count_per_char_t lpuart_config_t::bitCountPerChar

number of bits, 8-bit (default) or 9-bit

unsigned lpuart_config_t::rxDataInvert

some LPUART instances) Receive Data Inversion: 0 - not inverted (default),

unsigned lpuart_config_t::txDataInvert

Transmit Data Inversion: 0 - not inverted (default),

## Enumeration Type Documentation

enum lpuart_operation_config_t

Enumerator
kLpuartOperates | LPUART continues to operate normally.
kLpuartStops | LPUART stops operation.

enum lpuart_wakeup_method_t

Enumerator
kLpuartIdleLineWake | Idle-line wakes the LPUART receiver from standby.
kLpuartAddrMarkWake | Addr-mark wakes LPUART receiver from standby.

enum lpuart_idle_line_select_t

Enumerator
kLpuartIdleLineAfterStartBit | LPUART idle character bit count start after start bit.
kLpuartIdleLineAfterStopBit | LPUART idle character bit count start after stop bit.

enum lpuart_break_char_length_t

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.
kLpuartBreakChar13BitMinimum | 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 LPUART break char length 13 bit times (if M = 0, SBNS = 0) or

enum lpuart_singlewire_txdir_t

Enumerator
kLpuartSinglewireTxdirIn | LPUART Single Wire mode TXDIR input.
kLpuartSinglewireTxdirOut | LPUART Single Wire mode TXDIR output.

enum lpuart_match_config_t

Enumerator
kLpuartAddressMatchWakeup | LPUART Address Match Wakeup.
kLpuartIdleMatchWakeup | LPUART Idle Match Wakeup.
kLpuartMatchOnAndMatchOff | LPUART Match On and Match Off.
kLpuartEnablesRwuOnDataMatch | LPUART Enables RWU on Data Match and Match On/Off for transmitter CTS input.

enum lpuart_status_flag_t

Enumerator
kLpuartTransmitDataRegisterEmpty | Transmit data register empty flag, sets when transmit.
kLpuartTransmissionComplete | buffer is empty Transmission complete flag, sets when transmitter is idle
kLpuartReceiveDataRegisterFull | (transmission activity complete) Receive data register full flag, sets when the receive data
kLpuartIdleLineDetect | buffer is full Idle line detect flag, sets when idle line detected
kLpuartReceiveOverrun | Receiver Overrun sets when new data is received before data.
kLpuartNoiseDetect | is read from the receive register Receiver takes 3 samples of each received bit. If any of
kLpuartFrameError | these samples differs, noise flag sets Frame error flag, sets if logic 0 was detected where stop
kLpuartParityError | bit expected If parity enabled, will set upon parity error detection
kLpuartLineBreakDetect | LIN break detect interrupt flag, sets when.
kLpuartReceiveActiveEdgeDetect | LIN break char detected and LIN circuit enabled. Receive pin active edge interrupt flag, sets when active
kLpuartReceiverActive | edge detected Receiver Active Flag (RAF), sets a beginning of valid start bit

enum lpuart_ir_tx_pulsewidth_t

Enumerator
kLpuartIrThreeSixteenthsWidth | 3/16 pulse
kLpuartIrOneSixteenthWidth | 1/16 pulse
kLpuartIrOneThirtysecondsWidth | 1/32 pulse
kLpuartIrOneFourthWidth | 1/4 pulse

enum lpuart_idle_config_t

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

enum lpuart_cts_source_t

Configures the source of the CTS input.

Enumerator
kLpuartCtsSourcePin | LPUART CTS input is the LPUART_CTS pin.
kLpuartCtsSourceInvertedReceiverMatch | LPUART CTS input is the inverted Receiver Match result.

enum lpuart_cts_config_t

Enumerator
kLpuartCtsSampledOnEachCharacter | LPUART CTS input is sampled at the start of each character.
kLpuartCtsSampledOnIdle | LPUART CTS input is sampled when the transmitter is idle.

## Function Documentation

status_t lpuart_hal_init | ( | uint32_t | lpuartInstance,
|  | const lpuart_config_t * | config
| ) |  |

Parameters

  lpuartInstance | LPUART instance number.
  config | LPUART configuration data.

Returns
  An error code or kStatus_Success

status_t lpuart_hal_set_baud_rate | ( | uint32_t | lpuartInstance,
|  | 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

  lpuartInstance | LPUART instance number.
  sourceClockInHz | LPUART source input clock in Hz.
  desiredBaudRate | LPUART desired baud rate.

Returns
  An error code or kStatus_Success

status_t lpuart_hal_set_baud_rate_divisor | ( | uint32_t | lpuartInstance,
|  | uint32_t | baudRateDivisor
| ) |  |

Parameters

  lpuartInstance | LPUART instance number.
  baudRateDivisor | The baud rate modulo division "SBR"

Returns
  An error code or kStatus_Success

status_t lpuart_hal_configure_bit_count_per_char | ( | uint32_t | lpuartInstance,
|  | lpuart_bit_count_per_char_t | bitCountPerChar
| ) |  |

Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters

  lpuartInstance | LPUART instance number.
  bitCountPerChar | Number of bits per char (8, 9, or 10, depending on the LPUART instance)

Returns
  An error code or kStatus_Success

void lpuart_hal_configure_parity_mode | ( | uint32_t | lpuartInstance,
|  | 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

  lpuartInstance | LPUART instance number.
  parityModeType | Parity mode (enabled, disable, odd, even - see parity_mode_t struct)

status_t lpuart_hal_configure_stop_bit_count | ( | uint32_t | lpuartInstance,
|  | lpuart_stop_bit_count_t | stopBitCount
| ) |  |

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

  lpuartInstance | LPUART instance number.
  stopBitCount | Number 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

void lpuart_hal_configure_tx_rx_inversion | ( | uint32_t | lpuartInstance,
|  | uint32_t | rxInvert,
|  | uint32_t | txInvert
| ) |  |

This function should only be called when the LPUART is between transmit and receive packets.

Parameters

  lpuartInstance | LPUART instance number.
  rxInvert | Enable (1) or disable (0) receive inversion
  txInvert | Enable (1) or disable (0) transmit inversion

void lpuart_hal_enable_transmitter | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number.

void lpuart_hal_disable_transmitter | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_transmitter_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  State of LPUART transmitter enable(1)/disable(0)

void lpuart_hal_enable_receiver | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_receiver | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_receiver_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  State of LPUART receiver enable(1)/disable(0)

void lpuart_hal_configure_interrupts | ( | uint32_t | lpuartInstance,
|  | const lpuart_interrupt_config_t * | interruptConfig
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  interruptConfig | LPUART interrupt configuration data

void lpuart_hal_enable_break_detect_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_break_detect_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_break_detect_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_rx_active_edge_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_rx_active_edge_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number.

bool lpuart_hal_is_rx_active_edge_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_tx_data_register_empty_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_tx_data_register_empty_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_tx_data_register_empty_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_transmission_complete_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_transmission_complete_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_transmission_complete_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_rx_data_register_full_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_rx_data_register_full_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_receive_data_full_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_idle_line_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_idle_line_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_idle_line_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_rx_overrun_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_rx_overrun_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_rx_overrun_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_noise_error_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_noise_error_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_noise_error_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_framing_error_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_framing_error_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_framing_error_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_enable_parity_error_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

void lpuart_hal_disable_parity_error_interrupt | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_parity_error_interrupt_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Bit setting of the interrupt enable bit

void lpuart_hal_configure_dma | ( | uint32_t | lpuartInstance,
|  | bool | txDmaConfig,
|  | bool | rxDmaConfig
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  txDmaConfig | Transmit DMA request configuration (enable:1 /disable: 0)
  rxDmaConfig | Receive DMA request configuration (enable: 1/disable: 0)

bool lpuart_hal_is_txdma_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Transmit DMA request configuration (enable: 1/disable: 0)

bool lpuart_hal_is_rxdma_enabled | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Receives the DMA request configuration (enable: 1/disable: 0).

void lpuart_hal_putchar | ( | uint32_t | lpuartInstance,
|  | uint8_t | data
| ) |  |

Parameters

  lpuartInstance | LPUART Instance
  data | data to send (8-bit)

void lpuart_hal_putchar9 | ( | uint32_t | lpuartInstance,
|  | uint16_t | data
| ) |  |

Parameters

  lpuartInstance | LPUART Instance
  data | data to send (9-bit)

status_t lpuart_hal_putchar10 | ( | uint32_t | lpuartInstance,
|  | uint16_t | data
| ) |  |

Parameters

  lpuartInstance | LPUART Instance
  data | data to send (10-bit)

Returns
  An error code or kStatus_Success

void lpuart_hal_getchar | ( | uint32_t | lpuartInstance,
|  | uint8_t * | readData
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  readData | data read from receive (8-bit)

void lpuart_hal_getchar9 | ( | uint32_t | lpuartInstance,
|  | uint16_t * | readData
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  readData | data read from receive (9-bit)

status_t lpuart_hal_getchar10 | ( | uint32_t | lpuartInstance,
|  | uint16_t * | readData
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  readData | data read from receive (10-bit)

Returns
  An error code or kStatus_Success

void lpuart_hal_idleconfig | ( | uint32_t | lpuartInstance,
|  | lpuart_idle_config_t | idle_config
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  idle_config | idle characters configuration

lpuart_idle_config_t lpuart_hal_get_idleconfig | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  idle characters configuration

void lpuart_hal_configure_wait_mode_operation | ( | uint32_t | lpuartInstance,
|  | lpuart_operation_config_t | mode
| ) |  |

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

  lpuartInstance | LPUART instance number
  mode | LPUART wait mode operation - operates or stops to operate in wait mode.

lpuart_operation_config_t lpuart_hal_get_wait_mode_operation_config | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  LPUART wait mode operation configuration - kLpuartOperates or KLpuartStops in wait mode

void lpuart_hal_configure_loopback_mode | ( | uint32_t | lpuartInstance,
|  | bool | enable
| ) |  |

Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters

  lpuartInstance | LPUART instance number
  enable | LPUART loopback mode - disabled (0) or enabled (1)

void lpuart_hal_configure_singlewire_mode | ( | uint32_t | lpuartInstance,
|  | bool | enable
| ) |  |

Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters

  lpuartInstance | LPUART instance number
  enable | LPUART loopback mode - disabled (0) or enabled (1)

void lpuart_hal_configure_txdir_in_singlewire_mode | ( | uint32_t | lpuartInstance,
|  | lpuart_singlewire_txdir_t | direction
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  direction | LPUART single-wire transmit direction - input or output

status_t lpuart_hal_put_receiver_in_standby_mode | ( | uint32_t | lpuartInstance | ) |

In some LPUART instances, before placing LPUART in standby mode, first determine whether the receiver is set to wake on idle or whether it is already in idle state. NOTE that the RWU should only be set with C1[WAKE] = 0 (wakeup on idle) if the channel is currently not idle. This can be determined by the S2[RAF] flag. If it is set to wake up an IDLE event and the channel is already idle, it is possible that the LPUART will discard data since data must be received (or a LIN break detect) after an IDLE is detected and before IDLE is allowed to reasserted.

Parameters

  lpuartInstance | LPUART instance number

Returns
  Error code or kStatus_Success

void lpuart_hal_put_receiver_in_normal_mode | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

bool lpuart_hal_is_receiver_in_standby | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  LPUART in normal more (0) or standby (1)

void lpuart_hal_select_receiver_wakeup_method | ( | uint32_t | lpuartInstance,
|  | lpuart_wakeup_method_t | method
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  method | LPUART wakeup method: 0 - Idle-line wake (default), 1 - addr-mark wake

lpuart_wakeup_method_t lpuart_hal_get_receiver_wakeup_method | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  LPUART wakeup method: kLpuartIdleLineWake: 0 - Idle-line wake (default), kLpuartAddrMarkWake: 1 - addr-mark wake

void lpuart_hal_configure_idle_line_detect | ( | uint32_t | lpuartInstance,
|  | 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

  lpuartInstance | LPUART instance number
  config | LPUART configuration data for idle line detect operation

void lpuart_hal_set_break_char_transmit_length | ( | uint32_t | lpuartInstance,
|  | lpuart_break_char_length_t | length
| ) |  |

Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters

  lpuartInstance | LPUART instance number
  length | LPUART break character length setting: 0 - minimum 10-bit times (default), 1 - minimum 13-bit times

void lpuart_hal_set_break_char_detect_length | ( | uint32_t | lpuartInstance,
|  | lpuart_break_char_length_t | length
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  length | LPUART break character length setting: 0 - minimum 10-bit times (default), 1 - minimum 13-bit times

void lpuart_hal_queue_break_char_to_send | ( | uint32_t | lpuartInstance,
|  | bool | enable
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  enable | LPUART normal/queue break char - disabled (normal mode, default: 0) or enabled (queue break char: 1)

status_t lpuart_hal_configure_match_address_operation | ( | uint32_t | lpuartInstance,
|  | bool | matchAddrMode1,
|  | bool | matchAddrMode2,
|  | uint8_t | matchAddrValue1,
|  | uint8_t | matchAddrValue2,
|  | lpuart_match_config_t | config
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  matchAddrMode1 | MAEN1: match address mode1 enable (1)/disable (0)
  matchAddrMode2 | MAEN2: match address mode2 enable (1)/disable (0)
  matchAddrValue1 | MA: match address value to program into match address register 1
  matchAddrValue2 | MA: match address value to program into match address register 2
  config | MATCFG: Configures the match addressing mode used.

Returns
  An error code or kStatus_Success

status_t lpuart_hal_configure_send_msb_first_operation | ( | uint32_t | lpuartInstance,
|  | bool | enable
| ) |  |

Generally, this may be applied to all LPUARTs to ensure safe operation.

Parameters

  lpuartInstance | LPUART instance number
  enable | MSB first mode configuration, MSBF: 0 - LSB (default, feature disabled), 1 - MSB (feature enabled)

Returns
  An error code or kStatus_Success

status_t lpuart_hal_configure_receive_resync_disable_operation | ( | uint32_t | lpuartInstance,
|  | bool | enable
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  enable | disable re-sync of received data word configuration, RESYNCDIS: 0 - re-sync of received data word (default, feature disabled), 1 - disable the re-sync (feature enabled)

Returns
  An error code or kStatus_Success

void lpuart_hal_get_all_status_flag | ( | uint32_t | lpuartInstance,
|  | lpuart_status_t * | allStatusFlag
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  allStatusFlag | Structure of status of all LPUART status flags

bool lpuart_hal_is_transmit_data_register_empty | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of Transmit data register empty flag, sets when transmit buffer is empty

bool lpuart_hal_is_transmission_complete | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of Transmission complete flag, sets when transmitter is idle (transmission activity complete)

bool lpuart_hal_is_receive_data_register_full | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of the receive data register full flag, sets when the receive data buffer is full.

bool lpuart_hal_is_idle_line_detected | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of Idle line detect flag, sets when idle line detected

bool lpuart_hal_is_receive_overrun_detected | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of receiver overrun, sets when new data is received before data is read from receive register

bool lpuart_hal_is_noise_detected | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of noise flag, sets if any of the 3 samples taken on receive differ

bool lpuart_hal_is_frame_error_detected | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of the frame error flag, sets if logic 0 was detected where stop bit expected

bool lpuart_hal_is_parity_error_detected | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of the parity error detection flag, if parity enabled

bool lpuart_hal_is_line_break_detected | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of LIN break detect interrupt flag, sets when LIN break char detected if LIN circuit enabled

bool lpuart_hal_is_receive_active_edge_detected | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of Receive pin active edge interrupt flag, sets when active edge detected

bool lpuart_hal_is_receiver_active | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number

Returns
  Status of Receiver Active Flag (RAF), sets a beginning of valid start bit

status_t lpuart_hal_clear_status_flag | ( | uint32_t | lpuartInstance,
|  | lpuart_status_flag_t | statusFlag
| ) |  |

Parameters

  lpuartInstance | LPUART instance number
  statusFlag | Desired LPUART status flag to clear

Returns
  An error code or kStatus_Success

void lpuart_hal_clear_all_non_autoclear_status_flags | ( | uint32_t | lpuartInstance | ) |

Parameters

  lpuartInstance | LPUART instance number