The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /*
AnnaBridge 171:3a7713b1edbc 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
AnnaBridge 171:3a7713b1edbc 3 * All rights reserved.
AnnaBridge 171:3a7713b1edbc 4 *
AnnaBridge 171:3a7713b1edbc 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 171:3a7713b1edbc 6 * are permitted provided that the following conditions are met:
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 171:3a7713b1edbc 9 * of conditions and the following disclaimer.
AnnaBridge 171:3a7713b1edbc 10 *
AnnaBridge 171:3a7713b1edbc 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 171:3a7713b1edbc 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 171:3a7713b1edbc 13 * other materials provided with the distribution.
AnnaBridge 171:3a7713b1edbc 14 *
AnnaBridge 171:3a7713b1edbc 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 171:3a7713b1edbc 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 171:3a7713b1edbc 17 * software without specific prior written permission.
AnnaBridge 171:3a7713b1edbc 18 *
AnnaBridge 171:3a7713b1edbc 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 171:3a7713b1edbc 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 171:3a7713b1edbc 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 171:3a7713b1edbc 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 171:3a7713b1edbc 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 171:3a7713b1edbc 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 171:3a7713b1edbc 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 171:3a7713b1edbc 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 171:3a7713b1edbc 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 171:3a7713b1edbc 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 171:3a7713b1edbc 29 */
AnnaBridge 171:3a7713b1edbc 30 #ifndef _FSL_I2C_H_
AnnaBridge 171:3a7713b1edbc 31 #define _FSL_I2C_H_
AnnaBridge 171:3a7713b1edbc 32
AnnaBridge 171:3a7713b1edbc 33 #include "fsl_common.h"
AnnaBridge 171:3a7713b1edbc 34
AnnaBridge 171:3a7713b1edbc 35 /*!
AnnaBridge 171:3a7713b1edbc 36 * @addtogroup i2c_driver
AnnaBridge 171:3a7713b1edbc 37 * @{
AnnaBridge 171:3a7713b1edbc 38 */
AnnaBridge 171:3a7713b1edbc 39
AnnaBridge 171:3a7713b1edbc 40 /*! @file */
AnnaBridge 171:3a7713b1edbc 41
AnnaBridge 171:3a7713b1edbc 42 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 43 * Definitions
AnnaBridge 171:3a7713b1edbc 44 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 45
AnnaBridge 171:3a7713b1edbc 46 /*! @name Driver version */
AnnaBridge 171:3a7713b1edbc 47 /*@{*/
AnnaBridge 171:3a7713b1edbc 48 /*! @brief I2C driver version 2.0.0. */
AnnaBridge 171:3a7713b1edbc 49 #define FSL_I2C_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
AnnaBridge 171:3a7713b1edbc 50 /*@}*/
AnnaBridge 171:3a7713b1edbc 51
AnnaBridge 171:3a7713b1edbc 52 #if (defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT || \
AnnaBridge 171:3a7713b1edbc 53 defined(FSL_FEATURE_I2C_HAS_STOP_DETECT) && FSL_FEATURE_I2C_HAS_STOP_DETECT)
AnnaBridge 171:3a7713b1edbc 54 #define I2C_HAS_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 55 #endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT / FSL_FEATURE_I2C_HAS_STOP_DETECT */
AnnaBridge 171:3a7713b1edbc 56
AnnaBridge 171:3a7713b1edbc 57 /*! @brief I2C status return codes. */
AnnaBridge 171:3a7713b1edbc 58 enum _i2c_status
AnnaBridge 171:3a7713b1edbc 59 {
AnnaBridge 171:3a7713b1edbc 60 kStatus_I2C_Busy = MAKE_STATUS(kStatusGroup_I2C, 0), /*!< I2C is busy with current transfer. */
AnnaBridge 171:3a7713b1edbc 61 kStatus_I2C_Idle = MAKE_STATUS(kStatusGroup_I2C, 1), /*!< Bus is Idle. */
AnnaBridge 171:3a7713b1edbc 62 kStatus_I2C_Nak = MAKE_STATUS(kStatusGroup_I2C, 2), /*!< NAK received during transfer. */
AnnaBridge 171:3a7713b1edbc 63 kStatus_I2C_ArbitrationLost = MAKE_STATUS(kStatusGroup_I2C, 3), /*!< Arbitration lost during transfer. */
AnnaBridge 171:3a7713b1edbc 64 kStatus_I2C_Timeout = MAKE_STATUS(kStatusGroup_I2C, 4), /*!< Wait event timeout. */
AnnaBridge 171:3a7713b1edbc 65 };
AnnaBridge 171:3a7713b1edbc 66
AnnaBridge 171:3a7713b1edbc 67 /*!
AnnaBridge 171:3a7713b1edbc 68 * @brief I2C peripheral flags
AnnaBridge 171:3a7713b1edbc 69 *
AnnaBridge 171:3a7713b1edbc 70 * The following status register flags can be cleared:
AnnaBridge 171:3a7713b1edbc 71 * - #kI2C_ArbitrationLostFlag
AnnaBridge 171:3a7713b1edbc 72 * - #kI2C_IntPendingFlag
AnnaBridge 171:3a7713b1edbc 73 * - #kI2C_StartDetectFlag
AnnaBridge 171:3a7713b1edbc 74 * - #kI2C_StopDetectFlag
AnnaBridge 171:3a7713b1edbc 75 *
AnnaBridge 171:3a7713b1edbc 76 * @note These enumerations are meant to be OR'd together to form a bit mask.
AnnaBridge 171:3a7713b1edbc 77 *
AnnaBridge 171:3a7713b1edbc 78 */
AnnaBridge 171:3a7713b1edbc 79 enum _i2c_flags
AnnaBridge 171:3a7713b1edbc 80 {
AnnaBridge 171:3a7713b1edbc 81 kI2C_ReceiveNakFlag = I2C_S_RXAK_MASK, /*!< I2C receive NAK flag. */
AnnaBridge 171:3a7713b1edbc 82 kI2C_IntPendingFlag = I2C_S_IICIF_MASK, /*!< I2C interrupt pending flag. */
AnnaBridge 171:3a7713b1edbc 83 kI2C_TransferDirectionFlag = I2C_S_SRW_MASK, /*!< I2C transfer direction flag. */
AnnaBridge 171:3a7713b1edbc 84 kI2C_RangeAddressMatchFlag = I2C_S_RAM_MASK, /*!< I2C range address match flag. */
AnnaBridge 171:3a7713b1edbc 85 kI2C_ArbitrationLostFlag = I2C_S_ARBL_MASK, /*!< I2C arbitration lost flag. */
AnnaBridge 171:3a7713b1edbc 86 kI2C_BusBusyFlag = I2C_S_BUSY_MASK, /*!< I2C bus busy flag. */
AnnaBridge 171:3a7713b1edbc 87 kI2C_AddressMatchFlag = I2C_S_IAAS_MASK, /*!< I2C address match flag. */
AnnaBridge 171:3a7713b1edbc 88 kI2C_TransferCompleteFlag = I2C_S_TCF_MASK, /*!< I2C transfer complete flag. */
AnnaBridge 171:3a7713b1edbc 89 #ifdef I2C_HAS_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 90 kI2C_StopDetectFlag = I2C_FLT_STOPF_MASK << 8, /*!< I2C stop detect flag. */
AnnaBridge 171:3a7713b1edbc 91 #endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT / FSL_FEATURE_I2C_HAS_STOP_DETECT */
AnnaBridge 171:3a7713b1edbc 92
AnnaBridge 171:3a7713b1edbc 93 #if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 94 kI2C_StartDetectFlag = I2C_FLT_STARTF_MASK << 8, /*!< I2C start detect flag. */
AnnaBridge 171:3a7713b1edbc 95 #endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT */
AnnaBridge 171:3a7713b1edbc 96 };
AnnaBridge 171:3a7713b1edbc 97
AnnaBridge 171:3a7713b1edbc 98 /*! @brief I2C feature interrupt source. */
AnnaBridge 171:3a7713b1edbc 99 enum _i2c_interrupt_enable
AnnaBridge 171:3a7713b1edbc 100 {
AnnaBridge 171:3a7713b1edbc 101 kI2C_GlobalInterruptEnable = I2C_C1_IICIE_MASK, /*!< I2C global interrupt. */
AnnaBridge 171:3a7713b1edbc 102
AnnaBridge 171:3a7713b1edbc 103 #if defined(FSL_FEATURE_I2C_HAS_STOP_DETECT) && FSL_FEATURE_I2C_HAS_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 104 kI2C_StopDetectInterruptEnable = I2C_FLT_STOPIE_MASK, /*!< I2C stop detect interrupt. */
AnnaBridge 171:3a7713b1edbc 105 #endif /* FSL_FEATURE_I2C_HAS_STOP_DETECT */
AnnaBridge 171:3a7713b1edbc 106
AnnaBridge 171:3a7713b1edbc 107 #if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 108 kI2C_StartStopDetectInterruptEnable = I2C_FLT_SSIE_MASK, /*!< I2C start&stop detect interrupt. */
AnnaBridge 171:3a7713b1edbc 109 #endif /* FSL_FEATURE_I2C_HAS_START_STOP_DETECT */
AnnaBridge 171:3a7713b1edbc 110 };
AnnaBridge 171:3a7713b1edbc 111
AnnaBridge 171:3a7713b1edbc 112 /*! @brief Direction of master and slave transfers. */
AnnaBridge 171:3a7713b1edbc 113 typedef enum _i2c_direction
AnnaBridge 171:3a7713b1edbc 114 {
AnnaBridge 171:3a7713b1edbc 115 kI2C_Write = 0x0U, /*!< Master transmit to slave. */
AnnaBridge 171:3a7713b1edbc 116 kI2C_Read = 0x1U, /*!< Master receive from slave. */
AnnaBridge 171:3a7713b1edbc 117 } i2c_direction_t;
AnnaBridge 171:3a7713b1edbc 118
AnnaBridge 171:3a7713b1edbc 119 /*! @brief Addressing mode. */
AnnaBridge 171:3a7713b1edbc 120 typedef enum _i2c_slave_address_mode
AnnaBridge 171:3a7713b1edbc 121 {
AnnaBridge 171:3a7713b1edbc 122 kI2C_Address7bit = 0x0U, /*!< 7-bit addressing mode. */
AnnaBridge 171:3a7713b1edbc 123 kI2C_RangeMatch = 0X2U, /*!< Range address match addressing mode. */
AnnaBridge 171:3a7713b1edbc 124 } i2c_slave_address_mode_t;
AnnaBridge 171:3a7713b1edbc 125
AnnaBridge 171:3a7713b1edbc 126 /*! @brief I2C transfer control flag. */
AnnaBridge 171:3a7713b1edbc 127 enum _i2c_master_transfer_flags
AnnaBridge 171:3a7713b1edbc 128 {
AnnaBridge 171:3a7713b1edbc 129 kI2C_TransferDefaultFlag = 0x0U, /*!< Transfer starts with a start signal, stops with a stop signal. */
AnnaBridge 171:3a7713b1edbc 130 kI2C_TransferNoStartFlag = 0x1U, /*!< Transfer starts without a start signal. */
AnnaBridge 171:3a7713b1edbc 131 kI2C_TransferRepeatedStartFlag = 0x2U, /*!< Transfer starts with a repeated start signal. */
AnnaBridge 171:3a7713b1edbc 132 kI2C_TransferNoStopFlag = 0x4U, /*!< Transfer ends without a stop signal. */
AnnaBridge 171:3a7713b1edbc 133 };
AnnaBridge 171:3a7713b1edbc 134
AnnaBridge 171:3a7713b1edbc 135 /*!
AnnaBridge 171:3a7713b1edbc 136 * @brief Set of events sent to the callback for nonblocking slave transfers.
AnnaBridge 171:3a7713b1edbc 137 *
AnnaBridge 171:3a7713b1edbc 138 * These event enumerations are used for two related purposes. First, a bit mask created by OR'ing together
AnnaBridge 171:3a7713b1edbc 139 * events is passed to I2C_SlaveTransferNonBlocking() in order to specify which events to enable.
AnnaBridge 171:3a7713b1edbc 140 * Then, when the slave callback is invoked, it is passed the current event through its @a transfer
AnnaBridge 171:3a7713b1edbc 141 * parameter.
AnnaBridge 171:3a7713b1edbc 142 *
AnnaBridge 171:3a7713b1edbc 143 * @note These enumerations are meant to be OR'd together to form a bit mask of events.
AnnaBridge 171:3a7713b1edbc 144 */
AnnaBridge 171:3a7713b1edbc 145 typedef enum _i2c_slave_transfer_event
AnnaBridge 171:3a7713b1edbc 146 {
AnnaBridge 171:3a7713b1edbc 147 kI2C_SlaveAddressMatchEvent = 0x01U, /*!< Received the slave address after a start or repeated start. */
AnnaBridge 171:3a7713b1edbc 148 kI2C_SlaveTransmitEvent = 0x02U, /*!< Callback is requested to provide data to transmit
AnnaBridge 171:3a7713b1edbc 149 (slave-transmitter role). */
AnnaBridge 171:3a7713b1edbc 150 kI2C_SlaveReceiveEvent = 0x04U, /*!< Callback is requested to provide a buffer in which to place received
AnnaBridge 171:3a7713b1edbc 151 data (slave-receiver role). */
AnnaBridge 171:3a7713b1edbc 152 kI2C_SlaveTransmitAckEvent = 0x08U, /*!< Callback needs to either transmit an ACK or NACK. */
AnnaBridge 171:3a7713b1edbc 153 #if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 154 kI2C_SlaveRepeatedStartEvent = 0x10U, /*!< A repeated start was detected. */
AnnaBridge 171:3a7713b1edbc 155 #endif
AnnaBridge 171:3a7713b1edbc 156 kI2C_SlaveCompletionEvent = 0x20U, /*!< A stop was detected or finished transfer, completing the transfer. */
AnnaBridge 171:3a7713b1edbc 157
AnnaBridge 171:3a7713b1edbc 158 /*! Bit mask of all available events. */
AnnaBridge 171:3a7713b1edbc 159 kI2C_SlaveAllEvents = kI2C_SlaveAddressMatchEvent | kI2C_SlaveTransmitEvent | kI2C_SlaveReceiveEvent |
AnnaBridge 171:3a7713b1edbc 160 #if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 161 kI2C_SlaveRepeatedStartEvent |
AnnaBridge 171:3a7713b1edbc 162 #endif
AnnaBridge 171:3a7713b1edbc 163 kI2C_SlaveCompletionEvent,
AnnaBridge 171:3a7713b1edbc 164 } i2c_slave_transfer_event_t;
AnnaBridge 171:3a7713b1edbc 165
AnnaBridge 171:3a7713b1edbc 166 /*! @brief I2C master user configuration. */
AnnaBridge 171:3a7713b1edbc 167 typedef struct _i2c_master_config
AnnaBridge 171:3a7713b1edbc 168 {
AnnaBridge 171:3a7713b1edbc 169 bool enableMaster; /*!< Enables the I2C peripheral at initialization time. */
AnnaBridge 171:3a7713b1edbc 170 #if defined(FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION) && FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION
AnnaBridge 171:3a7713b1edbc 171 bool enableHighDrive; /*!< Controls the drive capability of the I2C pads. */
AnnaBridge 171:3a7713b1edbc 172 #endif
AnnaBridge 171:3a7713b1edbc 173 #if defined(FSL_FEATURE_I2C_HAS_STOP_HOLD_OFF) && FSL_FEATURE_I2C_HAS_STOP_HOLD_OFF
AnnaBridge 171:3a7713b1edbc 174 bool enableStopHold; /*!< Controls the stop hold enable. */
AnnaBridge 171:3a7713b1edbc 175 #endif
AnnaBridge 171:3a7713b1edbc 176 uint32_t baudRate_Bps; /*!< Baud rate configuration of I2C peripheral. */
AnnaBridge 171:3a7713b1edbc 177 uint8_t glitchFilterWidth; /*!< Controls the width of the glitch. */
AnnaBridge 171:3a7713b1edbc 178 } i2c_master_config_t;
AnnaBridge 171:3a7713b1edbc 179
AnnaBridge 171:3a7713b1edbc 180 /*! @brief I2C slave user configuration. */
AnnaBridge 171:3a7713b1edbc 181 typedef struct _i2c_slave_config
AnnaBridge 171:3a7713b1edbc 182 {
AnnaBridge 171:3a7713b1edbc 183 bool enableSlave; /*!< Enables the I2C peripheral at initialization time. */
AnnaBridge 171:3a7713b1edbc 184 bool enableGeneralCall; /*!< Enable general call addressing mode. */
AnnaBridge 171:3a7713b1edbc 185 bool enableWakeUp; /*!< Enables/disables waking up MCU from low power mode. */
AnnaBridge 171:3a7713b1edbc 186 #if defined(FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION) && FSL_FEATURE_I2C_HAS_HIGH_DRIVE_SELECTION
AnnaBridge 171:3a7713b1edbc 187 bool enableHighDrive; /*!< Controls the drive capability of the I2C pads. */
AnnaBridge 171:3a7713b1edbc 188 #endif
AnnaBridge 171:3a7713b1edbc 189 bool enableBaudRateCtl; /*!< Enables/disables independent slave baud rate on SCL in very fast I2C modes. */
AnnaBridge 171:3a7713b1edbc 190 uint16_t slaveAddress; /*!< Slave address configuration. */
AnnaBridge 171:3a7713b1edbc 191 uint16_t upperAddress; /*!< Maximum boundary slave address used in range matching mode. */
AnnaBridge 171:3a7713b1edbc 192 i2c_slave_address_mode_t addressingMode; /*!< Addressing mode configuration of i2c_slave_address_mode_config_t. */
AnnaBridge 171:3a7713b1edbc 193 } i2c_slave_config_t;
AnnaBridge 171:3a7713b1edbc 194
AnnaBridge 171:3a7713b1edbc 195 /*! @brief I2C master handle typedef. */
AnnaBridge 171:3a7713b1edbc 196 typedef struct _i2c_master_handle i2c_master_handle_t;
AnnaBridge 171:3a7713b1edbc 197
AnnaBridge 171:3a7713b1edbc 198 /*! @brief I2C master transfer callback typedef. */
AnnaBridge 171:3a7713b1edbc 199 typedef void (*i2c_master_transfer_callback_t)(I2C_Type *base,
AnnaBridge 171:3a7713b1edbc 200 i2c_master_handle_t *handle,
AnnaBridge 171:3a7713b1edbc 201 status_t status,
AnnaBridge 171:3a7713b1edbc 202 void *userData);
AnnaBridge 171:3a7713b1edbc 203
AnnaBridge 171:3a7713b1edbc 204 /*! @brief I2C slave handle typedef. */
AnnaBridge 171:3a7713b1edbc 205 typedef struct _i2c_slave_handle i2c_slave_handle_t;
AnnaBridge 171:3a7713b1edbc 206
AnnaBridge 171:3a7713b1edbc 207 /*! @brief I2C master transfer structure. */
AnnaBridge 171:3a7713b1edbc 208 typedef struct _i2c_master_transfer
AnnaBridge 171:3a7713b1edbc 209 {
AnnaBridge 171:3a7713b1edbc 210 uint32_t flags; /*!< Transfer flag which controls the transfer. */
AnnaBridge 171:3a7713b1edbc 211 uint8_t slaveAddress; /*!< 7-bit slave address. */
AnnaBridge 171:3a7713b1edbc 212 i2c_direction_t direction; /*!< Transfer direction, read or write. */
AnnaBridge 171:3a7713b1edbc 213 uint32_t subaddress; /*!< Sub address. Transferred MSB first. */
AnnaBridge 171:3a7713b1edbc 214 uint8_t subaddressSize; /*!< Size of command buffer. */
AnnaBridge 171:3a7713b1edbc 215 uint8_t *volatile data; /*!< Transfer buffer. */
AnnaBridge 171:3a7713b1edbc 216 volatile size_t dataSize; /*!< Transfer size. */
AnnaBridge 171:3a7713b1edbc 217 } i2c_master_transfer_t;
AnnaBridge 171:3a7713b1edbc 218
AnnaBridge 171:3a7713b1edbc 219 /*! @brief I2C master handle structure. */
AnnaBridge 171:3a7713b1edbc 220 struct _i2c_master_handle
AnnaBridge 171:3a7713b1edbc 221 {
AnnaBridge 171:3a7713b1edbc 222 i2c_master_transfer_t transfer; /*!< I2C master transfer copy. */
AnnaBridge 171:3a7713b1edbc 223 size_t transferSize; /*!< Total bytes to be transferred. */
AnnaBridge 171:3a7713b1edbc 224 uint8_t state; /*!< Transfer state maintained during transfer. */
AnnaBridge 171:3a7713b1edbc 225 i2c_master_transfer_callback_t completionCallback; /*!< Callback function called when transfer finished. */
AnnaBridge 171:3a7713b1edbc 226 void *userData; /*!< Callback parameter passed to callback function. */
AnnaBridge 171:3a7713b1edbc 227 };
AnnaBridge 171:3a7713b1edbc 228
AnnaBridge 171:3a7713b1edbc 229 /*! @brief I2C slave transfer structure. */
AnnaBridge 171:3a7713b1edbc 230 typedef struct _i2c_slave_transfer
AnnaBridge 171:3a7713b1edbc 231 {
AnnaBridge 171:3a7713b1edbc 232 i2c_slave_transfer_event_t event; /*!< Reason the callback is being invoked. */
AnnaBridge 171:3a7713b1edbc 233 uint8_t *volatile data; /*!< Transfer buffer. */
AnnaBridge 171:3a7713b1edbc 234 volatile size_t dataSize; /*!< Transfer size. */
AnnaBridge 171:3a7713b1edbc 235 status_t completionStatus; /*!< Success or error code describing how the transfer completed. Only applies for
AnnaBridge 171:3a7713b1edbc 236 #kI2C_SlaveCompletionEvent. */
AnnaBridge 171:3a7713b1edbc 237 size_t transferredCount; /*!< Number of bytes actually transferred since start or last repeated start. */
AnnaBridge 171:3a7713b1edbc 238 } i2c_slave_transfer_t;
AnnaBridge 171:3a7713b1edbc 239
AnnaBridge 171:3a7713b1edbc 240 /*! @brief I2C slave transfer callback typedef. */
AnnaBridge 171:3a7713b1edbc 241 typedef void (*i2c_slave_transfer_callback_t)(I2C_Type *base, i2c_slave_transfer_t *xfer, void *userData);
AnnaBridge 171:3a7713b1edbc 242
AnnaBridge 171:3a7713b1edbc 243 /*! @brief I2C slave handle structure. */
AnnaBridge 171:3a7713b1edbc 244 struct _i2c_slave_handle
AnnaBridge 171:3a7713b1edbc 245 {
AnnaBridge 171:3a7713b1edbc 246 bool isBusy; /*!< Whether transfer is busy. */
AnnaBridge 171:3a7713b1edbc 247 i2c_slave_transfer_t transfer; /*!< I2C slave transfer copy. */
AnnaBridge 171:3a7713b1edbc 248 uint32_t eventMask; /*!< Mask of enabled events. */
AnnaBridge 171:3a7713b1edbc 249 i2c_slave_transfer_callback_t callback; /*!< Callback function called at transfer event. */
AnnaBridge 171:3a7713b1edbc 250 void *userData; /*!< Callback parameter passed to callback. */
AnnaBridge 171:3a7713b1edbc 251 };
AnnaBridge 171:3a7713b1edbc 252
AnnaBridge 171:3a7713b1edbc 253 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 254 * API
AnnaBridge 171:3a7713b1edbc 255 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 256
AnnaBridge 171:3a7713b1edbc 257 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 258 extern "C" {
AnnaBridge 171:3a7713b1edbc 259 #endif /*_cplusplus. */
AnnaBridge 171:3a7713b1edbc 260
AnnaBridge 171:3a7713b1edbc 261 /*!
AnnaBridge 171:3a7713b1edbc 262 * @name Initialization and deinitialization
AnnaBridge 171:3a7713b1edbc 263 * @{
AnnaBridge 171:3a7713b1edbc 264 */
AnnaBridge 171:3a7713b1edbc 265
AnnaBridge 171:3a7713b1edbc 266 /*!
AnnaBridge 171:3a7713b1edbc 267 * @brief Initializes the I2C peripheral. Call this API to ungate the I2C clock
AnnaBridge 171:3a7713b1edbc 268 * and configure the I2C with master configuration.
AnnaBridge 171:3a7713b1edbc 269 *
AnnaBridge 171:3a7713b1edbc 270 * @note This API should be called at the beginning of the application to use
AnnaBridge 171:3a7713b1edbc 271 * the I2C driver, or any operation to the I2C module could cause hard fault
AnnaBridge 171:3a7713b1edbc 272 * because clock is not enabled. The configuration structure can be filled by user
AnnaBridge 171:3a7713b1edbc 273 * from scratch, or be set with default values by I2C_MasterGetDefaultConfig().
AnnaBridge 171:3a7713b1edbc 274 * After calling this API, the master is ready to transfer.
AnnaBridge 171:3a7713b1edbc 275 * Example:
AnnaBridge 171:3a7713b1edbc 276 * @code
AnnaBridge 171:3a7713b1edbc 277 * i2c_master_config_t config = {
AnnaBridge 171:3a7713b1edbc 278 * .enableMaster = true,
AnnaBridge 171:3a7713b1edbc 279 * .enableStopHold = false,
AnnaBridge 171:3a7713b1edbc 280 * .highDrive = false,
AnnaBridge 171:3a7713b1edbc 281 * .baudRate_Bps = 100000,
AnnaBridge 171:3a7713b1edbc 282 * .glitchFilterWidth = 0
AnnaBridge 171:3a7713b1edbc 283 * };
AnnaBridge 171:3a7713b1edbc 284 * I2C_MasterInit(I2C0, &config, 12000000U);
AnnaBridge 171:3a7713b1edbc 285 * @endcode
AnnaBridge 171:3a7713b1edbc 286 *
AnnaBridge 171:3a7713b1edbc 287 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 288 * @param masterConfig pointer to master configuration structure
AnnaBridge 171:3a7713b1edbc 289 * @param srcClock_Hz I2C peripheral clock frequency in Hz
AnnaBridge 171:3a7713b1edbc 290 */
AnnaBridge 171:3a7713b1edbc 291 void I2C_MasterInit(I2C_Type *base, const i2c_master_config_t *masterConfig, uint32_t srcClock_Hz);
AnnaBridge 171:3a7713b1edbc 292
AnnaBridge 171:3a7713b1edbc 293 /*!
AnnaBridge 171:3a7713b1edbc 294 * @brief Initializes the I2C peripheral. Call this API to ungate the I2C clock
AnnaBridge 171:3a7713b1edbc 295 * and initializes the I2C with slave configuration.
AnnaBridge 171:3a7713b1edbc 296 *
AnnaBridge 171:3a7713b1edbc 297 * @note This API should be called at the beginning of the application to use
AnnaBridge 171:3a7713b1edbc 298 * the I2C driver, or any operation to the I2C module can cause a hard fault
AnnaBridge 171:3a7713b1edbc 299 * because the clock is not enabled. The configuration structure can partly be set
AnnaBridge 171:3a7713b1edbc 300 * with default values by I2C_SlaveGetDefaultConfig(), or can be filled by the user.
AnnaBridge 171:3a7713b1edbc 301 * Example
AnnaBridge 171:3a7713b1edbc 302 * @code
AnnaBridge 171:3a7713b1edbc 303 * i2c_slave_config_t config = {
AnnaBridge 171:3a7713b1edbc 304 * .enableSlave = true,
AnnaBridge 171:3a7713b1edbc 305 * .enableGeneralCall = false,
AnnaBridge 171:3a7713b1edbc 306 * .addressingMode = kI2C_Address7bit,
AnnaBridge 171:3a7713b1edbc 307 * .slaveAddress = 0x1DU,
AnnaBridge 171:3a7713b1edbc 308 * .enableWakeUp = false,
AnnaBridge 171:3a7713b1edbc 309 * .enablehighDrive = false,
AnnaBridge 171:3a7713b1edbc 310 * .enableBaudRateCtl = false
AnnaBridge 171:3a7713b1edbc 311 * };
AnnaBridge 171:3a7713b1edbc 312 * I2C_SlaveInit(I2C0, &config);
AnnaBridge 171:3a7713b1edbc 313 * @endcode
AnnaBridge 171:3a7713b1edbc 314 *
AnnaBridge 171:3a7713b1edbc 315 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 316 * @param slaveConfig pointer to slave configuration structure
AnnaBridge 171:3a7713b1edbc 317 */
AnnaBridge 171:3a7713b1edbc 318 void I2C_SlaveInit(I2C_Type *base, const i2c_slave_config_t *slaveConfig);
AnnaBridge 171:3a7713b1edbc 319
AnnaBridge 171:3a7713b1edbc 320 /*!
AnnaBridge 171:3a7713b1edbc 321 * @brief De-initializes the I2C master peripheral. Call this API to gate the I2C clock.
AnnaBridge 171:3a7713b1edbc 322 * The I2C master module can't work unless the I2C_MasterInit is called.
AnnaBridge 171:3a7713b1edbc 323 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 324 */
AnnaBridge 171:3a7713b1edbc 325 void I2C_MasterDeinit(I2C_Type *base);
AnnaBridge 171:3a7713b1edbc 326
AnnaBridge 171:3a7713b1edbc 327 /*!
AnnaBridge 171:3a7713b1edbc 328 * @brief De-initializes the I2C slave peripheral. Calling this API gates the I2C clock.
AnnaBridge 171:3a7713b1edbc 329 * The I2C slave module can't work unless the I2C_SlaveInit is called to enable the clock.
AnnaBridge 171:3a7713b1edbc 330 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 331 */
AnnaBridge 171:3a7713b1edbc 332 void I2C_SlaveDeinit(I2C_Type *base);
AnnaBridge 171:3a7713b1edbc 333
AnnaBridge 171:3a7713b1edbc 334 /*!
AnnaBridge 171:3a7713b1edbc 335 * @brief Sets the I2C master configuration structure to default values.
AnnaBridge 171:3a7713b1edbc 336 *
AnnaBridge 171:3a7713b1edbc 337 * The purpose of this API is to get the configuration structure initialized for use in the I2C_MasterConfigure().
AnnaBridge 171:3a7713b1edbc 338 * Use the initialized structure unchanged in I2C_MasterConfigure(), or modify some fields of
AnnaBridge 171:3a7713b1edbc 339 * the structure before calling I2C_MasterConfigure().
AnnaBridge 171:3a7713b1edbc 340 * Example:
AnnaBridge 171:3a7713b1edbc 341 * @code
AnnaBridge 171:3a7713b1edbc 342 * i2c_master_config_t config;
AnnaBridge 171:3a7713b1edbc 343 * I2C_MasterGetDefaultConfig(&config);
AnnaBridge 171:3a7713b1edbc 344 * @endcode
AnnaBridge 171:3a7713b1edbc 345 * @param masterConfig Pointer to the master configuration structure.
AnnaBridge 171:3a7713b1edbc 346 */
AnnaBridge 171:3a7713b1edbc 347 void I2C_MasterGetDefaultConfig(i2c_master_config_t *masterConfig);
AnnaBridge 171:3a7713b1edbc 348
AnnaBridge 171:3a7713b1edbc 349 /*!
AnnaBridge 171:3a7713b1edbc 350 * @brief Sets the I2C slave configuration structure to default values.
AnnaBridge 171:3a7713b1edbc 351 *
AnnaBridge 171:3a7713b1edbc 352 * The purpose of this API is to get the configuration structure initialized for use in I2C_SlaveConfigure().
AnnaBridge 171:3a7713b1edbc 353 * Modify fields of the structure before calling the I2C_SlaveConfigure().
AnnaBridge 171:3a7713b1edbc 354 * Example:
AnnaBridge 171:3a7713b1edbc 355 * @code
AnnaBridge 171:3a7713b1edbc 356 * i2c_slave_config_t config;
AnnaBridge 171:3a7713b1edbc 357 * I2C_SlaveGetDefaultConfig(&config);
AnnaBridge 171:3a7713b1edbc 358 * @endcode
AnnaBridge 171:3a7713b1edbc 359 * @param slaveConfig Pointer to the slave configuration structure.
AnnaBridge 171:3a7713b1edbc 360 */
AnnaBridge 171:3a7713b1edbc 361 void I2C_SlaveGetDefaultConfig(i2c_slave_config_t *slaveConfig);
AnnaBridge 171:3a7713b1edbc 362
AnnaBridge 171:3a7713b1edbc 363 /*!
AnnaBridge 171:3a7713b1edbc 364 * @brief Enables or disabless the I2C peripheral operation.
AnnaBridge 171:3a7713b1edbc 365 *
AnnaBridge 171:3a7713b1edbc 366 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 367 * @param enable pass true to enable module, false to disable module
AnnaBridge 171:3a7713b1edbc 368 */
AnnaBridge 171:3a7713b1edbc 369 static inline void I2C_Enable(I2C_Type *base, bool enable)
AnnaBridge 171:3a7713b1edbc 370 {
AnnaBridge 171:3a7713b1edbc 371 if (enable)
AnnaBridge 171:3a7713b1edbc 372 {
AnnaBridge 171:3a7713b1edbc 373 base->C1 |= I2C_C1_IICEN_MASK;
AnnaBridge 171:3a7713b1edbc 374 }
AnnaBridge 171:3a7713b1edbc 375 else
AnnaBridge 171:3a7713b1edbc 376 {
AnnaBridge 171:3a7713b1edbc 377 base->C1 &= ~I2C_C1_IICEN_MASK;
AnnaBridge 171:3a7713b1edbc 378 }
AnnaBridge 171:3a7713b1edbc 379 }
AnnaBridge 171:3a7713b1edbc 380
AnnaBridge 171:3a7713b1edbc 381 /* @} */
AnnaBridge 171:3a7713b1edbc 382
AnnaBridge 171:3a7713b1edbc 383 /*!
AnnaBridge 171:3a7713b1edbc 384 * @name Status
AnnaBridge 171:3a7713b1edbc 385 * @{
AnnaBridge 171:3a7713b1edbc 386 */
AnnaBridge 171:3a7713b1edbc 387
AnnaBridge 171:3a7713b1edbc 388 /*!
AnnaBridge 171:3a7713b1edbc 389 * @brief Gets the I2C status flags.
AnnaBridge 171:3a7713b1edbc 390 *
AnnaBridge 171:3a7713b1edbc 391 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 392 * @return status flag, use status flag to AND #_i2c_flags could get the related status.
AnnaBridge 171:3a7713b1edbc 393 */
AnnaBridge 171:3a7713b1edbc 394 uint32_t I2C_MasterGetStatusFlags(I2C_Type *base);
AnnaBridge 171:3a7713b1edbc 395
AnnaBridge 171:3a7713b1edbc 396 /*!
AnnaBridge 171:3a7713b1edbc 397 * @brief Gets the I2C status flags.
AnnaBridge 171:3a7713b1edbc 398 *
AnnaBridge 171:3a7713b1edbc 399 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 400 * @return status flag, use status flag to AND #_i2c_flags could get the related status.
AnnaBridge 171:3a7713b1edbc 401 */
AnnaBridge 171:3a7713b1edbc 402 static inline uint32_t I2C_SlaveGetStatusFlags(I2C_Type *base)
AnnaBridge 171:3a7713b1edbc 403 {
AnnaBridge 171:3a7713b1edbc 404 return I2C_MasterGetStatusFlags(base);
AnnaBridge 171:3a7713b1edbc 405 }
AnnaBridge 171:3a7713b1edbc 406
AnnaBridge 171:3a7713b1edbc 407 /*!
AnnaBridge 171:3a7713b1edbc 408 * @brief Clears the I2C status flag state.
AnnaBridge 171:3a7713b1edbc 409 *
AnnaBridge 171:3a7713b1edbc 410 * The following status register flags can be cleared: kI2C_ArbitrationLostFlag and kI2C_IntPendingFlag
AnnaBridge 171:3a7713b1edbc 411 *
AnnaBridge 171:3a7713b1edbc 412 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 413 * @param statusMask The status flag mask, defined in type i2c_status_flag_t.
AnnaBridge 171:3a7713b1edbc 414 * The parameter could be any combination of the following values:
AnnaBridge 171:3a7713b1edbc 415 * @arg kI2C_StartDetectFlag (if available)
AnnaBridge 171:3a7713b1edbc 416 * @arg kI2C_StopDetectFlag (if available)
AnnaBridge 171:3a7713b1edbc 417 * @arg kI2C_ArbitrationLostFlag
AnnaBridge 171:3a7713b1edbc 418 * @arg kI2C_IntPendingFlagFlag
AnnaBridge 171:3a7713b1edbc 419 */
AnnaBridge 171:3a7713b1edbc 420 static inline void I2C_MasterClearStatusFlags(I2C_Type *base, uint32_t statusMask)
AnnaBridge 171:3a7713b1edbc 421 {
AnnaBridge 171:3a7713b1edbc 422 /* Must clear the STARTF / STOPF bits prior to clearing IICIF */
AnnaBridge 171:3a7713b1edbc 423 #if defined(FSL_FEATURE_I2C_HAS_START_STOP_DETECT) && FSL_FEATURE_I2C_HAS_START_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 424 if (statusMask & kI2C_StartDetectFlag)
AnnaBridge 171:3a7713b1edbc 425 {
AnnaBridge 171:3a7713b1edbc 426 /* Shift the odd-ball flags back into place. */
AnnaBridge 171:3a7713b1edbc 427 base->FLT |= (uint8_t)(statusMask >> 8U);
AnnaBridge 171:3a7713b1edbc 428 }
AnnaBridge 171:3a7713b1edbc 429 #endif
AnnaBridge 171:3a7713b1edbc 430
AnnaBridge 171:3a7713b1edbc 431 #ifdef I2C_HAS_STOP_DETECT
AnnaBridge 171:3a7713b1edbc 432 if (statusMask & kI2C_StopDetectFlag)
AnnaBridge 171:3a7713b1edbc 433 {
AnnaBridge 171:3a7713b1edbc 434 /* Shift the odd-ball flags back into place. */
AnnaBridge 171:3a7713b1edbc 435 base->FLT |= (uint8_t)(statusMask >> 8U);
AnnaBridge 171:3a7713b1edbc 436 }
AnnaBridge 171:3a7713b1edbc 437 #endif
AnnaBridge 171:3a7713b1edbc 438
AnnaBridge 171:3a7713b1edbc 439 base->S = (uint8_t)statusMask;
AnnaBridge 171:3a7713b1edbc 440 }
AnnaBridge 171:3a7713b1edbc 441
AnnaBridge 171:3a7713b1edbc 442 /*!
AnnaBridge 171:3a7713b1edbc 443 * @brief Clears the I2C status flag state.
AnnaBridge 171:3a7713b1edbc 444 *
AnnaBridge 171:3a7713b1edbc 445 * The following status register flags can be cleared: kI2C_ArbitrationLostFlag and kI2C_IntPendingFlag
AnnaBridge 171:3a7713b1edbc 446 *
AnnaBridge 171:3a7713b1edbc 447 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 448 * @param statusMask The status flag mask, defined in type i2c_status_flag_t.
AnnaBridge 171:3a7713b1edbc 449 * The parameter could be any combination of the following values:
AnnaBridge 171:3a7713b1edbc 450 * @arg kI2C_StartDetectFlag (if available)
AnnaBridge 171:3a7713b1edbc 451 * @arg kI2C_StopDetectFlag (if available)
AnnaBridge 171:3a7713b1edbc 452 * @arg kI2C_ArbitrationLostFlag
AnnaBridge 171:3a7713b1edbc 453 * @arg kI2C_IntPendingFlagFlag
AnnaBridge 171:3a7713b1edbc 454 */
AnnaBridge 171:3a7713b1edbc 455 static inline void I2C_SlaveClearStatusFlags(I2C_Type *base, uint32_t statusMask)
AnnaBridge 171:3a7713b1edbc 456 {
AnnaBridge 171:3a7713b1edbc 457 I2C_MasterClearStatusFlags(base, statusMask);
AnnaBridge 171:3a7713b1edbc 458 }
AnnaBridge 171:3a7713b1edbc 459
AnnaBridge 171:3a7713b1edbc 460 /* @} */
AnnaBridge 171:3a7713b1edbc 461
AnnaBridge 171:3a7713b1edbc 462 /*!
AnnaBridge 171:3a7713b1edbc 463 * @name Interrupts
AnnaBridge 171:3a7713b1edbc 464 * @{
AnnaBridge 171:3a7713b1edbc 465 */
AnnaBridge 171:3a7713b1edbc 466
AnnaBridge 171:3a7713b1edbc 467 /*!
AnnaBridge 171:3a7713b1edbc 468 * @brief Enables I2C interrupt requests.
AnnaBridge 171:3a7713b1edbc 469 *
AnnaBridge 171:3a7713b1edbc 470 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 471 * @param mask interrupt source
AnnaBridge 171:3a7713b1edbc 472 * The parameter can be combination of the following source if defined:
AnnaBridge 171:3a7713b1edbc 473 * @arg kI2C_GlobalInterruptEnable
AnnaBridge 171:3a7713b1edbc 474 * @arg kI2C_StopDetectInterruptEnable/kI2C_StartDetectInterruptEnable
AnnaBridge 171:3a7713b1edbc 475 * @arg kI2C_SdaTimeoutInterruptEnable
AnnaBridge 171:3a7713b1edbc 476 */
AnnaBridge 171:3a7713b1edbc 477 void I2C_EnableInterrupts(I2C_Type *base, uint32_t mask);
AnnaBridge 171:3a7713b1edbc 478
AnnaBridge 171:3a7713b1edbc 479 /*!
AnnaBridge 171:3a7713b1edbc 480 * @brief Disables I2C interrupt requests.
AnnaBridge 171:3a7713b1edbc 481 *
AnnaBridge 171:3a7713b1edbc 482 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 483 * @param mask interrupt source
AnnaBridge 171:3a7713b1edbc 484 * The parameter can be combination of the following source if defined:
AnnaBridge 171:3a7713b1edbc 485 * @arg kI2C_GlobalInterruptEnable
AnnaBridge 171:3a7713b1edbc 486 * @arg kI2C_StopDetectInterruptEnable/kI2C_StartDetectInterruptEnable
AnnaBridge 171:3a7713b1edbc 487 * @arg kI2C_SdaTimeoutInterruptEnable
AnnaBridge 171:3a7713b1edbc 488 */
AnnaBridge 171:3a7713b1edbc 489 void I2C_DisableInterrupts(I2C_Type *base, uint32_t mask);
AnnaBridge 171:3a7713b1edbc 490
AnnaBridge 171:3a7713b1edbc 491 /*!
AnnaBridge 171:3a7713b1edbc 492 * @name DMA Control
AnnaBridge 171:3a7713b1edbc 493 * @{
AnnaBridge 171:3a7713b1edbc 494 */
AnnaBridge 171:3a7713b1edbc 495 #if defined(FSL_FEATURE_I2C_HAS_DMA_SUPPORT) && FSL_FEATURE_I2C_HAS_DMA_SUPPORT
AnnaBridge 171:3a7713b1edbc 496 /*!
AnnaBridge 171:3a7713b1edbc 497 * @brief Enables/disables the I2C DMA interrupt.
AnnaBridge 171:3a7713b1edbc 498 *
AnnaBridge 171:3a7713b1edbc 499 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 500 * @param enable true to enable, false to disable
AnnaBridge 171:3a7713b1edbc 501 */
AnnaBridge 171:3a7713b1edbc 502 static inline void I2C_EnableDMA(I2C_Type *base, bool enable)
AnnaBridge 171:3a7713b1edbc 503 {
AnnaBridge 171:3a7713b1edbc 504 if (enable)
AnnaBridge 171:3a7713b1edbc 505 {
AnnaBridge 171:3a7713b1edbc 506 base->C1 |= I2C_C1_DMAEN_MASK;
AnnaBridge 171:3a7713b1edbc 507 }
AnnaBridge 171:3a7713b1edbc 508 else
AnnaBridge 171:3a7713b1edbc 509 {
AnnaBridge 171:3a7713b1edbc 510 base->C1 &= ~I2C_C1_DMAEN_MASK;
AnnaBridge 171:3a7713b1edbc 511 }
AnnaBridge 171:3a7713b1edbc 512 }
AnnaBridge 171:3a7713b1edbc 513
AnnaBridge 171:3a7713b1edbc 514 #endif /* FSL_FEATURE_I2C_HAS_DMA_SUPPORT */
AnnaBridge 171:3a7713b1edbc 515
AnnaBridge 171:3a7713b1edbc 516 /*!
AnnaBridge 171:3a7713b1edbc 517 * @brief Gets the I2C tx/rx data register address. This API is used to provide a transfer address
AnnaBridge 171:3a7713b1edbc 518 * for I2C DMA transfer configuration.
AnnaBridge 171:3a7713b1edbc 519 *
AnnaBridge 171:3a7713b1edbc 520 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 521 * @return data register address
AnnaBridge 171:3a7713b1edbc 522 */
AnnaBridge 171:3a7713b1edbc 523 static inline uint32_t I2C_GetDataRegAddr(I2C_Type *base)
AnnaBridge 171:3a7713b1edbc 524 {
AnnaBridge 171:3a7713b1edbc 525 return (uint32_t)(&(base->D));
AnnaBridge 171:3a7713b1edbc 526 }
AnnaBridge 171:3a7713b1edbc 527
AnnaBridge 171:3a7713b1edbc 528 /* @} */
AnnaBridge 171:3a7713b1edbc 529 /*!
AnnaBridge 171:3a7713b1edbc 530 * @name Bus Operations
AnnaBridge 171:3a7713b1edbc 531 * @{
AnnaBridge 171:3a7713b1edbc 532 */
AnnaBridge 171:3a7713b1edbc 533
AnnaBridge 171:3a7713b1edbc 534 /*!
AnnaBridge 171:3a7713b1edbc 535 * @brief Sets the I2C master transfer baud rate.
AnnaBridge 171:3a7713b1edbc 536 *
AnnaBridge 171:3a7713b1edbc 537 * @param base I2C base pointer
AnnaBridge 171:3a7713b1edbc 538 * @param baudRate_Bps the baud rate value in bps
AnnaBridge 171:3a7713b1edbc 539 * @param srcClock_Hz Source clock
AnnaBridge 171:3a7713b1edbc 540 */
AnnaBridge 171:3a7713b1edbc 541 void I2C_MasterSetBaudRate(I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz);
AnnaBridge 171:3a7713b1edbc 542
AnnaBridge 171:3a7713b1edbc 543 /*!
AnnaBridge 171:3a7713b1edbc 544 * @brief Sends a START on the I2C bus.
AnnaBridge 171:3a7713b1edbc 545 *
AnnaBridge 171:3a7713b1edbc 546 * This function is used to initiate a new master mode transfer by sending the START signal.
AnnaBridge 171:3a7713b1edbc 547 * The slave address is sent following the I2C START signal.
AnnaBridge 171:3a7713b1edbc 548 *
AnnaBridge 171:3a7713b1edbc 549 * @param base I2C peripheral base pointer
AnnaBridge 171:3a7713b1edbc 550 * @param address 7-bit slave device address.
AnnaBridge 171:3a7713b1edbc 551 * @param direction Master transfer directions(transmit/receive).
AnnaBridge 171:3a7713b1edbc 552 * @retval kStatus_Success Successfully send the start signal.
AnnaBridge 171:3a7713b1edbc 553 * @retval kStatus_I2C_Busy Current bus is busy.
AnnaBridge 171:3a7713b1edbc 554 */
AnnaBridge 171:3a7713b1edbc 555 status_t I2C_MasterStart(I2C_Type *base, uint8_t address, i2c_direction_t direction);
AnnaBridge 171:3a7713b1edbc 556
AnnaBridge 171:3a7713b1edbc 557 /*!
AnnaBridge 171:3a7713b1edbc 558 * @brief Sends a STOP signal on the I2C bus.
AnnaBridge 171:3a7713b1edbc 559 *
AnnaBridge 171:3a7713b1edbc 560 * @retval kStatus_Success Successfully send the stop signal.
AnnaBridge 171:3a7713b1edbc 561 * @retval kStatus_I2C_Timeout Send stop signal failed, timeout.
AnnaBridge 171:3a7713b1edbc 562 */
AnnaBridge 171:3a7713b1edbc 563 status_t I2C_MasterStop(I2C_Type *base);
AnnaBridge 171:3a7713b1edbc 564
AnnaBridge 171:3a7713b1edbc 565 /*!
AnnaBridge 171:3a7713b1edbc 566 * @brief Sends a REPEATED START on the I2C bus.
AnnaBridge 171:3a7713b1edbc 567 *
AnnaBridge 171:3a7713b1edbc 568 * @param base I2C peripheral base pointer
AnnaBridge 171:3a7713b1edbc 569 * @param address 7-bit slave device address.
AnnaBridge 171:3a7713b1edbc 570 * @param direction Master transfer directions(transmit/receive).
AnnaBridge 171:3a7713b1edbc 571 * @retval kStatus_Success Successfully send the start signal.
AnnaBridge 171:3a7713b1edbc 572 * @retval kStatus_I2C_Busy Current bus is busy but not occupied by current I2C master.
AnnaBridge 171:3a7713b1edbc 573 */
AnnaBridge 171:3a7713b1edbc 574 status_t I2C_MasterRepeatedStart(I2C_Type *base, uint8_t address, i2c_direction_t direction);
AnnaBridge 171:3a7713b1edbc 575
AnnaBridge 171:3a7713b1edbc 576 /*!
AnnaBridge 171:3a7713b1edbc 577 * @brief Performs a polling send transaction on the I2C bus without a STOP signal.
AnnaBridge 171:3a7713b1edbc 578 *
AnnaBridge 171:3a7713b1edbc 579 * @param base The I2C peripheral base pointer.
AnnaBridge 171:3a7713b1edbc 580 * @param txBuff The pointer to the data to be transferred.
AnnaBridge 171:3a7713b1edbc 581 * @param txSize The length in bytes of the data to be transferred.
AnnaBridge 171:3a7713b1edbc 582 * @retval kStatus_Success Successfully complete the data transmission.
AnnaBridge 171:3a7713b1edbc 583 * @retval kStatus_I2C_ArbitrationLost Transfer error, arbitration lost.
AnnaBridge 171:3a7713b1edbc 584 * @retval kStataus_I2C_Nak Transfer error, receive NAK during transfer.
AnnaBridge 171:3a7713b1edbc 585 */
AnnaBridge 171:3a7713b1edbc 586 status_t I2C_MasterWriteBlocking(I2C_Type *base, const uint8_t *txBuff, size_t txSize);
AnnaBridge 171:3a7713b1edbc 587
AnnaBridge 171:3a7713b1edbc 588 /*!
AnnaBridge 171:3a7713b1edbc 589 * @brief Performs a polling receive transaction on the I2C bus with a STOP signal.
AnnaBridge 171:3a7713b1edbc 590 *
AnnaBridge 171:3a7713b1edbc 591 * @note The I2C_MasterReadBlocking function stops the bus before reading the final byte.
AnnaBridge 171:3a7713b1edbc 592 * Without stopping the bus prior for the final read, the bus issues another read, resulting
AnnaBridge 171:3a7713b1edbc 593 * in garbage data being read into the data register.
AnnaBridge 171:3a7713b1edbc 594 *
AnnaBridge 171:3a7713b1edbc 595 * @param base I2C peripheral base pointer.
AnnaBridge 171:3a7713b1edbc 596 * @param rxBuff The pointer to the data to store the received data.
AnnaBridge 171:3a7713b1edbc 597 * @param rxSize The length in bytes of the data to be received.
AnnaBridge 171:3a7713b1edbc 598 * @retval kStatus_Success Successfully complete the data transmission.
AnnaBridge 171:3a7713b1edbc 599 * @retval kStatus_I2C_Timeout Send stop signal failed, timeout.
AnnaBridge 171:3a7713b1edbc 600 */
AnnaBridge 171:3a7713b1edbc 601 status_t I2C_MasterReadBlocking(I2C_Type *base, uint8_t *rxBuff, size_t rxSize);
AnnaBridge 171:3a7713b1edbc 602
AnnaBridge 171:3a7713b1edbc 603 /*!
AnnaBridge 171:3a7713b1edbc 604 * @brief Performs a polling send transaction on the I2C bus.
AnnaBridge 171:3a7713b1edbc 605 *
AnnaBridge 171:3a7713b1edbc 606 * @param base The I2C peripheral base pointer.
AnnaBridge 171:3a7713b1edbc 607 * @param txBuff The pointer to the data to be transferred.
AnnaBridge 171:3a7713b1edbc 608 * @param txSize The length in bytes of the data to be transferred.
AnnaBridge 171:3a7713b1edbc 609 * @retval kStatus_Success Successfully complete the data transmission.
AnnaBridge 171:3a7713b1edbc 610 * @retval kStatus_I2C_ArbitrationLost Transfer error, arbitration lost.
AnnaBridge 171:3a7713b1edbc 611 * @retval kStataus_I2C_Nak Transfer error, receive NAK during transfer.
AnnaBridge 171:3a7713b1edbc 612 */
AnnaBridge 171:3a7713b1edbc 613 status_t I2C_SlaveWriteBlocking(I2C_Type *base, const uint8_t *txBuff, size_t txSize);
AnnaBridge 171:3a7713b1edbc 614
AnnaBridge 171:3a7713b1edbc 615 /*!
AnnaBridge 171:3a7713b1edbc 616 * @brief Performs a polling receive transaction on the I2C bus.
AnnaBridge 171:3a7713b1edbc 617 *
AnnaBridge 171:3a7713b1edbc 618 * @param base I2C peripheral base pointer.
AnnaBridge 171:3a7713b1edbc 619 * @param rxBuff The pointer to the data to store the received data.
AnnaBridge 171:3a7713b1edbc 620 * @param rxSize The length in bytes of the data to be received.
AnnaBridge 171:3a7713b1edbc 621 */
AnnaBridge 171:3a7713b1edbc 622 void I2C_SlaveReadBlocking(I2C_Type *base, uint8_t *rxBuff, size_t rxSize);
AnnaBridge 171:3a7713b1edbc 623
AnnaBridge 171:3a7713b1edbc 624 /*!
AnnaBridge 171:3a7713b1edbc 625 * @brief Performs a master polling transfer on the I2C bus.
AnnaBridge 171:3a7713b1edbc 626 *
AnnaBridge 171:3a7713b1edbc 627 * @note The API does not return until the transfer succeeds or fails due
AnnaBridge 171:3a7713b1edbc 628 * to arbitration lost or receiving a NAK.
AnnaBridge 171:3a7713b1edbc 629 *
AnnaBridge 171:3a7713b1edbc 630 * @param base I2C peripheral base address.
AnnaBridge 171:3a7713b1edbc 631 * @param xfer Pointer to the transfer structure.
AnnaBridge 171:3a7713b1edbc 632 * @retval kStatus_Success Successfully complete the data transmission.
AnnaBridge 171:3a7713b1edbc 633 * @retval kStatus_I2C_Busy Previous transmission still not finished.
AnnaBridge 171:3a7713b1edbc 634 * @retval kStatus_I2C_Timeout Transfer error, wait signal timeout.
AnnaBridge 171:3a7713b1edbc 635 * @retval kStatus_I2C_ArbitrationLost Transfer error, arbitration lost.
AnnaBridge 171:3a7713b1edbc 636 * @retval kStataus_I2C_Nak Transfer error, receive NAK during transfer.
AnnaBridge 171:3a7713b1edbc 637 */
AnnaBridge 171:3a7713b1edbc 638 status_t I2C_MasterTransferBlocking(I2C_Type *base, i2c_master_transfer_t *xfer);
AnnaBridge 171:3a7713b1edbc 639
AnnaBridge 171:3a7713b1edbc 640 /* @} */
AnnaBridge 171:3a7713b1edbc 641
AnnaBridge 171:3a7713b1edbc 642 /*!
AnnaBridge 171:3a7713b1edbc 643 * @name Transactional
AnnaBridge 171:3a7713b1edbc 644 * @{
AnnaBridge 171:3a7713b1edbc 645 */
AnnaBridge 171:3a7713b1edbc 646
AnnaBridge 171:3a7713b1edbc 647 /*!
AnnaBridge 171:3a7713b1edbc 648 * @brief Initializes the I2C handle which is used in transactional functions.
AnnaBridge 171:3a7713b1edbc 649 *
AnnaBridge 171:3a7713b1edbc 650 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 651 * @param handle pointer to i2c_master_handle_t structure to store the transfer state.
AnnaBridge 171:3a7713b1edbc 652 * @param callback pointer to user callback function.
AnnaBridge 171:3a7713b1edbc 653 * @param userData user paramater passed to the callback function.
AnnaBridge 171:3a7713b1edbc 654 */
AnnaBridge 171:3a7713b1edbc 655 void I2C_MasterTransferCreateHandle(I2C_Type *base,
AnnaBridge 171:3a7713b1edbc 656 i2c_master_handle_t *handle,
AnnaBridge 171:3a7713b1edbc 657 i2c_master_transfer_callback_t callback,
AnnaBridge 171:3a7713b1edbc 658 void *userData);
AnnaBridge 171:3a7713b1edbc 659
AnnaBridge 171:3a7713b1edbc 660 /*!
AnnaBridge 171:3a7713b1edbc 661 * @brief Performs a master interrupt non-blocking transfer on the I2C bus.
AnnaBridge 171:3a7713b1edbc 662 *
AnnaBridge 171:3a7713b1edbc 663 * @note Calling the API will return immediately after transfer initiates, user needs
AnnaBridge 171:3a7713b1edbc 664 * to call I2C_MasterGetTransferCount to poll the transfer status to check whether
AnnaBridge 171:3a7713b1edbc 665 * the transfer is finished, if the return status is not kStatus_I2C_Busy, the transfer
AnnaBridge 171:3a7713b1edbc 666 * is finished.
AnnaBridge 171:3a7713b1edbc 667 *
AnnaBridge 171:3a7713b1edbc 668 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 669 * @param handle pointer to i2c_master_handle_t structure which stores the transfer state.
AnnaBridge 171:3a7713b1edbc 670 * @param xfer pointer to i2c_master_transfer_t structure.
AnnaBridge 171:3a7713b1edbc 671 * @retval kStatus_Success Sucessully start the data transmission.
AnnaBridge 171:3a7713b1edbc 672 * @retval kStatus_I2C_Busy Previous transmission still not finished.
AnnaBridge 171:3a7713b1edbc 673 * @retval kStatus_I2C_Timeout Transfer error, wait signal timeout.
AnnaBridge 171:3a7713b1edbc 674 */
AnnaBridge 171:3a7713b1edbc 675 status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer);
AnnaBridge 171:3a7713b1edbc 676
AnnaBridge 171:3a7713b1edbc 677 /*!
AnnaBridge 171:3a7713b1edbc 678 * @brief Gets the master transfer status during a interrupt non-blocking transfer.
AnnaBridge 171:3a7713b1edbc 679 *
AnnaBridge 171:3a7713b1edbc 680 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 681 * @param handle pointer to i2c_master_handle_t structure which stores the transfer state.
AnnaBridge 171:3a7713b1edbc 682 * @param count Number of bytes transferred so far by the non-blocking transaction.
AnnaBridge 171:3a7713b1edbc 683 * @retval kStatus_InvalidArgument count is Invalid.
AnnaBridge 171:3a7713b1edbc 684 * @retval kStatus_Success Successfully return the count.
AnnaBridge 171:3a7713b1edbc 685 */
AnnaBridge 171:3a7713b1edbc 686 status_t I2C_MasterTransferGetCount(I2C_Type *base, i2c_master_handle_t *handle, size_t *count);
AnnaBridge 171:3a7713b1edbc 687
AnnaBridge 171:3a7713b1edbc 688 /*!
AnnaBridge 171:3a7713b1edbc 689 * @brief Aborts an interrupt non-blocking transfer early.
AnnaBridge 171:3a7713b1edbc 690 *
AnnaBridge 171:3a7713b1edbc 691 * @note This API can be called at any time when an interrupt non-blocking transfer initiates
AnnaBridge 171:3a7713b1edbc 692 * to abort the transfer early.
AnnaBridge 171:3a7713b1edbc 693 *
AnnaBridge 171:3a7713b1edbc 694 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 695 * @param handle pointer to i2c_master_handle_t structure which stores the transfer state
AnnaBridge 171:3a7713b1edbc 696 */
AnnaBridge 171:3a7713b1edbc 697 void I2C_MasterTransferAbort(I2C_Type *base, i2c_master_handle_t *handle);
AnnaBridge 171:3a7713b1edbc 698
AnnaBridge 171:3a7713b1edbc 699 /*!
AnnaBridge 171:3a7713b1edbc 700 * @brief Master interrupt handler.
AnnaBridge 171:3a7713b1edbc 701 *
AnnaBridge 171:3a7713b1edbc 702 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 703 * @param i2cHandle pointer to i2c_master_handle_t structure.
AnnaBridge 171:3a7713b1edbc 704 */
AnnaBridge 171:3a7713b1edbc 705 void I2C_MasterTransferHandleIRQ(I2C_Type *base, void *i2cHandle);
AnnaBridge 171:3a7713b1edbc 706
AnnaBridge 171:3a7713b1edbc 707 /*!
AnnaBridge 171:3a7713b1edbc 708 * @brief Initializes the I2C handle which is used in transactional functions.
AnnaBridge 171:3a7713b1edbc 709 *
AnnaBridge 171:3a7713b1edbc 710 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 711 * @param handle pointer to i2c_slave_handle_t structure to store the transfer state.
AnnaBridge 171:3a7713b1edbc 712 * @param callback pointer to user callback function.
AnnaBridge 171:3a7713b1edbc 713 * @param userData user parameter passed to the callback function.
AnnaBridge 171:3a7713b1edbc 714 */
AnnaBridge 171:3a7713b1edbc 715 void I2C_SlaveTransferCreateHandle(I2C_Type *base,
AnnaBridge 171:3a7713b1edbc 716 i2c_slave_handle_t *handle,
AnnaBridge 171:3a7713b1edbc 717 i2c_slave_transfer_callback_t callback,
AnnaBridge 171:3a7713b1edbc 718 void *userData);
AnnaBridge 171:3a7713b1edbc 719
AnnaBridge 171:3a7713b1edbc 720 /*!
AnnaBridge 171:3a7713b1edbc 721 * @brief Starts accepting slave transfers.
AnnaBridge 171:3a7713b1edbc 722 *
AnnaBridge 171:3a7713b1edbc 723 * Call this API after calling the I2C_SlaveInit() and I2C_SlaveTransferCreateHandle() to start processing
AnnaBridge 171:3a7713b1edbc 724 * transactions driven by an I2C master. The slave monitors the I2C bus and passes events to the
AnnaBridge 171:3a7713b1edbc 725 * callback that was passed into the call to I2C_SlaveTransferCreateHandle(). The callback is always invoked
AnnaBridge 171:3a7713b1edbc 726 * from the interrupt context.
AnnaBridge 171:3a7713b1edbc 727 *
AnnaBridge 171:3a7713b1edbc 728 * The set of events received by the callback is customizable. To do so, set the @a eventMask parameter to
AnnaBridge 171:3a7713b1edbc 729 * the OR'd combination of #i2c_slave_transfer_event_t enumerators for the events you wish to receive.
AnnaBridge 171:3a7713b1edbc 730 * The #kI2C_SlaveTransmitEvent and #kLPI2C_SlaveReceiveEvent events are always enabled and do not need
AnnaBridge 171:3a7713b1edbc 731 * to be included in the mask. Alternatively, pass 0 to get a default set of only the transmit and
AnnaBridge 171:3a7713b1edbc 732 * receive events that are always enabled. In addition, the #kI2C_SlaveAllEvents constant is provided as
AnnaBridge 171:3a7713b1edbc 733 * a convenient way to enable all events.
AnnaBridge 171:3a7713b1edbc 734 *
AnnaBridge 171:3a7713b1edbc 735 * @param base The I2C peripheral base address.
AnnaBridge 171:3a7713b1edbc 736 * @param handle Pointer to #i2c_slave_handle_t structure which stores the transfer state.
AnnaBridge 171:3a7713b1edbc 737 * @param eventMask Bit mask formed by OR'ing together #i2c_slave_transfer_event_t enumerators to specify
AnnaBridge 171:3a7713b1edbc 738 * which events to send to the callback. Other accepted values are 0 to get a default set of
AnnaBridge 171:3a7713b1edbc 739 * only the transmit and receive events, and #kI2C_SlaveAllEvents to enable all events.
AnnaBridge 171:3a7713b1edbc 740 *
AnnaBridge 171:3a7713b1edbc 741 * @retval #kStatus_Success Slave transfers were successfully started.
AnnaBridge 171:3a7713b1edbc 742 * @retval #kStatus_I2C_Busy Slave transfers have already been started on this handle.
AnnaBridge 171:3a7713b1edbc 743 */
AnnaBridge 171:3a7713b1edbc 744 status_t I2C_SlaveTransferNonBlocking(I2C_Type *base, i2c_slave_handle_t *handle, uint32_t eventMask);
AnnaBridge 171:3a7713b1edbc 745
AnnaBridge 171:3a7713b1edbc 746 /*!
AnnaBridge 171:3a7713b1edbc 747 * @brief Aborts the slave transfer.
AnnaBridge 171:3a7713b1edbc 748 *
AnnaBridge 171:3a7713b1edbc 749 * @note This API can be called at any time to stop slave for handling the bus events.
AnnaBridge 171:3a7713b1edbc 750 *
AnnaBridge 171:3a7713b1edbc 751 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 752 * @param handle pointer to i2c_slave_handle_t structure which stores the transfer state.
AnnaBridge 171:3a7713b1edbc 753 */
AnnaBridge 171:3a7713b1edbc 754 void I2C_SlaveTransferAbort(I2C_Type *base, i2c_slave_handle_t *handle);
AnnaBridge 171:3a7713b1edbc 755
AnnaBridge 171:3a7713b1edbc 756 /*!
AnnaBridge 171:3a7713b1edbc 757 * @brief Gets the slave transfer remaining bytes during a interrupt non-blocking transfer.
AnnaBridge 171:3a7713b1edbc 758 *
AnnaBridge 171:3a7713b1edbc 759 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 760 * @param handle pointer to i2c_slave_handle_t structure.
AnnaBridge 171:3a7713b1edbc 761 * @param count Number of bytes transferred so far by the non-blocking transaction.
AnnaBridge 171:3a7713b1edbc 762 * @retval kStatus_InvalidArgument count is Invalid.
AnnaBridge 171:3a7713b1edbc 763 * @retval kStatus_Success Successfully return the count.
AnnaBridge 171:3a7713b1edbc 764 */
AnnaBridge 171:3a7713b1edbc 765 status_t I2C_SlaveTransferGetCount(I2C_Type *base, i2c_slave_handle_t *handle, size_t *count);
AnnaBridge 171:3a7713b1edbc 766
AnnaBridge 171:3a7713b1edbc 767 /*!
AnnaBridge 171:3a7713b1edbc 768 * @brief Slave interrupt handler.
AnnaBridge 171:3a7713b1edbc 769 *
AnnaBridge 171:3a7713b1edbc 770 * @param base I2C base pointer.
AnnaBridge 171:3a7713b1edbc 771 * @param i2cHandle pointer to i2c_slave_handle_t structure which stores the transfer state
AnnaBridge 171:3a7713b1edbc 772 */
AnnaBridge 171:3a7713b1edbc 773 void I2C_SlaveTransferHandleIRQ(I2C_Type *base, void *i2cHandle);
AnnaBridge 171:3a7713b1edbc 774
AnnaBridge 171:3a7713b1edbc 775 /* @} */
AnnaBridge 171:3a7713b1edbc 776 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 777 }
AnnaBridge 171:3a7713b1edbc 778 #endif /*_cplusplus. */
AnnaBridge 171:3a7713b1edbc 779 /*@}*/
AnnaBridge 171:3a7713b1edbc 780
AnnaBridge 171:3a7713b1edbc 781 #endif /* _FSL_I2C_H_*/