Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
fsl_lpsci_hal.h File Reference
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include "fsl_device_registers.h"

Macros

#define LPSCI_SHIFT   (8U)
 

Enumerations

enum  lpsci_status_t {
  kStatus_LPSCI_Success = 0x00U,
  kStatus_LPSCI_Fail = 0x01U,
  kStatus_LPSCI_BaudRateCalculationError = 0x02U,
  kStatus_LPSCI_RxStandbyModeError = 0x03U,
  kStatus_LPSCI_ClearStatusFlagError = 0x04U,
  kStatus_LPSCI_TxNotDisabled = 0x05U,
  kStatus_LPSCI_RxNotDisabled = 0x06U,
  kStatus_LPSCI_TxOrRxNotDisabled = 0x07U,
  kStatus_LPSCI_TxBusy = 0x08U,
  kStatus_LPSCI_RxBusy = 0x09U,
  kStatus_LPSCI_NoTransmitInProgress = 0x0AU,
  kStatus_LPSCI_NoReceiveInProgress = 0x0BU,
  kStatus_LPSCI_Timeout = 0x0CU,
  kStatus_LPSCI_Initialized = 0x0DU,
  kStatus_LPSCI_NoDataToDeal = 0x0EU,
  kStatus_LPSCI_RxOverRun = 0x0FU
}
 Error codes for the LPSCI driver. More...
 
enum  lpsci_stop_bit_count_t {
  kLpsciOneStopBit = 0U,
  kLpsciTwoStopBit = 1U
}
 LPSCI number of stop bits. More...
 
enum  lpsci_parity_mode_t {
  kLpsciParityDisabled = 0x0U,
  kLpsciParityEven = 0x2U,
  kLpsciParityOdd = 0x3U
}
 LPSCI parity mode. More...
 
enum  lpsci_bit_count_per_char_t {
  kLpsci8BitsPerChar = 0U,
  kLpsci9BitsPerChar = 1U
}
 LPSCI number of bits in a character. More...
 
enum  lpsci_operation_config_t {
  kLpsciOperates = 0U,
  kLpsciStops = 1U
}
 LPSCI operation configuration constants. More...
 
enum  lpsci_receiver_source_t {
  kLpsciLoopBack = 0U,
  kLpsciSingleWire = 1U
}
 LPSCI receiver source select mode. More...
 
enum  lpsci_wakeup_method_t {
  kLpsciIdleLineWake = 0U,
  kLpsciAddrMarkWake = 1U
}
 LPSCI wakeup from standby method constants. More...
 
enum  lpsci_idle_line_select_t {
  kLpsciIdleLineAfterStartBit = 0U,
  kLpsciIdleLineAfterStopBit = 1U
}
 LPSCI idle-line detect selection types. More...
 
enum  lpsci_break_char_length_t {
  kLpsciBreakChar10BitMinimum = 0U,
  kLpsciBreakChar13BitMinimum = 1U
}
 LPSCI break character length settings for transmit/detect. More...
 
enum  lpsci_singlewire_txdir_t {
  kLpsciSinglewireTxdirIn = 0U,
  kLpsciSinglewireTxdirOut = 1U
}
 LPSCI single-wire mode transmit direction. More...
 
enum  lpsci_ir_tx_pulsewidth_t {
  kLpsciIrThreeSixteenthsWidth = 0U,
  kLpsciIrOneSixteenthWidth = 1U,
  kLpsciIrOneThirtysecondsWidth = 2U,
  kLpsciIrOneFourthWidth = 3U
}
 LPSCI infrared transmitter pulse width options. More...
 
enum  lpsci_status_flag_t {
  kLpsciTxDataRegEmpty = 0U << LPSCI_SHIFT | UART0_S1_TDRE_SHIFT,
  kLpsciTxComplete = 0U << LPSCI_SHIFT | UART0_S1_TC_SHIFT,
  kLpsciRxDataRegFull = 0U << LPSCI_SHIFT | UART0_S1_RDRF_SHIFT,
  kLpsciIdleLineDetect = 0U << LPSCI_SHIFT | UART0_S1_IDLE_SHIFT,
  kLpsciRxOverrun = 0U << LPSCI_SHIFT | UART0_S1_OR_SHIFT,
  kLpsciNoiseDetect = 0U << LPSCI_SHIFT | UART0_S1_NF_SHIFT,
  kLpsciFrameErr = 0U << LPSCI_SHIFT | UART0_S1_FE_SHIFT,
  kLpsciParityErr = 0U << LPSCI_SHIFT | UART0_S1_PF_SHIFT,
  kLpsciLineBreakDetect = 1U << LPSCI_SHIFT | UART0_S2_LBKDIF_SHIFT,
  kLpsciRxActiveEdgeDetect = 1U << LPSCI_SHIFT | UART0_S2_RXEDGIF_SHIFT,
  kLpsciRxActive = 1U << LPSCI_SHIFT | UART0_S2_RAF_SHIFT
}
 LPSCI status flags. More...
 
