Go to the documentation of this file.
18 #ifndef FSL_COMPONENT_ID
19 #define FSL_COMPONENT_ID "platform.drivers.lpi2c"
121 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
125 #if defined(LPI2C_PERIPH_CLOCKS)
127 static const clock_ip_name_t kLpi2cPeriphClocks[] = LPI2C_PERIPH_CLOCKS;
184 assert(sourceClock_Hz > 0U);
185 assert(prescaler > 0U);
187 uint32_t busCycle_ns = 1000000U / (sourceClock_Hz / prescaler / 1000U);
188 uint32_t cycles = 0U;
191 while ((((cycles + 1U) * busCycle_ns) < width_ns) && (cycles + 1U < maxCycles))
198 if ((cycles == 0U) && (busCycle_ns <= (width_ns * 10U)))
286 txCount = txFifoSize - txCount;
296 }
while ((0U == txCount) && (0U != --waitTimes));
303 }
while (0U == txCount);
359 (void)memset(masterConfig, 0,
sizeof(*masterConfig));
396 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
402 #if defined(LPI2C_PERIPH_CLOCKS)
482 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
488 #if defined(LPI2C_PERIPH_CLOCKS)
535 uint32_t prescale = 0U;
536 uint32_t bestPre = 0U;
537 uint32_t bestClkHi = 0U;
538 uint32_t absError = 0U;
539 uint32_t bestError = 0xffffffffu;
542 uint32_t computedRate;
552 for (prescale = 1U; prescale <= 128U; prescale = 2U * prescale)
559 for (clkHiCycle = 1U; clkHiCycle < 32U; clkHiCycle++)
561 if (clkHiCycle == 1U)
563 computedRate = (sourceClock_Hz / prescale) / (1U + 3U + 2U + 2U / prescale);
567 computedRate = (sourceClock_Hz / prescale) / (3U * clkHiCycle + 2U + 2U / prescale);
570 absError = baudRate_Hz > computedRate ? baudRate_Hz - computedRate : computedRate - baudRate_Hz;
572 if (absError < bestError)
575 bestClkHi = clkHiCycle;
576 bestError = absError;
602 for (i = 0U; i < 8U; i++)
604 if (bestPre == (1UL << i))
657 base->
MTDR = (uint32_t)
kStartCmd | (((uint32_t)address << 1U) | (uint32_t)dir);
744 assert(
NULL != rxBuff);
763 buf = (uint8_t *)rxBuff;
764 while (0U != (rxSize--))
818 uint8_t *buf = (uint8_t *)txBuff;
820 assert(
NULL != txBuff);
823 while (0U != (txSize--))
857 uint16_t commandBuffer[7];
858 uint32_t cmdCount = 0U;
860 assert(
NULL != transfer);
879 commandBuffer[cmdCount++] =
880 (uint16_t)
kStartCmd | (uint16_t)((uint16_t)((uint16_t)transfer->
slaveAddress << 1U) | (uint16_t)direction);
887 while (0U != subaddressRemaining--)
889 uint8_t subaddressByte = (uint8_t)((transfer->
subaddress >> (8U * subaddressRemaining)) & 0xffU);
890 commandBuffer[cmdCount++] = subaddressByte;
900 commandBuffer[cmdCount++] =
908 while (0U != cmdCount--)
918 base->
MTDR = commandBuffer[index];
972 assert(
NULL != handle);
975 (void)memset(handle, 0,
sizeof(*handle));
1017 bool state_complete =
false;
1043 txCount = txFifoSize - txCount;
1045 while (!state_complete)
1048 switch (handle->
state)
1052 if (0U == txCount--)
1054 state_complete =
true;
1059 sendval = ((uint16_t)(*handle->
buf)) | ((uint16_t)(*(handle->
buf + 1U)) << 8U);
1060 base->
MTDR = sendval;
1072 handle->
buf = (uint8_t *)xfer->
data;
1090 if (0U == txCount--)
1092 state_complete =
true;
1111 if (0U == txCount--)
1113 state_complete =
true;
1118 base->
MTDR = *(handle->
buf)++;
1124 if (0U == rxCount--)
1126 state_complete =
true;
1139 state_complete =
true;
1150 if (0U == txCount--)
1152 state_complete =
true;
1162 state_complete =
true;
1174 state_complete =
true;
1206 handle->
buf = (uint8_t *)xfer->
data;
1212 uint32_t cmdCount = 0U;
1220 (uint16_t)
kStartCmd | (uint16_t)((uint16_t)((uint16_t)xfer->
slaveAddress << 1U) | (uint16_t)direction);
1226 while (0U != (subaddressRemaining--))
1228 uint8_t subaddressByte = (uint8_t)((xfer->
subaddress >> (8U * subaddressRemaining)) & 0xffU);
1229 cmd[cmdCount++] = subaddressByte;
1270 assert(
NULL != handle);
1271 assert(
NULL != transfer);
1321 assert(
NULL != handle);
1336 uint16_t remainingBytes;
1343 state = handle->
state;
1359 *
count = dataSize - remainingBytes;
1410 bool isDone =
false;
1493 (void)memset(slaveConfig, 0,
sizeof(*slaveConfig));
1530 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
1536 #if defined(LPI2C_PERIPH_CLOCKS)
1586 #if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
1593 #if defined(LPI2C_PERIPH_CLOCKS)
1651 uint8_t *buf = (uint8_t *)txBuff;
1652 size_t remaining = txSize;
1654 assert(
NULL != txBuff);
1664 while (0U != remaining)
1677 if (
NULL != actualTxSize)
1679 *actualTxSize = txSize - remaining;
1686 (0U != --waitTimes));
1687 if (0U == waitTimes)
1699 base->
STDR = *buf++;
1713 if (
NULL != actualTxSize)
1715 *actualTxSize = txSize - remaining;
1732 uint8_t *buf = (uint8_t *)rxBuff;
1733 size_t remaining = rxSize;
1735 assert(
NULL != rxBuff);
1745 while (0U != remaining)
1758 if (
NULL != actualRxSize)
1760 *actualRxSize = rxSize - remaining;
1767 (0U != --waitTimes));
1768 if (0U == waitTimes)
1794 if (
NULL != actualRxSize)
1796 *actualRxSize = rxSize - remaining;
1825 assert(
NULL != handle);
1828 (void)memset(handle, 0,
sizeof(*handle));
1879 assert(
NULL != handle);
1929 assert(
NULL != handle);
1959 assert(
NULL != handle);
2115 *xfer->
data++ = (uint8_t)base->
SRDR;
2127 #if !(defined(FSL_FEATURE_I2C_HAS_NO_IRQ) && FSL_FEATURE_I2C_HAS_NO_IRQ)
2159 void LPI2C0_DriverIRQHandler(
void)
2167 void LPI2C1_DriverIRQHandler(
void)
2175 void LPI2C2_DriverIRQHandler(
void)
2183 void LPI2C3_DriverIRQHandler(
void)
2191 void LPI2C4_DriverIRQHandler(
void)
2199 void LPI2C5_DriverIRQHandler(
void)
2207 void LPI2C6_DriverIRQHandler(
void)
2213 #if defined(CM4_0__LPI2C)
2215 void M4_0_LPI2C_DriverIRQHandler(
void)
2221 #if defined(CM4__LPI2C)
2223 void M4_LPI2C_DriverIRQHandler(
void)
2229 #if defined(CM4_1__LPI2C)
2231 void M4_1_LPI2C_DriverIRQHandler(
void)
2237 #if defined(DMA__LPI2C0)
2239 void DMA_I2C0_INT_DriverIRQHandler(
void)
2245 #if defined(DMA__LPI2C1)
2247 void DMA_I2C1_INT_DriverIRQHandler(
void)
2253 #if defined(DMA__LPI2C2)
2255 void DMA_I2C2_INT_DriverIRQHandler(
void)
2261 #if defined(DMA__LPI2C3)
2263 void DMA_I2C3_INT_DriverIRQHandler(
void)
2269 #if defined(DMA__LPI2C4)
2271 void DMA_I2C4_INT_DriverIRQHandler(
void)
2277 #if defined(ADMA__LPI2C0)
2279 void ADMA_I2C0_INT_DriverIRQHandler(
void)
2285 #if defined(ADMA__LPI2C1)
2287 void ADMA_I2C1_INT_DriverIRQHandler(
void)
2293 #if defined(ADMA__LPI2C2)
2295 void ADMA_I2C2_INT_DriverIRQHandler(
void)
2301 #if defined(ADMA__LPI2C3)
2303 void ADMA_I2C3_INT_DriverIRQHandler(
void)
2309 #if defined(ADMA__LPI2C4)
2311 void ADMA_I2C4_INT_DriverIRQHandler(
void)
#define LPI2C_SCR_FILTDZ(x)
#define LPI2C_MCCR0_DATAVD(x)
#define LPI2C_MCFGR1_PRESCALE_MASK
static uint32_t LPI2C_SlaveGetStatusFlags(LPI2C_Type *base)
Gets the LPI2C slave status flags.
struct _lpi2c_master_config::@353 hostRequest
static void LPI2C_InitTransferStateMachine(lpi2c_master_handle_t *handle)
Prepares the transfer state machine and fills in the command buffer.
#define LPI2C_MCFGR0_RDMO_MASK
void LPI2C_MasterGetDefaultConfig(lpi2c_master_config_t *masterConfig)
Provides a default configuration for the LPI2C master peripheral.
@ kStatus_InvalidArgument
@ kWaitForCompletionState
@ kLPI2C_SlaveFifoErrFlag
lpi2c_slave_transfer_t transfer
uint32_t pinLowTimeout_ns
#define LPI2C_SCFGR2_FILTSCL_SHIFT
enum _lpi2c_direction lpi2c_direction_t
Direction of master and slave transfers.
lpi2c_host_request_source_t source
#define LPI2C_MCFGR1_PINCFG(x)
void LPI2C_SlaveDeinit(LPI2C_Type *base)
Deinitializes the LPI2C slave peripheral.
static lpi2c_master_isr_t s_lpi2cMasterIsr
Pointer to master IRQ handler for each instance.
lpi2c_master_pin_config_t pinConfig
#define LPI2C_SCFGR1_RXCFG(x)
lpi2c_slave_address_match_t addressMatchMode
#define LPI2C_MCFGR0_HRSEL_MASK
static void LPI2C_SlaveReset(LPI2C_Type *base)
Performs a software reset of the LPI2C slave peripheral.
#define LPI2C_SCFGR2_DATAVD_SHIFT
#define LPI2C_MCFGR2_FILTSDA_SHIFT
void(* lpi2c_slave_transfer_callback_t)(LPI2C_Type *base, lpi2c_slave_transfer_t *transfer, void *userData)
Slave event callback function pointer type.
static void LPI2C_MasterEnableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Enables the LPI2C master interrupt requests.
#define LPI2C_MRDR_RXEMPTY_MASK
#define LPI2C_MCFGR1_PINCFG_MASK
#define LPI2C_MCFGR1_IGNACK(x)
#define LPI2C_MCFGR1_PRESCALE(x)
#define LPI2C_CLOCKS
Clock ip name array for LPI2C.
@ kLPI2C_SlaveTransmitAckEvent
#define LPI2C_SCFGR1_IGNACK(x)
@ kLPI2C_MasterArbitrationLostFlag
void LPI2C_SlaveTransferHandleIRQ(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Reusable routine to handle slave interrupts.
#define LPI2C_SCFGR1_ADDRCFG(x)
@ kLPI2C_SlaveStopDetectFlag
status_t LPI2C_MasterStart(LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir)
Sends a START signal and slave address on the I2C bus.
#define LPI2C_SCFGR2_DATAVD(x)
#define LPI2C_MCR_DOZEN(x)
status_t LPI2C_MasterReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize)
Performs a polling receive transfer on the I2C bus.
void LPI2C_MasterDeinit(LPI2C_Type *base)
Deinitializes the LPI2C master peripheral.
status_t LPI2C_CheckForBusyBus(LPI2C_Type *base)
Make sure the bus isn't already busy.
@ kStatus_NoTransferInProgress
void LPI2C_MasterTransferCreateHandle(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
Creates a new handle for the LPI2C master non-blocking APIs.
#define LPI2C_MCFGR0_HRPOL(x)
#define LPI2C_SCFGR1_ACKSTALL(x)
#define LPI2C_SCFGR2_CLKHOLD(x)
static status_t LPI2C_RunTransferStateMachine(LPI2C_Type *base, lpi2c_master_handle_t *handle, bool *isDone)
Execute states until FIFOs are exhausted.
uint8_t sclGlitchFilterWidth_ns
#define LPI2C_MCFGR2_BUSIDLE_MASK
@ kLPI2C_SlaveRepeatedStartDetectFlag
#define LPI2C_SCFGR1_GCEN(x)
@ kLPI2C_SlaveRepeatedStartEvent
@ kLPI2C_MasterPinLowTimeoutFlag
@ kStatus_LPI2C_FifoError
#define LPI2C_STAR_TXNACK_MASK
#define LPI2C_MCR_DBGEN(x)
void LPI2C_SlaveGetDefaultConfig(lpi2c_slave_config_t *slaveConfig)
Provides a default configuration for the LPI2C slave peripheral.
#define LPI2C_SAMR_ADDR0(x)
#define LPI2C_MCFGR2_BUSIDLE(x)
uint32_t dataValidDelay_ns
uint8_t sdaGlitchFilterWidth_ns
void LPI2C_MasterSetBaudRate(LPI2C_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Hz)
Sets the I2C bus frequency for master transactions.
Structure with settings to initialize the LPI2C master module.
@ kLPI2C_MasterFifoErrFlag
#define LPI2C_MCFGR0_RDMO(x)
@ kLPI2C_MasterNackDetectFlag
@ kLPI2C_MasterDataMatchFlag
@ kLPI2C_SlaveRxReadyFlag
@ kLPI2C_SlaveTransmitAckFlag
lpi2c_master_transfer_t transfer
#define LPI2C_MCFGR0_HRSEL(x)
#define I2C_RETRY_TIMES
Retry times for waiting flag.
@ kStatus_LPI2C_ArbitrationLost
#define LPI2C_SCFGR2_FILTSCL_MASK
@ kLPI2C_MasterBusBusyFlag
#define LPI2C_MDMR_MATCH0(x)
static lpi2c_slave_handle_t * s_lpi2cSlaveHandle[ARRAY_SIZE(kLpi2cBases)]
Pointers to slave handles for each instance.
Driver handle for master non-blocking APIs.
#define FSL_FEATURE_LPI2C_FIFO_SIZEn(x)
#define LPI2C_MCFGR3_PINLOW(x)
#define LPI2C_MCFGR3_PINLOW_MASK
status_t LPI2C_MasterCheckAndClearError(LPI2C_Type *base, uint32_t status)
Convert provided flags to status code, and clear any errors if present.
static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t maxCycles, uint32_t prescaler)
Computes a cycle count for a given time in nanoseconds.
uint32_t transferredCount
#define LPI2C_SCFGR2_CLKHOLD_SHIFT
#define LPI2C_MCFGR1_MATCFG_MASK
#define LPI2C_MTDR_CMD(x)
#define LPI2C_MCR_MEN_MASK
@ kLPI2C_SlaveCompletionEvent
@ kLPI2C_SlaveAddressValidFlag
status_t LPI2C_SlaveReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize, size_t *actualRxSize)
Performs a polling receive transfer on the I2C bus.
static LPI2C_Type *const kLpi2cBases[]
Array to map LPI2C instance number to base pointer.
#define LPI2C_MCFGR0_HREN_MASK
#define SDK_ISR_EXIT_BARRIER
void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, lpi2c_master_handle_t *handle)
Reusable routine to handle master interrupts.
#define LPI2C_MCFGR1_MATCFG(x)
@ kLPI2C_MasterRxReadyFlag
@ kLPI2C_TransferNoStartFlag
#define LPI2C_SAMR_ADDR1(x)
#define ARRAY_SIZE(x)
Computes the number of elements in an array.
void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData)
Creates a new handle for the LPI2C slave non-blocking APIs.
static const clock_ip_name_t kLpi2cClocks[]
Array to map LPI2C instance number to clock gate enum.
@ kLPI2C_MasterStopDetectFlag
uint32_t sclGlitchFilterWidth_ns
static void LPI2C_MasterClearStatusFlags(LPI2C_Type *base, uint32_t statusMask)
Clears the LPI2C master status flag state.
#define LPI2C_MCFGR2_FILTSCL_MASK
IRQn_Type
STM32F4XX Interrupt Number Definition, according to the selected device in Library_configuration_sect...
#define LPI2C_SCFGR1_TXDSTALL(x)
@ kLPI2C_HostRequestExternalPin
#define LPI2C_MCFGR2_BUSIDLE_SHIFT
lpi2c_master_transfer_callback_t completionCallback
lpi2c_direction_t direction
@ kLPI2C_SlaveReceiveEvent
void LPI2C_SlaveInit(LPI2C_Type *base, const lpi2c_slave_config_t *slaveConfig, uint32_t sourceClock_Hz)
Initializes the LPI2C slave peripheral.
#define LPI2C_MCFGR1_AUTOSTOP_MASK
static void LPI2C_SlaveEnableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Enables the LPI2C slave interrupt requests.
#define LPI2C_MDMR_MATCH1(x)
#define LPI2C_SRDR_DATA_MASK
static status_t LPI2C_SlaveCheckAndClearError(LPI2C_Type *base, uint32_t flags)
Convert provided flags to status code, and clear any errors if present.
#define LPI2C_MCFGR0_HRPOL_MASK
uint32_t busIdleTimeout_ns
#define LPI2C_SCFGR2_CLKHOLD_MASK
#define LPI2C_MRDR_DATA_MASK
#define LPI2C_MCR_RRF_MASK
static uint32_t LPI2C_MasterGetEnabledInterrupts(LPI2C_Type *base)
Returns the set of currently enabled LPI2C master interrupt requests.
#define LPI2C_MCFGR2_FILTSCL_SHIFT
@ kLPI2C_MasterTxReadyFlag
static void CLOCK_EnableClock(clock_ip_name_t name)
Enable the clock for specific IP.
uint32_t clockHoldTime_ns
LPI2C slave handle structure.
Structure with settings to initialize the LPI2C slave module.
static void LPI2C_MasterSetWatermarks(LPI2C_Type *base, size_t txWords, size_t rxWords)
Sets the watermarks for LPI2C master FIFOs.
#define LPI2C_SCR_SEN_MASK
static void LPI2C_MasterReset(LPI2C_Type *base)
Performs a software reset.
#define LPI2C_SCR_FILTEN(x)
struct _lpi2c_slave_config::@354 sclStall
#define LPI2C_SCFGR2_FILTSDA(x)
uint32_t LPI2C_GetInstance(LPI2C_Type *base)
Returns an instance number given a base address.
@ kLPI2C_HostRequestPinActiveHigh
static lpi2c_master_handle_t * s_lpi2cMasterHandle[ARRAY_SIZE(kLpi2cBases)]
Pointers to master handles for each instance.
static void LPI2C_MasterGetFifoCounts(LPI2C_Type *base, size_t *rxCount, size_t *txCount)
Gets the current number of words in the LPI2C master FIFOs.
static void LPI2C_SlaveClearStatusFlags(LPI2C_Type *base, uint32_t statusMask)
Clears the LPI2C status flag state.
@ kLPI2C_SlaveBusBusyFlag
lpi2c_host_request_polarity_t polarity
status_t LPI2C_MasterTransferNonBlocking(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_t *transfer)
Performs a non-blocking transaction on the I2C bus.
#define LPI2C_SCFGR1_RXSTALL(x)
#define LPI2C_MCFGR2_FILTSDA(x)
status_t LPI2C_MasterTransferGetCount(LPI2C_Type *base, lpi2c_master_handle_t *handle, size_t *count)
Returns number of bytes transferred so far.
static status_t LPI2C_MasterWaitForTxReady(LPI2C_Type *base)
Wait until there is room in the tx fifo.
LPI2C master data match configuration structure.
status_t LPI2C_MasterSend(LPI2C_Type *base, void *txBuff, size_t txSize)
Performs a polling send transfer on the I2C bus.
status_t LPI2C_SlaveSend(LPI2C_Type *base, void *txBuff, size_t txSize, size_t *actualTxSize)
Performs a polling send transfer on the I2C bus.
static status_t EnableIRQ(IRQn_Type interrupt)
Enable specific interrupt.
static void LPI2C_MasterDisableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Disables the LPI2C master interrupt requests.
#define LPI2C_MCR_MEN_SHIFT
@ kLPI2C_SlaveTransmitEvent
status_t LPI2C_SlaveTransferGetCount(LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count)
Gets the slave transfer status during a non-blocking transfer.
bool enableReceivedAddressRead
static lpi2c_slave_isr_t s_lpi2cSlaveIsr
Pointer to slave IRQ handler for each instance.
static void CLOCK_DisableClock(clock_ip_name_t name)
Disable the clock for specific IP.
#define LPI2C_MTDR_DATA(x)
@ kLPI2C_SlaveTxReadyFlag
#define LPI2C_MCFGR1_IGNACK_MASK
void LPI2C_MasterConfigureDataMatch(LPI2C_Type *base, const lpi2c_data_match_config_t *config)
Configures LPI2C master data match feature.
status_t LPI2C_MasterStop(LPI2C_Type *base)
Sends a STOP signal on the I2C bus.
status_t completionStatus
#define LPI2C_MCFGR2_FILTSDA_MASK
#define LPI2C_MCFGR0_HREN(x)
uint16_t commandBuffer[7]
#define LPI2C_SASR_RADDR_MASK
void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle)
Terminates a non-blocking LPI2C master transmission early.
#define LPI2C_SCFGR2_FILTSDA_SHIFT
void(* lpi2c_slave_isr_t)(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Typedef for slave interrupt handler.
static void LPI2C_CommonIRQHandler(LPI2C_Type *base, uint32_t instance)
Shared IRQ handler that can call both master and slave ISRs.
@ kLPI2C_TransferNoStopFlag
lpi2c_slave_transfer_event_t event
status_t LPI2C_MasterTransferBlocking(LPI2C_Type *base, lpi2c_master_transfer_t *transfer)
Performs a master polling transfer on the I2C bus.
static sai_transceiver_t config
#define LPI2C_MCFGR2_FILTSCL(x)
@ kLPI2C_MasterEndOfPacketFlag
static void LPI2C_SlaveDisableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
Disables the LPI2C slave interrupt requests.
enum _clock_ip_name clock_ip_name_t
CCM CCGR gate control for each module independently.
#define LPI2C_SCFGR1_ADRSTALL(x)
#define LPI2C_MCCR0_CLKHI(x)
static const IRQn_Type kLpi2cIrqs[]
Array to map LPI2C instance number to IRQ number.
#define LPI2C_MCR_RTF_MASK
void LPI2C_MasterInit(LPI2C_Type *base, const lpi2c_master_config_t *masterConfig, uint32_t sourceClock_Hz)
Initializes the LPI2C master peripheral.
LPI2C slave transfer structure.
static void LPI2C_MasterEnable(LPI2C_Type *base, bool enable)
Enables or disables the LPI2C module as master.
#define LPI2C_SCFGR2_FILTSDA_MASK
int32_t status_t
Type used for all status and error return values.
#define LPI2C_MCCR0_SETHOLD(x)
void(* lpi2c_master_transfer_callback_t)(LPI2C_Type *base, lpi2c_master_handle_t *handle, status_t completionStatus, void *userData)
Master completion callback function pointer type.
static uint32_t LPI2C_MasterGetStatusFlags(LPI2C_Type *base)
Gets the LPI2C master status flags.
@ kLPI2C_SlaveAddressMatchEvent
lpi2c_slave_transfer_callback_t callback
@ kStatus_LPI2C_PinLowTimeout
#define LPI2C_MCCR0_CLKLO(x)
void LPI2C_SlaveTransferAbort(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Aborts the slave non-blocking transfers.
Non-blocking transfer descriptor structure.
uint32_t sdaGlitchFilterWidth_ns
status_t LPI2C_SlaveTransferNonBlocking(LPI2C_Type *base, lpi2c_slave_handle_t *handle, uint32_t eventMask)
Starts accepting slave transfers.
#define LPI2C_MCFGR1_PRESCALE_SHIFT
#define LPI2C_SCFGR2_DATAVD_MASK
void(* lpi2c_master_isr_t)(LPI2C_Type *base, lpi2c_master_handle_t *handle)
Typedef for master interrupt handler.
#define LPI2C_SCFGR2_FILTSCL(x)