fsl_i2c.h
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FSL_I2C_H_
#define _FSL_I2C_H_
#include "fsl_common.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define FSL_I2C_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
#if (defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT || \
defined(FSL_FEATURE_I2C_HAS_STOP_DETECT) && FSL_FEATURE_I2C_HAS_STOP_DETECT)
#define I2C_HAS_STOP_DETECT
#endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT / FSL_FEATURE_I2C_HAS_STOP_DETECT */
enum _i2c_status
{
kStatus_I2C_Busy = MAKE_STATUS(kStatusGroup_I2C, 0),
kStatus_I2C_Idle = MAKE_STATUS(kStatusGroup_I2C, 1),
kStatus_I2C_Nak = MAKE_STATUS(kStatusGroup_I2C, 2),
kStatus_I2C_ArbitrationLost = MAKE_STATUS(kStatusGroup_I2C, 3),
kStatus_I2C_Timeout = MAKE_STATUS(kStatusGroup_I2C, 4),
};
enum _i2c_flags
{
kI2C_ReceiveNakFlag = I2C_S_RXAK_MASK,
kI2C_IntPendingFlag = I2C_S_IICIF_MASK,
kI2C_TransferDirectionFlag = I2C_S_SRW_MASK,
kI2C_RangeAddressMatchFlag = I2C_S_RAM_MASK,
kI2C_ArbitrationLostFlag = I2C_S_ARBL_MASK,
kI2C_BusBusyFlag = I2C_S_BUSY_MASK,
kI2C_AddressMatchFlag = I2C_S_IAAS_MASK,
kI2C_TransferCompleteFlag = I2C_S_TCF_MASK,
#ifdef I2C_HAS_STOP_DETECT
kI2C_StopDetectFlag = I2C_FLT_STOPF_MASK << 8,
#endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT / FSL_FEATURE_I2C_HAS_STOP_DETECT */
#if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
kI2C_StartDetectFlag = I2C_FLT_STARTF_MASK << 8,
#endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT */
};
enum _i2c_interrupt_enable
{
kI2C_GlobalInterruptEnable = I2C_C1_IICIE_MASK,
#if defined(FSL_FEATURE_I2C_HAS_STOP_DETECT) && FSL_FEATURE_I2C_HAS_STOP_DETECT
kI2C_StopDetectInterruptEnable = I2C_FLT_STOPIE_MASK,
#endif /* FSL_FEATURE_I2C_HAS_STOP_DETECT */
#if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
kI2C_StartStopDetectInterruptEnable = I2C_FLT_SSIE_MASK,
#endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT */
};
typedef enum _i2c_direction
{
kI2C_Write = 0x0U,
kI2C_Read = 0x1U,
} i2c_direction_t;
typedef enum _i2c_slave_address_mode
{
kI2C_Address7bit = 0x0U,
kI2C_RangeMatch = 0X2U,
} i2c_slave_address_mode_t;
enum _i2c_master_transfer_flags
{
kI2C_TransferDefaultFlag = 0x0U,
kI2C_TransferNoStartFlag = 0x1U,
kI2C_TransferRepeatedStartFlag = 0x2U,
kI2C_TransferNoStopFlag = 0x4U,
};
typedef enum _i2c_slave_transfer_event
{
kI2C_SlaveAddressMatchEvent = 0x01U,
kI2C_SlaveTransmitEvent = 0x02U,
kI2C_SlaveReceiveEvent = 0x04U,
kI2C_SlaveTransmitAckEvent = 0x08U,
#if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
kI2C_SlaveRepeatedStartEvent = 0x10U,
#endif
kI2C_SlaveCompletionEvent = 0x20U,
kI2C_SlaveAllEvents = kI2C_SlaveAddressMatchEvent | kI2C_SlaveTransmitEvent | kI2C_SlaveReceiveEvent |
#if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
kI2C_SlaveRepeatedStartEvent |
#endif
kI2C_SlaveCompletionEvent,
} i2c_slave_transfer_event_t;
typedef struct _i2c_master_config
{
bool enableMaster;
#if defined(FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION) && FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION
bool enableHighDrive;
#endif
#if defined(FSL_FEATURE_I2C_HAS_STOP_HOLD_OFF) && FSL_FEATURE_I2C_HAS_STOP_HOLD_OFF
bool enableStopHold;
#endif
uint32_t baudRate_Bps;
uint8_t glitchFilterWidth;
} i2c_master_config_t;
typedef struct _i2c_slave_config
{
bool enableSlave;
bool enableGeneralCall;
bool enableWakeUp;
#if defined(FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION) && FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION
bool enableHighDrive;
#endif
bool enableBaudRateCtl;
uint16_t slaveAddress;
uint16_t upperAddress;
i2c_slave_address_mode_t addressingMode;
} i2c_slave_config_t;
typedef struct _i2c_master_handle i2c_master_handle_t;
typedef void (*i2c_master_transfer_callback_t)(I2C_Type *base,
i2c_master_handle_t *handle,
status_t status,
void *userData);
typedef struct _i2c_slave_handle i2c_slave_handle_t;
typedef struct _i2c_master_transfer
{
uint32_t flags;
uint8_t slaveAddress;
i2c_direction_t direction;
uint32_t subaddress;
uint8_t subaddressSize;
uint8_t *volatile data;
volatile size_t dataSize;
} i2c_master_transfer_t;
struct _i2c_master_handle
{
i2c_master_transfer_t transfer;
size_t transferSize;
uint8_t state;
i2c_master_transfer_callback_t completionCallback;
void *userData;
};
typedef struct _i2c_slave_transfer
{
i2c_slave_transfer_event_t event;
uint8_t *volatile data;
volatile size_t dataSize;
status_t completionStatus;
size_t transferredCount;
} i2c_slave_transfer_t;
typedef void (*i2c_slave_transfer_callback_t)(I2C_Type *base, i2c_slave_transfer_t *xfer, void *userData);
struct _i2c_slave_handle
{
bool isBusy;
i2c_slave_transfer_t transfer;
uint32_t eventMask;
i2c_slave_transfer_callback_t callback;
void *userData;
};
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif /*_cplusplus. */
void I2C_MasterInit(I2C_Type *base, const i2c_master_config_t *masterConfig, uint32_t srcClock_Hz);
void I2C_SlaveInit(I2C_Type *base, const i2c_slave_config_t *slaveConfig);
void I2C_MasterDeinit(I2C_Type *base);
void I2C_SlaveDeinit(I2C_Type *base);
void I2C_MasterGetDefaultConfig(i2c_master_config_t *masterConfig);
void I2C_SlaveGetDefaultConfig(i2c_slave_config_t *slaveConfig);
static inline void I2C_Enable(I2C_Type *base, bool enable)
{
if (enable)
{
base->C1 |= I2C_C1_IICEN_MASK;
}
else
{
base->C1 &= ~I2C_C1_IICEN_MASK;
}
}
/* @} */
uint32_t I2C_MasterGetStatusFlags(I2C_Type *base);
static inline uint32_t I2C_SlaveGetStatusFlags(I2C_Type *base)
{
return I2C_MasterGetStatusFlags(base);
}
static inline void I2C_MasterClearStatusFlags(I2C_Type *base, uint32_t statusMask)
{
/* Must clear the STARTF / STOPF bits prior to clearing IICIF */
#if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
if (statusMask & kI2C_StartDetectFlag)
{
/* Shift the odd-ball flags back into place. */
base->FLT |= (uint8_t)(statusMask >> 8U);
}
#endif
#ifdef I2C_HAS_STOP_DETECT
if (statusMask & kI2C_StopDetectFlag)
{
/* Shift the odd-ball flags back into place. */
base->FLT |= (uint8_t)(statusMask >> 8U);
}
#endif
base->S = (uint8_t)statusMask;
}
static inline void I2C_SlaveClearStatusFlags(I2C_Type *base, uint32_t statusMask)
{
I2C_MasterClearStatusFlags(base, statusMask);
}
/* @} */
void I2C_EnableInterrupts(I2C_Type *base, uint32_t mask);
void I2C_DisableInterrupts(I2C_Type *base, uint32_t mask);
#if defined(FSL_FEATURE_I2C_HAS_DMA_SUPPORT) && FSL_FEATURE_I2C_HAS_DMA_SUPPORT
static inline void I2C_EnableDMA(I2C_Type *base, bool enable)
{
if (enable)
{
base->C1 |= I2C_C1_DMAEN_MASK;
}
else
{
base->C1 &= ~I2C_C1_DMAEN_MASK;
}
}
#endif /* FSL_FEATURE_I2C_HAS_DMA_SUPPORT */
static inline uint32_t I2C_GetDataRegAddr(I2C_Type *base)
{
return (uint32_t)(&(base->D));
}
/* @} */
void I2C_MasterSetBaudRate(I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz);
status_t I2C_MasterStart(I2C_Type *base, uint8_t address, i2c_direction_t direction);
status_t I2C_MasterStop(I2C_Type *base);
status_t I2C_MasterRepeatedStart(I2C_Type *base, uint8_t address, i2c_direction_t direction);
status_t I2C_MasterWriteBlocking(I2C_Type *base, const uint8_t *txBuff, size_t txSize);
status_t I2C_MasterReadBlocking(I2C_Type *base, uint8_t *rxBuff, size_t rxSize);
status_t I2C_SlaveWriteBlocking(I2C_Type *base, const uint8_t *txBuff, size_t txSize);
void I2C_SlaveReadBlocking(I2C_Type *base, uint8_t *rxBuff, size_t rxSize);
status_t I2C_MasterTransferBlocking(I2C_Type *base, i2c_master_transfer_t *xfer);
/* @} */
void I2C_MasterTransferCreateHandle(I2C_Type *base,
i2c_master_handle_t *handle,
i2c_master_transfer_callback_t callback,
void *userData);
status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer);
status_t I2C_MasterTransferGetCount(I2C_Type *base, i2c_master_handle_t *handle, size_t *count);
void I2C_MasterTransferAbort(I2C_Type *base, i2c_master_handle_t *handle);
void I2C_MasterTransferHandleIRQ(I2C_Type *base, void *i2cHandle);
void I2C_SlaveTransferCreateHandle(I2C_Type *base,
i2c_slave_handle_t *handle,
i2c_slave_transfer_callback_t callback,
void *userData);
status_t I2C_SlaveTransferNonBlocking(I2C_Type *base, i2c_slave_handle_t *handle, uint32_t eventMask);
void I2C_SlaveTransferAbort(I2C_Type *base, i2c_slave_handle_t *handle);
status_t I2C_SlaveTransferGetCount(I2C_Type *base, i2c_slave_handle_t *handle, size_t *count);
void I2C_SlaveTransferHandleIRQ(I2C_Type *base, void *i2cHandle);
/* @} */
#if defined(__cplusplus)
}
#endif /*_cplusplus. */
#endif /* _FSL_I2C_H_*/
kI2C_Address7bit
Definition: fsl_i2c.h:117
i2c_master_config_t
I2C master user config.
Definition: fsl_i2c.h:162
I2C_MasterReadBlocking
status_t I2C_MasterReadBlocking(I2C_Type *base, uint8_t *rxBuff, size_t rxSize)
Performs a polling receive transaction on the I2C bus with a STOP signal.
Definition: fsl_i2c.c:747
I2C_MasterTransferBlocking
status_t I2C_MasterTransferBlocking(I2C_Type *base, i2c_master_transfer_t *xfer)
Performs a master polling transfer on the I2C bus.
Definition: fsl_i2c.c:806
kI2C_IntPendingFlag
Definition: fsl_i2c.h:77
_i2c_slave_handle::transfer
i2c_slave_transfer_t transfer
Definition: fsl_i2c.h:242
I2C_SlaveTransferNonBlocking
status_t I2C_SlaveTransferNonBlocking(I2C_Type *base, i2c_slave_handle_t *handle, uint32_t eventMask)
Start accepting slave transfers.
Definition: fsl_i2c.c:1208
i2c_master_transfer_t::subaddressSize
uint8_t subaddressSize
Definition: fsl_i2c.h:209
I2C_MasterInit
void I2C_MasterInit(I2C_Type *base, const i2c_master_config_t *masterConfig, uint32_t srcClock_Hz)
Initialize the I2C peripheral, call this API to ungate the i2c clock and configure the I2C with maste...
Definition: fsl_i2c.c:412
i2c_master_config_t::enableHighDrive
bool enableHighDrive
Definition: fsl_i2c.h:166
kI2C_GlobalInterruptEnable
Definition: fsl_i2c.h:96
_i2c_status
_i2c_status
I2C status return codes.
Definition: fsl_i2c.h:53
I2C_EnableDMA
static void I2C_EnableDMA(I2C_Type *base, bool enable)
Enables/disables the I2C DMA interrupt.
Definition: fsl_i2c.h:497
i2c_master_transfer_callback_t
void(* i2c_master_transfer_callback_t)(I2C_Type *base, i2c_master_handle_t *handle, status_t status, void *userData)
I2C master transfer callback typedef.
Definition: fsl_i2c.h:194
kI2C_TransferRepeatedStartFlag
Definition: fsl_i2c.h:126
I2C_MasterDeinit
void I2C_MasterDeinit(I2C_Type *base)
De-initialize the I2C master peripheral, call thi API will gate the i2c clock, so the I2C master modu...
Definition: fsl_i2c.c:462
i2c_slave_config_t::enableBaudRateCtl
bool enableBaudRateCtl
Definition: fsl_i2c.h:184
i2c_master_transfer_t::direction
i2c_direction_t direction
Definition: fsl_i2c.h:207
_i2c_master_handle
I2C master handle structure.
Definition: fsl_i2c.h:215
kI2C_StartStopDetectInterruptEnable
Definition: fsl_i2c.h:103
_i2c_master_handle::completionCallback
i2c_master_transfer_callback_t completionCallback
Definition: fsl_i2c.h:220
kI2C_AddressMatchFlag
Definition: fsl_i2c.h:82
i2c_slave_transfer_t::completionStatus
status_t completionStatus
Definition: fsl_i2c.h:230
i2c_slave_config_t::enableWakeUp
bool enableWakeUp
Definition: fsl_i2c.h:180
I2C_Enable
static void I2C_Enable(I2C_Type *base, bool enable)
Enable or disables the I2C peripheral operation.
Definition: fsl_i2c.h:364
kI2C_SlaveReceiveEvent
Definition: fsl_i2c.h:145
I2C_MasterTransferAbort
void I2C_MasterTransferAbort(I2C_Type *base, i2c_master_handle_t *handle)
Abort a interrupt non-blocking transfer in a early time.
Definition: fsl_i2c.c:1005
_i2c_master_handle::userData
void * userData
Definition: fsl_i2c.h:221
I2C_SlaveTransferGetCount
status_t I2C_SlaveTransferGetCount(I2C_Type *base, i2c_slave_handle_t *handle, size_t *count)
Get slave transfer remaining bytes during a interrupt non-blocking transfer.
Definition: fsl_i2c.c:1258
kStatusGroup_I2C
Definition: fsl_common.h:76
kI2C_TransferNoStartFlag
Definition: fsl_i2c.h:125
I2C_MasterWriteBlocking
status_t I2C_MasterWriteBlocking(I2C_Type *base, const uint8_t *txBuff, size_t txSize)
Performs a polling send transaction on the I2C bus without a STOP signal.
Definition: fsl_i2c.c:693
_i2c_slave_handle::eventMask
uint32_t eventMask
Definition: fsl_i2c.h:243
kI2C_StopDetectFlag
Definition: fsl_i2c.h:85
I2C_MasterStart
status_t I2C_MasterStart(I2C_Type *base, uint8_t address, i2c_direction_t direction)
Sends a START on the I2C bus.
Definition: fsl_i2c.c:581
_i2c_slave_handle::isBusy
bool isBusy
Definition: fsl_i2c.h:241
i2c_master_config_t::enableStopHold
bool enableStopHold
Definition: fsl_i2c.h:169
I2C_MasterRepeatedStart
status_t I2C_MasterRepeatedStart(I2C_Type *base, uint8_t address, i2c_direction_t direction)
Sends a REPEATED START on the I2C bus.
Definition: fsl_i2c.c:608
_i2c_slave_handle
I2C slave handle structure.
Definition: fsl_i2c.h:239
_i2c_master_handle::transfer
i2c_master_transfer_t transfer
Definition: fsl_i2c.h:217
kStatus_I2C_Idle
Definition: fsl_i2c.h:56
_i2c_slave_handle::callback
i2c_slave_transfer_callback_t callback
Definition: fsl_i2c.h:244
I2C_SlaveTransferHandleIRQ
void I2C_SlaveTransferHandleIRQ(I2C_Type *base, void *i2cHandle)
Slave interrupt handler.
Definition: fsl_i2c.c:1280
i2c_slave_config_t::slaveAddress
uint16_t slaveAddress
Definition: fsl_i2c.h:185
i2c_slave_config_t::addressingMode
i2c_slave_address_mode_t addressingMode
Definition: fsl_i2c.h:187
i2c_master_transfer_t::subaddress
uint32_t subaddress
Definition: fsl_i2c.h:208
kI2C_SlaveTransmitAckEvent
Definition: fsl_i2c.h:147
kI2C_ReceiveNakFlag
Definition: fsl_i2c.h:76
i2c_master_transfer_t::flags
uint32_t flags
Definition: fsl_i2c.h:205
kI2C_StopDetectInterruptEnable
Definition: fsl_i2c.h:99
i2c_slave_transfer_t::event
i2c_slave_transfer_event_t event
Definition: fsl_i2c.h:227
kI2C_TransferDefaultFlag
Definition: fsl_i2c.h:124
_i2c_master_handle::state
uint8_t state
Definition: fsl_i2c.h:219
I2C_MasterTransferNonBlocking
status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer)
Performs a master interrupt non-blocking transfer on the I2C bus.
Definition: fsl_i2c.c:978
kI2C_Write
Definition: fsl_i2c.h:110
kStatus_I2C_ArbitrationLost
Definition: fsl_i2c.h:58
I2C_MasterGetDefaultConfig
void I2C_MasterGetDefaultConfig(i2c_master_config_t *masterConfig)
Set the I2C master configuration structure to default values.
Definition: fsl_i2c.c:471
i2c_slave_transfer_event_t
i2c_slave_transfer_event_t
Set of events sent to the callback for nonblocking slave transfers.
Definition: fsl_i2c.h:140
I2C_SlaveClearStatusFlags
static void I2C_SlaveClearStatusFlags(I2C_Type *base, uint32_t statusMask)
Clears the I2C status flag state.
Definition: fsl_i2c.h:450
I2C_MasterSetBaudRate
void I2C_MasterSetBaudRate(I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
Sets the I2C master transfer baudrate.
Definition: fsl_i2c.c:539
i2c_slave_transfer_t
I2C slave transfer structure.
Definition: fsl_i2c.h:225
i2c_master_config_t::baudRate_Bps
uint32_t baudRate_Bps
Definition: fsl_i2c.h:171
kI2C_TransferDirectionFlag
Definition: fsl_i2c.h:78
i2c_master_transfer_t::dataSize
volatile size_t dataSize
Definition: fsl_i2c.h:211
_i2c_master_handle::transferSize
size_t transferSize
Definition: fsl_i2c.h:218
I2C_MasterGetStatusFlags
uint32_t I2C_MasterGetStatusFlags(I2C_Type *base)
Gets the I2C status flags.
Definition: fsl_i2c.c:670
i2c_slave_config_t
I2C slave user config.
Definition: fsl_i2c.h:176
kStatus_I2C_Nak
Definition: fsl_i2c.h:57
kI2C_Read
Definition: fsl_i2c.h:111
I2C_MasterTransferCreateHandle
void I2C_MasterTransferCreateHandle(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_callback_t callback, void *userData)
Init the I2C handle which is used in transactional functions.
Definition: fsl_i2c.c:952
kStatus_I2C_Busy
Definition: fsl_i2c.h:55
kI2C_SlaveTransmitEvent
Definition: fsl_i2c.h:143
i2c_slave_address_mode_t
i2c_slave_address_mode_t
Addressing mode.
Definition: fsl_i2c.h:115
i2c_slave_transfer_t::transferredCount
size_t transferredCount
Definition: fsl_i2c.h:232
I2C_SlaveReadBlocking
void I2C_SlaveReadBlocking(I2C_Type *base, uint8_t *rxBuff, size_t rxSize)
Performs a polling receive transaction on the I2C bus.
Definition: fsl_i2c.c:1154
I2C_GetDataRegAddr
static uint32_t I2C_GetDataRegAddr(I2C_Type *base)
Get I2C tx/rx data register address This API is used to provide transfer address for I2C DMA transfer...
Definition: fsl_i2c.h:518
i2c_slave_config_t::enableSlave
bool enableSlave
Definition: fsl_i2c.h:178
kI2C_BusBusyFlag
Definition: fsl_i2c.h:81
_i2c_master_transfer_flags
_i2c_master_transfer_flags
I2C transfer control flag.
Definition: fsl_i2c.h:122
i2c_master_transfer_t::data
uint8_t *volatile data
Definition: fsl_i2c.h:210
i2c_master_transfer_t::slaveAddress
uint8_t slaveAddress
Definition: fsl_i2c.h:206
kI2C_SlaveAllEvents
Definition: fsl_i2c.h:154
i2c_slave_config_t::upperAddress
uint16_t upperAddress
Definition: fsl_i2c.h:186
I2C_DisableInterrupts
void I2C_DisableInterrupts(I2C_Type *base, uint32_t mask)
Disable I2C interrupt requests.
Definition: fsl_i2c.c:517
_i2c_interrupt_enable
_i2c_interrupt_enable
I2C feature interrupt source.
Definition: fsl_i2c.h:94
kI2C_TransferCompleteFlag
Definition: fsl_i2c.h:83
I2C_SlaveTransferAbort
void I2C_SlaveTransferAbort(I2C_Type *base, i2c_slave_handle_t *handle)
Abort slave transfer.
Definition: fsl_i2c.c:1241
I2C_MasterTransferGetCount
status_t I2C_MasterTransferGetCount(I2C_Type *base, i2c_master_handle_t *handle, size_t *count)
Get master transfer status during a interrupt non-blocking transfer.
Definition: fsl_i2c.c:1016
I2C_MasterStop
status_t I2C_MasterStop(I2C_Type *base)
Sends a STOP signal on the I2C bus.
Definition: fsl_i2c.c:649
kI2C_StartDetectFlag
Definition: fsl_i2c.h:89
i2c_slave_config_t::enableGeneralCall
bool enableGeneralCall
Definition: fsl_i2c.h:179
i2c_direction_t
i2c_direction_t
Direction of master and slave transfers.
Definition: fsl_i2c.h:108
i2c_master_config_t::enableMaster
bool enableMaster
Definition: fsl_i2c.h:164
I2C_MasterClearStatusFlags
static void I2C_MasterClearStatusFlags(I2C_Type *base, uint32_t statusMask)
Clears the I2C status flag state.
Definition: fsl_i2c.h:415
kI2C_ArbitrationLostFlag
Definition: fsl_i2c.h:80
I2C_SlaveGetStatusFlags
static uint32_t I2C_SlaveGetStatusFlags(I2C_Type *base)
Gets the I2C status flags.
Definition: fsl_i2c.h:397
kI2C_SlaveCompletionEvent
Definition: fsl_i2c.h:151
I2C_EnableInterrupts
void I2C_EnableInterrupts(I2C_Type *base, uint32_t mask)
Enable I2C interrupt requests.
Definition: fsl_i2c.c:495
I2C_SlaveInit
void I2C_SlaveInit(I2C_Type *base, const i2c_slave_config_t *slaveConfig)
Initialize the I2C peripheral, call this API to ungate the i2c clock and initializes the I2C with sla...
Definition: fsl_i2c.c:1073
kI2C_SlaveRepeatedStartEvent
Definition: fsl_i2c.h:149
kI2C_TransferNoStopFlag
Definition: fsl_i2c.h:127
kI2C_RangeMatch
Definition: fsl_i2c.h:118
_i2c_flags
_i2c_flags
I2C peripheral flags.
Definition: fsl_i2c.h:74
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121
i2c_master_transfer_t
I2C master transfer structure.
Definition: fsl_i2c.h:203
i2c_slave_transfer_callback_t
void(* i2c_slave_transfer_callback_t)(I2C_Type *base, i2c_slave_transfer_t *xfer, void *userData)
I2C slave transfer callback typedef.
Definition: fsl_i2c.h:236
I2C_SlaveDeinit
void I2C_SlaveDeinit(I2C_Type *base)
De-initialize the I2C slave peripheral, call thi API will gate the i2c clock, so the I2C slave module...
Definition: fsl_i2c.c:1115
i2c_master_config_t::glitchFilterWidth
uint8_t glitchFilterWidth
Definition: fsl_i2c.h:172
I2C_SlaveTransferCreateHandle
void I2C_SlaveTransferCreateHandle(I2C_Type *base, i2c_slave_handle_t *handle, i2c_slave_transfer_callback_t callback, void *userData)
Init the I2C handle which is used in transcational functions.
Definition: fsl_i2c.c:1182
kI2C_SlaveAddressMatchEvent
Definition: fsl_i2c.h:142
I2C_SlaveWriteBlocking
status_t I2C_SlaveWriteBlocking(I2C_Type *base, const uint8_t *txBuff, size_t txSize)
Performs a polling send transaction on the I2C bus.
Definition: fsl_i2c.c:1149
I2C_MasterTransferHandleIRQ
void I2C_MasterTransferHandleIRQ(I2C_Type *base, void *i2cHandle)
Master interrupt handler.
Definition: fsl_i2c.c:1030
kI2C_RangeAddressMatchFlag
Definition: fsl_i2c.h:79
I2C_SlaveGetDefaultConfig
void I2C_SlaveGetDefaultConfig(i2c_slave_config_t *slaveConfig)
Set the I2C slave configuration structure to default values.
Definition: fsl_i2c.c:1124
kStatus_I2C_Timeout
Definition: fsl_i2c.h:59