enum  lpsci_interrupt_t {
  kLpsciIntLinBreakDetect = 0U << LPSCI_SHIFT | UART0_BDH_LBKDIE_SHIFT,
  kLpsciIntRxActiveEdge = 0U << LPSCI_SHIFT | UART0_BDH_RXEDGIE_SHIFT,
  kLpsciIntTxDataRegEmpty = 1U << LPSCI_SHIFT | UART0_C2_TIE_SHIFT,
  kLpsciIntTxComplete = 1U << LPSCI_SHIFT | UART0_C2_TCIE_SHIFT,
  kLpsciIntRxDataRegFull = 1U << LPSCI_SHIFT | UART0_C2_RIE_SHIFT,
  kLpsciIntIdleLine = 1U << LPSCI_SHIFT | UART0_C2_ILIE_SHIFT,
  kLpsciIntRxOverrun = 2U << LPSCI_SHIFT | UART0_C3_ORIE_SHIFT,
  kLpsciIntNoiseErrFlag = 2U << LPSCI_SHIFT | UART0_C3_NEIE_SHIFT,
  kLpsciIntFrameErrFlag = 2U << LPSCI_SHIFT | UART0_C3_FEIE_SHIFT,
  kLpsciIntParityErrFlag = 2U << LPSCI_SHIFT | UART0_C3_PEIE_SHIFT
}
 LPSCI interrupt configuration structure; default settings are 0 (disabled). More...
 

Functions

LPSCI Common Configurations
void LPSCI_HAL_Init (UART0_Type *base)
 Initializes the LPSCI controller. More...
 
static void LPSCI_HAL_EnableTransmitter (UART0_Type *base)
 Enables the LPSCI transmitter. More...
 
static void LPSCI_HAL_DisableTransmitter (UART0_Type *base)
 Disables the LPSCI transmitter. More...
 
static bool LPSCI_HAL_IsTransmitterEnabled (UART0_Type *base)
 Gets the LPSCI transmitter enabled/disabled configuration setting. More...
 
static void LPSCI_HAL_EnableReceiver (UART0_Type *base)
 Enables the LPSCI receiver. More...
 
static void LPSCI_HAL_DisableReceiver (UART0_Type *base)
 Disables the LPSCI receiver. More...
 
static bool LPSCI_HAL_IsReceiverEnabled (UART0_Type *base)
 Gets the LPSCI receiver enabled/disabled configuration setting. More...
 
lpsci_status_t LPSCI_HAL_SetBaudRate (UART0_Type *base, uint32_t sourceClockInHz, uint32_t baudRate)
 Configures the LPSCI baud rate. More...
 
void LPSCI_HAL_SetBaudRateDivisor (UART0_Type *base, uint16_t baudRateDivisor)
 Sets the LPSCI baud rate modulo divisor value. More...
 
static void LPSCI_HAL_SetBitCountPerChar (UART0_Type *base, lpsci_bit_count_per_char_t bitCountPerChar)
 Configures the number of bits per character in the LPSCI controller. More...
 
void LPSCI_HAL_SetParityMode (UART0_Type *base, lpsci_parity_mode_t parityMode)
 Configures the parity mode in the LPSCI controller. More...
 
LPSCI Interrupts and DMA
void LPSCI_HAL_SetIntMode (UART0_Type *base, lpsci_interrupt_t interrupt, bool enable)
 Configures the LPSCI module interrupts to enable/disable various interrupt sources. More...
 
bool LPSCI_HAL_GetIntMode (UART0_Type *base, lpsci_interrupt_t interrupt)
 Returns whether the LPSCI module interrupts are enabled/disabled. More...
 
static uint32_t LPSCI_HAL_GetDataRegAddr (UART0_Type *base)
 Gets the LPSCI transmit/receive data register address. More...
 
LPSCI Transfer Functions
static void LPSCI_HAL_Putchar (UART0_Type *base, uint8_t data)
 This function allows the user to send an 8-bit character from the LPSCI data register. More...
 
void LPSCI_HAL_Putchar9 (UART0_Type *base, uint16_t data)
 This function allows the user to send a 9-bit character from the LPSCI data register. More...
 
void LPSCI_HAL_Putchar10 (UART0_Type *base, uint16_t data)
 This function allows the user to send a 10-bit character from the LPSCI data register. More...
 
static void LPSCI_HAL_Getchar (UART0_Type *base, uint8_t *readData)
 This function gets a received 8-bit character from the LPSCI data register. More...
 
void LPSCI_HAL_Getchar9 (UART0_Type *base, uint16_t *readData)
 This function gets a received 9-bit character from the LPSCI data register. More...
 
void LPSCI_HAL_Getchar10 (UART0_Type *base, uint16_t *readData)
 This function gets a received 10-bit character from the LPSCI data register. More...
 
void LPSCI_HAL_SendDataPolling (UART0_Type *base, const uint8_t *txBuff, uint32_t txSize)
 Sends out multiple bytes of data using the polling method. More...
 
lpsci_status_t LPSCI_HAL_ReceiveDataPolling (UART0_Type *base, uint8_t *rxBuff, uint32_t rxSize)
 Receives multiple bytes of data using the polling method. More...
 
LPSCI Status Flags
bool LPSCI_HAL_GetStatusFlag (UART0_Type *base, lpsci_status_flag_t statusFlag)
 Gets all LPSCI status flag states. More...
 
lpsci_status_t LPSCI_HAL_ClearStatusFlag (UART0_Type *base, lpsci_status_flag_t statusFlag)
 Clears an individual and specific LPSCI status flag. More...
 
LPSCI Special Feature Configurations
static void LPSCI_HAL_SetWaitModeOperation (UART0_Type *base, lpsci_operation_config_t mode)
 Configures the LPSCI to either operate or cease to operate in wait mode. More...
 
static lpsci_operation_config_t LPSCI_HAL_GetWaitModeOperation (UART0_Type *base)
 Determines if the LPSCI operates or ceases to operate in wait mode. More...
 
static void LPSCI_HAL_SetLoopCmd (UART0_Type *base, bool enable)
 Configures the LPSCI loopback operation. More...
 
static void LPSCI_HAL_SetReceiverSource (UART0_Type *base, lpsci_receiver_source_t source)
 Configures the LPSCI single-wire operation. More...
 
static void LPSCI_HAL_SetTransmitterDir (UART0_Type *base, lpsci_singlewire_txdir_t direction)
 Configures the LPSCI transmit direction while in single-wire mode. More...
 
lpsci_status_t LPSCI_HAL_PutReceiverInStandbyMode (UART0_Type *base)
 Places the LPSCI receiver in standby mode. More...
 
static void LPSCI_HAL_PutReceiverInNormalMode (UART0_Type *base)
 Places the LPSCI receiver in normal mode (disable standby mode operation). More...
 
static bool LPSCI_HAL_IsReceiverInStandby (UART0_Type *base)
 Determines if the LPSCI receiver is currently in standby mode. More...
 
static void LPSCI_HAL_SetReceiverWakeupMethod (UART0_Type *base, lpsci_wakeup_method_t method)
 Selects the LPSCI receiver wakeup method (idle-line or address-mark) from standby mode. More...
 
static lpsci_wakeup_method_t LPSCI_HAL_GetReceiverWakeupMethod (UART0_Type *base)
 Gets the LPSCI receiver wakeup method (idle-line or address-mark) from standby mode. More...
 
void LPSCI_HAL_ConfigIdleLineDetect (UART0_Type *base, uint8_t idleLine, uint8_t rxWakeIdleDetect)
 Configures the operation options of the LPSCI idle line detect. More...
 
static void LPSCI_HAL_SetBreakCharTransmitLength (UART0_Type *base, lpsci_break_char_length_t length)
 Configures the LPSCI break character transmit length. More...
 
static void LPSCI_HAL_SetBreakCharDetectLength (UART0_Type *base, lpsci_break_char_length_t length)
 Configures the LPSCI break character detect length. More...
 
static void LPSCI_HAL_SetBreakCharCmd (UART0_Type *base, bool enable)
 Configures the LPSCI transmit send break character operation. More...
 
void LPSCI_HAL_SetMatchAddress (UART0_Type *base, bool matchAddrMode1, bool matchAddrMode2, uint8_t matchAddrValue1, uint8_t matchAddrValue2)
 Configures the LPSCI match address mode control operation. More...