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.
TARGET_SAMD21G18A/TOOLCHAIN_ARM_MICRO/i2c_common.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
- Parent:
- TARGET_SAMD21G18A/TARGET_Atmel/TARGET_SAM_CortexM0P/drivers/sercom/i2c/i2c_common.h@111:4336505e4b1c
mbed library. Release version 164
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 111:4336505e4b1c | 1 | /** |
Kojto | 111:4336505e4b1c | 2 | * \file |
Kojto | 111:4336505e4b1c | 3 | * |
Kojto | 111:4336505e4b1c | 4 | * \brief SAM SERCOM I2C Common Driver |
Kojto | 111:4336505e4b1c | 5 | * |
Kojto | 111:4336505e4b1c | 6 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved. |
Kojto | 111:4336505e4b1c | 7 | * |
Kojto | 111:4336505e4b1c | 8 | * \asf_license_start |
Kojto | 111:4336505e4b1c | 9 | * |
Kojto | 111:4336505e4b1c | 10 | * \page License |
Kojto | 111:4336505e4b1c | 11 | * |
Kojto | 111:4336505e4b1c | 12 | * Redistribution and use in source and binary forms, with or without |
Kojto | 111:4336505e4b1c | 13 | * modification, are permitted provided that the following conditions are met: |
Kojto | 111:4336505e4b1c | 14 | * |
Kojto | 111:4336505e4b1c | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 111:4336505e4b1c | 16 | * this list of conditions and the following disclaimer. |
Kojto | 111:4336505e4b1c | 17 | * |
Kojto | 111:4336505e4b1c | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 111:4336505e4b1c | 19 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 111:4336505e4b1c | 20 | * and/or other materials provided with the distribution. |
Kojto | 111:4336505e4b1c | 21 | * |
Kojto | 111:4336505e4b1c | 22 | * 3. The name of Atmel may not be used to endorse or promote products derived |
Kojto | 111:4336505e4b1c | 23 | * from this software without specific prior written permission. |
Kojto | 111:4336505e4b1c | 24 | * |
Kojto | 111:4336505e4b1c | 25 | * 4. This software may only be redistributed and used in connection with an |
Kojto | 111:4336505e4b1c | 26 | * Atmel microcontroller product. |
Kojto | 111:4336505e4b1c | 27 | * |
Kojto | 111:4336505e4b1c | 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED |
Kojto | 111:4336505e4b1c | 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
Kojto | 111:4336505e4b1c | 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE |
Kojto | 111:4336505e4b1c | 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR |
Kojto | 111:4336505e4b1c | 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 111:4336505e4b1c | 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
Kojto | 111:4336505e4b1c | 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
Kojto | 111:4336505e4b1c | 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
Kojto | 111:4336505e4b1c | 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
Kojto | 111:4336505e4b1c | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
Kojto | 111:4336505e4b1c | 38 | * POSSIBILITY OF SUCH DAMAGE. |
Kojto | 111:4336505e4b1c | 39 | * |
Kojto | 111:4336505e4b1c | 40 | * \asf_license_stop |
Kojto | 111:4336505e4b1c | 41 | * |
Kojto | 111:4336505e4b1c | 42 | */ |
Kojto | 111:4336505e4b1c | 43 | /* |
Kojto | 111:4336505e4b1c | 44 | * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> |
Kojto | 111:4336505e4b1c | 45 | */ |
Kojto | 111:4336505e4b1c | 46 | #ifndef I2C_COMMON_H_INCLUDED |
Kojto | 111:4336505e4b1c | 47 | #define I2C_COMMON_H_INCLUDED |
Kojto | 111:4336505e4b1c | 48 | |
Kojto | 111:4336505e4b1c | 49 | #include <compiler.h> |
Kojto | 111:4336505e4b1c | 50 | #include <sercom.h> |
Kojto | 111:4336505e4b1c | 51 | |
Kojto | 111:4336505e4b1c | 52 | #ifdef __cplusplus |
Kojto | 111:4336505e4b1c | 53 | extern "C" { |
Kojto | 111:4336505e4b1c | 54 | #endif |
Kojto | 111:4336505e4b1c | 55 | |
Kojto | 111:4336505e4b1c | 56 | /** |
Kojto | 111:4336505e4b1c | 57 | * \if (I2C_MASTER_MODE && I2C_SLAVE_MODE) |
Kojto | 111:4336505e4b1c | 58 | * \defgroup asfdoc_sam0_sercom_i2c_group SAM I2C Driver (SERCOM I2C) |
Kojto | 111:4336505e4b1c | 59 | * \elseif I2C_MASTER_MODE |
Kojto | 111:4336505e4b1c | 60 | * \defgroup asfdoc_sam0_sercom_i2c_group SAM I2C Master Mode Driver (SERCOM I2C) |
Kojto | 111:4336505e4b1c | 61 | * \elseif I2C_SLAVE_MODE |
Kojto | 111:4336505e4b1c | 62 | * \defgroup asfdoc_sam0_sercom_i2c_group SAM I2C Slave Mode Driver (SERCOM I2C) |
Kojto | 111:4336505e4b1c | 63 | * \endif |
Kojto | 111:4336505e4b1c | 64 | * |
Kojto | 111:4336505e4b1c | 65 | * This driver for Atmel® | SMART SAM devices provides an interface for the configuration |
Kojto | 111:4336505e4b1c | 66 | * and management of the device's SERCOM I<SUP>2</SUP>C module, for the transfer |
Kojto | 111:4336505e4b1c | 67 | * of data via an I<SUP>2</SUP>C bus. The following driver API modes are covered |
Kojto | 111:4336505e4b1c | 68 | * by this manual: |
Kojto | 111:4336505e4b1c | 69 | * |
Kojto | 111:4336505e4b1c | 70 | * \if I2C_MASTER_MODE |
Kojto | 111:4336505e4b1c | 71 | * - Master Mode Polled APIs |
Kojto | 111:4336505e4b1c | 72 | * \endif |
Kojto | 111:4336505e4b1c | 73 | * \if I2C_MASTER_CALLBACK_MODE |
Kojto | 111:4336505e4b1c | 74 | * - Master Mode Callback APIs |
Kojto | 111:4336505e4b1c | 75 | * \endif |
Kojto | 111:4336505e4b1c | 76 | * \if I2C_SLAVE_MODE |
Kojto | 111:4336505e4b1c | 77 | * - Slave Mode Polled APIs |
Kojto | 111:4336505e4b1c | 78 | * \endif |
Kojto | 111:4336505e4b1c | 79 | * \if I2C_SLAVE_CALLBACK_MODE |
Kojto | 111:4336505e4b1c | 80 | * - Slave Mode Callback APIs |
Kojto | 111:4336505e4b1c | 81 | * \endif |
Kojto | 111:4336505e4b1c | 82 | * |
Kojto | 111:4336505e4b1c | 83 | * The following peripheral is used by this module: |
Kojto | 111:4336505e4b1c | 84 | * - SERCOM (Serial Communication Interface) |
Kojto | 111:4336505e4b1c | 85 | * |
Kojto | 111:4336505e4b1c | 86 | * The following devices can use this module: |
Kojto | 111:4336505e4b1c | 87 | * - Atmel | SMART SAM D20/D21 |
Kojto | 111:4336505e4b1c | 88 | * - Atmel | SMART SAM R21 |
Kojto | 111:4336505e4b1c | 89 | * - Atmel | SMART SAM D10/D11 |
Kojto | 111:4336505e4b1c | 90 | * - Atmel | SMART SAM L21 |
Kojto | 111:4336505e4b1c | 91 | * - Atmel | SMART SAM DAx |
Kojto | 111:4336505e4b1c | 92 | * - Atmel | SMART SAM C20/C21 |
Kojto | 111:4336505e4b1c | 93 | * |
Kojto | 111:4336505e4b1c | 94 | * The outline of this documentation is as follows: |
Kojto | 111:4336505e4b1c | 95 | * - \ref asfdoc_sam0_sercom_i2c_prerequisites |
Kojto | 111:4336505e4b1c | 96 | * - \ref asfdoc_sam0_sercom_i2c_overview |
Kojto | 111:4336505e4b1c | 97 | * - \ref asfdoc_sam0_sercom_i2c_special_considerations |
Kojto | 111:4336505e4b1c | 98 | * - \ref asfdoc_sam0_sercom_i2c_extra |
Kojto | 111:4336505e4b1c | 99 | * - \ref asfdoc_sam0_sercom_i2c_examples |
Kojto | 111:4336505e4b1c | 100 | * - \ref asfdoc_sam0_sercom_i2c_api_overview |
Kojto | 111:4336505e4b1c | 101 | * |
Kojto | 111:4336505e4b1c | 102 | * \section asfdoc_sam0_sercom_i2c_prerequisites Prerequisites |
Kojto | 111:4336505e4b1c | 103 | * There are no prerequisites. |
Kojto | 111:4336505e4b1c | 104 | * |
Kojto | 111:4336505e4b1c | 105 | * \section asfdoc_sam0_sercom_i2c_overview Module Overview |
Kojto | 111:4336505e4b1c | 106 | * The outline of this section is as follows: |
Kojto | 111:4336505e4b1c | 107 | * - \ref asfdoc_sam0_sercom_i2c_module_features |
Kojto | 111:4336505e4b1c | 108 | * - \ref asfdoc_sam0_sercom_i2c_functional_desc |
Kojto | 111:4336505e4b1c | 109 | * - \ref asfdoc_sam0_sercom_i2c_bus_topology |
Kojto | 111:4336505e4b1c | 110 | * - \ref asfdoc_sam0_sercom_i2c_transactions |
Kojto | 111:4336505e4b1c | 111 | * - \ref asfdoc_sam0_sercom_i2c_multi_master |
Kojto | 111:4336505e4b1c | 112 | * - \ref asfdoc_sam0_sercom_i2c_bus_states |
Kojto | 111:4336505e4b1c | 113 | * - \ref asfdoc_sam0_sercom_i2c_timeout |
Kojto | 111:4336505e4b1c | 114 | * - \ref asfdoc_sam0_sercom_i2c_sleep_modes |
Kojto | 111:4336505e4b1c | 115 | * |
Kojto | 111:4336505e4b1c | 116 | * \subsection asfdoc_sam0_sercom_i2c_module_features Driver Feature Macro Definition |
Kojto | 111:4336505e4b1c | 117 | * <table> |
Kojto | 111:4336505e4b1c | 118 | * <tr> |
Kojto | 111:4336505e4b1c | 119 | * <th>Driver Feature Macro</th> |
Kojto | 111:4336505e4b1c | 120 | * <th>Supported devices</th> |
Kojto | 111:4336505e4b1c | 121 | * </tr> |
Kojto | 111:4336505e4b1c | 122 | * <tr> |
Kojto | 111:4336505e4b1c | 123 | * <td>FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED</td> |
Kojto | 111:4336505e4b1c | 124 | * <td>SAM D21/R21/D10/D11/L21/DAx/C20/C21</td> |
Kojto | 111:4336505e4b1c | 125 | * </tr> |
Kojto | 111:4336505e4b1c | 126 | * <tr> |
Kojto | 111:4336505e4b1c | 127 | * <td>FEATURE_I2C_10_BIT_ADDRESS</td> |
Kojto | 111:4336505e4b1c | 128 | * <td>SAM D21/R21/D10/D11/L21/DAx/C20/C21</td> |
Kojto | 111:4336505e4b1c | 129 | * </tr> |
Kojto | 111:4336505e4b1c | 130 | * <tr> |
Kojto | 111:4336505e4b1c | 131 | * <td>FEATURE_I2C_SCL_STRETCH_MODE</td> |
Kojto | 111:4336505e4b1c | 132 | * <td>SAM D21/R21/D10/D11/L21/DAx/C20/C21</td> |
Kojto | 111:4336505e4b1c | 133 | * </tr> |
Kojto | 111:4336505e4b1c | 134 | * <tr> |
Kojto | 111:4336505e4b1c | 135 | * <td>FEATURE_I2C_SCL_EXTEND_TIMEOUT</td> |
Kojto | 111:4336505e4b1c | 136 | * <td>SAM D21/R21/D10/D11/L21/DAx/C20/C21</td> |
Kojto | 111:4336505e4b1c | 137 | * </tr> |
Kojto | 111:4336505e4b1c | 138 | * </table> |
Kojto | 111:4336505e4b1c | 139 | * \note The specific features are only available in the driver when the |
Kojto | 111:4336505e4b1c | 140 | * selected device supports those features. |
Kojto | 111:4336505e4b1c | 141 | * |
Kojto | 111:4336505e4b1c | 142 | * \subsection asfdoc_sam0_sercom_i2c_functional_desc Functional Description |
Kojto | 111:4336505e4b1c | 143 | * The I<SUP>2</SUP>C provides a simple two-wire bidirectional bus consisting of a |
Kojto | 111:4336505e4b1c | 144 | * wired-AND type serial clock line (SCL) and a wired-AND type serial data line |
Kojto | 111:4336505e4b1c | 145 | * (SDA). |
Kojto | 111:4336505e4b1c | 146 | * |
Kojto | 111:4336505e4b1c | 147 | * The I<SUP>2</SUP>C bus provides a simple, but efficient method of interconnecting |
Kojto | 111:4336505e4b1c | 148 | * multiple master and slave devices. An arbitration mechanism is provided for |
Kojto | 111:4336505e4b1c | 149 | * resolving bus ownership between masters, as only one master device may own |
Kojto | 111:4336505e4b1c | 150 | * the bus at any given time. The arbitration mechanism relies on the wired-AND |
Kojto | 111:4336505e4b1c | 151 | * connections to avoid bus drivers short-circuiting. |
Kojto | 111:4336505e4b1c | 152 | * |
Kojto | 111:4336505e4b1c | 153 | * A unique address is assigned to all slave devices connected to the bus. A |
Kojto | 111:4336505e4b1c | 154 | * device can contain both master and slave logic, and can emulate multiple |
Kojto | 111:4336505e4b1c | 155 | * slave devices by responding to more than one address. |
Kojto | 111:4336505e4b1c | 156 | * |
Kojto | 111:4336505e4b1c | 157 | * \subsection asfdoc_sam0_sercom_i2c_bus_topology Bus Topology |
Kojto | 111:4336505e4b1c | 158 | * The I<SUP>2</SUP>C bus topology is illustrated in |
Kojto | 111:4336505e4b1c | 159 | * \ref asfdoc_sam0_sercom_i2c_bus_topology_figure "the figure below". The pull-up |
Kojto | 111:4336505e4b1c | 160 | * resistors (Rs) will provide a high level on the bus lines when none of the |
Kojto | 111:4336505e4b1c | 161 | * I<SUP>2</SUP>C devices are driving the bus. These are optional, and can be |
Kojto | 111:4336505e4b1c | 162 | * replaced with a constant current source. |
Kojto | 111:4336505e4b1c | 163 | * |
Kojto | 111:4336505e4b1c | 164 | * \anchor asfdoc_sam0_sercom_i2c_bus_topology_figure |
Kojto | 111:4336505e4b1c | 165 | * \image html bus_topology.svg "I2C Bus Topology" Width=100% |
Kojto | 111:4336505e4b1c | 166 | * |
Kojto | 111:4336505e4b1c | 167 | * \subsection asfdoc_sam0_sercom_i2c_transactions Transactions |
Kojto | 111:4336505e4b1c | 168 | * The I<SUP>2</SUP>C standard defines three fundamental transaction formats: |
Kojto | 111:4336505e4b1c | 169 | * - Master Write |
Kojto | 111:4336505e4b1c | 170 | * - The master transmits data packets to the slave after addressing it |
Kojto | 111:4336505e4b1c | 171 | * - Master Read |
Kojto | 111:4336505e4b1c | 172 | * - The slave transmits data packets to the master after being addressed |
Kojto | 111:4336505e4b1c | 173 | * - Combined Read/Write |
Kojto | 111:4336505e4b1c | 174 | * - A combined transaction consists of several write and read transactions |
Kojto | 111:4336505e4b1c | 175 | * |
Kojto | 111:4336505e4b1c | 176 | * A data transfer starts with the master issuing a \b Start condition on the |
Kojto | 111:4336505e4b1c | 177 | * bus, followed by the address of the slave together with a bit to indicate |
Kojto | 111:4336505e4b1c | 178 | * whether the master wants to read from or write to the slave. |
Kojto | 111:4336505e4b1c | 179 | * The addressed slave must respond to this by sending an \b ACK back to the |
Kojto | 111:4336505e4b1c | 180 | * master. |
Kojto | 111:4336505e4b1c | 181 | * |
Kojto | 111:4336505e4b1c | 182 | * After this, data packets are sent from the master or slave, according to the |
Kojto | 111:4336505e4b1c | 183 | * read/write bit. Each packet must be acknowledged (ACK) or not |
Kojto | 111:4336505e4b1c | 184 | * acknowledged (NACK) by the receiver. |
Kojto | 111:4336505e4b1c | 185 | * |
Kojto | 111:4336505e4b1c | 186 | * If a slave responds with a NACK, the master must assume that the slave |
Kojto | 111:4336505e4b1c | 187 | * cannot receive any more data and cancel the write operation. |
Kojto | 111:4336505e4b1c | 188 | * |
Kojto | 111:4336505e4b1c | 189 | * The master completes a transaction by issuing a \b Stop condition. |
Kojto | 111:4336505e4b1c | 190 | * |
Kojto | 111:4336505e4b1c | 191 | * A master can issue multiple \b Start conditions during a transaction; this |
Kojto | 111:4336505e4b1c | 192 | * is then called a \b Repeated \b Start condition. |
Kojto | 111:4336505e4b1c | 193 | * |
Kojto | 111:4336505e4b1c | 194 | * \subsubsection asfdoc_sam0_sercom_i2c_address_packets Address Packets |
Kojto | 111:4336505e4b1c | 195 | * The slave address consists of seven bits. The 8<SUP>th</SUP> bit in the transfer |
Kojto | 111:4336505e4b1c | 196 | * determines the data direction (read or write). An address packet always |
Kojto | 111:4336505e4b1c | 197 | * succeeds a \b Start or \b Repeated \b Start condition. The 8<SUP>th</SUP> bit is handled |
Kojto | 111:4336505e4b1c | 198 | * in the driver, and the user will only have to provide the 7-bit address. |
Kojto | 111:4336505e4b1c | 199 | * |
Kojto | 111:4336505e4b1c | 200 | * \subsubsection asfdoc_sam0_sercom_i2c_data_packets Data Packets |
Kojto | 111:4336505e4b1c | 201 | * Data packets are nine bits long, consisting of one 8-bit data byte, and an |
Kojto | 111:4336505e4b1c | 202 | * acknowledgement bit. Data packets follow either an address packet or another |
Kojto | 111:4336505e4b1c | 203 | * data packet on the bus. |
Kojto | 111:4336505e4b1c | 204 | * |
Kojto | 111:4336505e4b1c | 205 | * \subsubsection asfdoc_sam0_sercom_i2c_trans_examples Transaction Examples |
Kojto | 111:4336505e4b1c | 206 | * The gray bits in the following examples are sent from master to slave, and |
Kojto | 111:4336505e4b1c | 207 | * the white bits are sent from slave to master. |
Kojto | 111:4336505e4b1c | 208 | * Example of a read transaction is shown in |
Kojto | 111:4336505e4b1c | 209 | * \ref asfdoc_sam0_sercom_i2c_trans_examples_i2c_read "the figure below". Here, the |
Kojto | 111:4336505e4b1c | 210 | * master first issues a \b Start condition and gets ownership of the bus. An |
Kojto | 111:4336505e4b1c | 211 | * address packet with the direction flag set to read is then sent and |
Kojto | 111:4336505e4b1c | 212 | * acknowledged by the slave. Then the slave sends one data packet which is |
Kojto | 111:4336505e4b1c | 213 | * acknowledged by the master. The slave sends another packet, which is not |
Kojto | 111:4336505e4b1c | 214 | * acknowledged by the master and indicates that the master will terminate the |
Kojto | 111:4336505e4b1c | 215 | * transaction. In the end, the transaction is terminated by the master issuing |
Kojto | 111:4336505e4b1c | 216 | * a \b Stop condition. |
Kojto | 111:4336505e4b1c | 217 | * |
Kojto | 111:4336505e4b1c | 218 | * \anchor asfdoc_sam0_sercom_i2c_trans_examples_i2c_read |
Kojto | 111:4336505e4b1c | 219 | * \image html i2c_read.svg "I2C Packet Read" Width=100% |
Kojto | 111:4336505e4b1c | 220 | * |
Kojto | 111:4336505e4b1c | 221 | * Example of a write transaction is shown in |
Kojto | 111:4336505e4b1c | 222 | * \ref asfdoc_sam0_sercom_i2c_trans_examples_i2c_write "the figure below". Here, the |
Kojto | 111:4336505e4b1c | 223 | * master first issues a \b Start condition and gets ownership of the bus. An |
Kojto | 111:4336505e4b1c | 224 | * address packet with the dir flag set to write is then sent and acknowledged |
Kojto | 111:4336505e4b1c | 225 | * by the slave. Then the master sends two data packets, each acknowledged by |
Kojto | 111:4336505e4b1c | 226 | * the slave. In the end, the transaction is terminated by the master issuing |
Kojto | 111:4336505e4b1c | 227 | * a \b Stop condition. |
Kojto | 111:4336505e4b1c | 228 | * |
Kojto | 111:4336505e4b1c | 229 | * \anchor asfdoc_sam0_sercom_i2c_trans_examples_i2c_write |
Kojto | 111:4336505e4b1c | 230 | * \image html i2c_write.svg "I2C Packet Write" Width=100% |
Kojto | 111:4336505e4b1c | 231 | * |
Kojto | 111:4336505e4b1c | 232 | * \subsubsection asfdoc_sam0_sercom_i2c_packet_timeout Packet Timeout |
Kojto | 111:4336505e4b1c | 233 | * When a master sends an I<SUP>2</SUP>C packet, there is no way of |
Kojto | 111:4336505e4b1c | 234 | * being sure that a slave will acknowledge the packet. To avoid stalling the |
Kojto | 111:4336505e4b1c | 235 | * device forever while waiting for an acknowledge, a user selectable timeout |
Kojto | 111:4336505e4b1c | 236 | * is provided in the \ref i2c_master_config struct which |
Kojto | 111:4336505e4b1c | 237 | * lets the driver exit a read or write operation after the specified time. |
Kojto | 111:4336505e4b1c | 238 | * The function will then return the STATUS_ERR_TIMEOUT flag. |
Kojto | 111:4336505e4b1c | 239 | * |
Kojto | 111:4336505e4b1c | 240 | * This is also the case for the slave when using the functions postfixed |
Kojto | 111:4336505e4b1c | 241 | * \c _wait. |
Kojto | 111:4336505e4b1c | 242 | * |
Kojto | 111:4336505e4b1c | 243 | * The time before the timeout occurs, will be the same as |
Kojto | 111:4336505e4b1c | 244 | * for \ref asfdoc_sam0_sercom_i2c_unknown_bus_timeout "unknown bus state" timeout. |
Kojto | 111:4336505e4b1c | 245 | * |
Kojto | 111:4336505e4b1c | 246 | * \subsubsection asfdoc_sam0_sercom_i2c_repeated_start Repeated Start |
Kojto | 111:4336505e4b1c | 247 | * To issue a \b Repeated \b Start, the functions postfixed \c _no_stop must be |
Kojto | 111:4336505e4b1c | 248 | * used. |
Kojto | 111:4336505e4b1c | 249 | * These functions will not send a \b Stop condition when the transfer is done, |
Kojto | 111:4336505e4b1c | 250 | * thus the next transfer will start with a \b Repeated \b Start. To end the |
Kojto | 111:4336505e4b1c | 251 | * transaction, the functions without the \c _no_stop postfix must be used |
Kojto | 111:4336505e4b1c | 252 | * for the last read/write. |
Kojto | 111:4336505e4b1c | 253 | * |
Kojto | 111:4336505e4b1c | 254 | * \subsection asfdoc_sam0_sercom_i2c_multi_master Multi Master |
Kojto | 111:4336505e4b1c | 255 | * In a multi master environment, arbitration of the bus is important, as only |
Kojto | 111:4336505e4b1c | 256 | * one master can own the bus at any point. |
Kojto | 111:4336505e4b1c | 257 | * |
Kojto | 111:4336505e4b1c | 258 | * \subsubsection asfdoc_sam0_sercom_i2c_arbitration Arbitration |
Kojto | 111:4336505e4b1c | 259 | * |
Kojto | 111:4336505e4b1c | 260 | * \par Clock stretching |
Kojto | 111:4336505e4b1c | 261 | * The serial clock line is always driven by a master device. However, all |
Kojto | 111:4336505e4b1c | 262 | * devices connected to the bus are allowed stretch the low period of the clock |
Kojto | 111:4336505e4b1c | 263 | * to slow down the overall clock frequency or to insert wait states while |
Kojto | 111:4336505e4b1c | 264 | * processing data. |
Kojto | 111:4336505e4b1c | 265 | * Both master and slave can randomly stretch the clock, which will force the |
Kojto | 111:4336505e4b1c | 266 | * other device into a wait-state until the clock line goes high again. |
Kojto | 111:4336505e4b1c | 267 | * |
Kojto | 111:4336505e4b1c | 268 | * \par Arbitration on the data line |
Kojto | 111:4336505e4b1c | 269 | * If two masters start transmitting at the same time, they will both transmit |
Kojto | 111:4336505e4b1c | 270 | * until one master detects that the other master is pulling the data line low. |
Kojto | 111:4336505e4b1c | 271 | * When this is detected, the master not pulling the line low, will stop the |
Kojto | 111:4336505e4b1c | 272 | * transmission and wait until the bus is idle. |
Kojto | 111:4336505e4b1c | 273 | * As it is the master trying to contact the slave with the lowest address that |
Kojto | 111:4336505e4b1c | 274 | * will get the bus ownership, this will create an arbitration scheme always |
Kojto | 111:4336505e4b1c | 275 | * prioritizing the slaves with the lowest address in case of a bus collision. |
Kojto | 111:4336505e4b1c | 276 | * |
Kojto | 111:4336505e4b1c | 277 | * \subsubsection asfdoc_sam0_sercom_i2c_clock_sync Clock Synchronization |
Kojto | 111:4336505e4b1c | 278 | * In situations where more than one master is trying to control the bus clock |
Kojto | 111:4336505e4b1c | 279 | * line at the same time, a clock synchronization algorithm based on the same |
Kojto | 111:4336505e4b1c | 280 | * principles used for clock stretching is necessary. |
Kojto | 111:4336505e4b1c | 281 | * |
Kojto | 111:4336505e4b1c | 282 | * |
Kojto | 111:4336505e4b1c | 283 | * \subsection asfdoc_sam0_sercom_i2c_bus_states Bus States |
Kojto | 111:4336505e4b1c | 284 | * As the I<SUP>2</SUP>C bus is limited to one transaction at the time, |
Kojto | 111:4336505e4b1c | 285 | * a master that wants to perform a bus transaction must wait until the bus is |
Kojto | 111:4336505e4b1c | 286 | * free. |
Kojto | 111:4336505e4b1c | 287 | * Because of this, it is necessary for all masters in a multi-master system to |
Kojto | 111:4336505e4b1c | 288 | * know the current status of the bus to be able to avoid conflicts and to |
Kojto | 111:4336505e4b1c | 289 | * ensure data integrity. |
Kojto | 111:4336505e4b1c | 290 | * \li \b IDLE No activity on the bus (between a \b Stop and a new \b Start |
Kojto | 111:4336505e4b1c | 291 | * condition) |
Kojto | 111:4336505e4b1c | 292 | * \li \b OWNER If the master initiates a transaction successfully |
Kojto | 111:4336505e4b1c | 293 | * \li \b BUSY If another master is driving the bus |
Kojto | 111:4336505e4b1c | 294 | * \li \b UNKNOWN If the master has recently been enabled or connected to |
Kojto | 111:4336505e4b1c | 295 | * the bus. Is forced to \b IDLE after given |
Kojto | 111:4336505e4b1c | 296 | * \ref asfdoc_sam0_sercom_i2c_unknown_bus_timeout "timeout" when |
Kojto | 111:4336505e4b1c | 297 | * the master module is enabled |
Kojto | 111:4336505e4b1c | 298 | * |
Kojto | 111:4336505e4b1c | 299 | * The bus state diagram can be seen in |
Kojto | 111:4336505e4b1c | 300 | * \ref asfdoc_sam0_sercom_i2c_bus_states_figure "the figure below". |
Kojto | 111:4336505e4b1c | 301 | * \li S: Start condition |
Kojto | 111:4336505e4b1c | 302 | * \li P: Stop condition |
Kojto | 111:4336505e4b1c | 303 | * \li Sr: Repeated start condition |
Kojto | 111:4336505e4b1c | 304 | * \anchor asfdoc_sam0_sercom_i2c_bus_states_figure |
Kojto | 111:4336505e4b1c | 305 | * \image html bus_state_diagram.svg "I2C Bus State Diagram" Width=100% |
Kojto | 111:4336505e4b1c | 306 | * |
Kojto | 111:4336505e4b1c | 307 | * \subsection asfdoc_sam0_sercom_i2c_timeout Bus Timing |
Kojto | 111:4336505e4b1c | 308 | * Inactive bus timeout for the master and SDA hold time is configurable in the |
Kojto | 111:4336505e4b1c | 309 | * drivers. |
Kojto | 111:4336505e4b1c | 310 | * |
Kojto | 111:4336505e4b1c | 311 | * \subsubsection asfdoc_sam0_sercom_i2c_unknown_bus_timeout Unknown Bus State Timeout |
Kojto | 111:4336505e4b1c | 312 | * When a master is enabled or connected to the bus, the bus state will be |
Kojto | 111:4336505e4b1c | 313 | * unknown until either a given timeout or a stop command has occurred. The |
Kojto | 111:4336505e4b1c | 314 | * timeout is configurable in the \ref i2c_master_config struct. |
Kojto | 111:4336505e4b1c | 315 | * The timeout time will depend on toolchain and optimization level used, as |
Kojto | 111:4336505e4b1c | 316 | * the timeout is a loop incrementing a value until it reaches the specified |
Kojto | 111:4336505e4b1c | 317 | * timeout value. |
Kojto | 111:4336505e4b1c | 318 | * |
Kojto | 111:4336505e4b1c | 319 | * \subsubsection sda_hold SDA Hold Timeout |
Kojto | 111:4336505e4b1c | 320 | * When using the I<SUP>2</SUP>C in slave mode, it will be important to |
Kojto | 111:4336505e4b1c | 321 | * set a SDA hold time which assures that the master will be able to pick up |
Kojto | 111:4336505e4b1c | 322 | * the bit sent from the slave. The SDA hold time makes sure that this is the |
Kojto | 111:4336505e4b1c | 323 | * case by holding the data line low for a given period after the negative edge |
Kojto | 111:4336505e4b1c | 324 | * on the clock. |
Kojto | 111:4336505e4b1c | 325 | * |
Kojto | 111:4336505e4b1c | 326 | * The SDA hold time is also available for the master driver, but is not a |
Kojto | 111:4336505e4b1c | 327 | * necessity. |
Kojto | 111:4336505e4b1c | 328 | * |
Kojto | 111:4336505e4b1c | 329 | * \subsection asfdoc_sam0_sercom_i2c_sleep_modes Operation in Sleep Modes |
Kojto | 111:4336505e4b1c | 330 | * The I<SUP>2</SUP>C module can operate in all sleep modes by setting |
Kojto | 111:4336505e4b1c | 331 | * the run_in_standby Boolean in the \ref i2c_master_config or |
Kojto | 111:4336505e4b1c | 332 | * \ref i2c_slave_config struct. |
Kojto | 111:4336505e4b1c | 333 | * The operation in slave and master mode is shown in |
Kojto | 111:4336505e4b1c | 334 | * \ref asfdoc_sam0_sercom_i2c_sleep_modes_table "the table below". |
Kojto | 111:4336505e4b1c | 335 | * |
Kojto | 111:4336505e4b1c | 336 | * \anchor asfdoc_sam0_sercom_i2c_sleep_modes_table |
Kojto | 111:4336505e4b1c | 337 | * <table> |
Kojto | 111:4336505e4b1c | 338 | * <caption>I<SUP>2</SUP>C Standby Operations</caption> |
Kojto | 111:4336505e4b1c | 339 | * <tr> |
Kojto | 111:4336505e4b1c | 340 | * <th>Run in standby</th> |
Kojto | 111:4336505e4b1c | 341 | * <th>Slave</th> |
Kojto | 111:4336505e4b1c | 342 | * <th>Master</th> |
Kojto | 111:4336505e4b1c | 343 | * </tr> |
Kojto | 111:4336505e4b1c | 344 | * <tr> |
Kojto | 111:4336505e4b1c | 345 | * <td>false</td> |
Kojto | 111:4336505e4b1c | 346 | * <td>Disabled, all reception is dropped</td> |
Kojto | 111:4336505e4b1c | 347 | * <td>GCLK disabled when master is idle</td> |
Kojto | 111:4336505e4b1c | 348 | * </tr> |
Kojto | 111:4336505e4b1c | 349 | * <tr> |
Kojto | 111:4336505e4b1c | 350 | * <td>true</td> |
Kojto | 111:4336505e4b1c | 351 | * <td>Wake on address match when enabled</td> |
Kojto | 111:4336505e4b1c | 352 | * <td>GCLK enabled while in sleep modes</td> |
Kojto | 111:4336505e4b1c | 353 | * </tr> |
Kojto | 111:4336505e4b1c | 354 | * </table> |
Kojto | 111:4336505e4b1c | 355 | * |
Kojto | 111:4336505e4b1c | 356 | * |
Kojto | 111:4336505e4b1c | 357 | * \section asfdoc_sam0_sercom_i2c_special_considerations Special Considerations |
Kojto | 111:4336505e4b1c | 358 | * |
Kojto | 111:4336505e4b1c | 359 | * \if (I2C_MASTER_CALLBACK_MODE || I2C_SLAVE_CALLBACK_MODE) |
Kojto | 111:4336505e4b1c | 360 | * \subsection asfdoc_sam0_sercom_i2c_common_interrupt Interrupt-driven Operation |
Kojto | 111:4336505e4b1c | 361 | * While an interrupt-driven operation is in progress, subsequent calls to a |
Kojto | 111:4336505e4b1c | 362 | * write or read operation will return the STATUS_BUSY flag, indicating that |
Kojto | 111:4336505e4b1c | 363 | * only one operation is allowed at any given time. |
Kojto | 111:4336505e4b1c | 364 | * |
Kojto | 111:4336505e4b1c | 365 | * To check if another transmission can be initiated, the user can either call |
Kojto | 111:4336505e4b1c | 366 | * another transfer operation, or use the |
Kojto | 111:4336505e4b1c | 367 | * \ref i2c_master_get_job_status/\ref i2c_slave_get_job_status functions |
Kojto | 111:4336505e4b1c | 368 | * depending on mode. |
Kojto | 111:4336505e4b1c | 369 | * |
Kojto | 111:4336505e4b1c | 370 | * If the user would like to get callback from operations while using the |
Kojto | 111:4336505e4b1c | 371 | * interrupt-driven driver, the callback must be registered and then enabled |
Kojto | 111:4336505e4b1c | 372 | * using the "register_callback" and "enable_callback" functions. |
Kojto | 111:4336505e4b1c | 373 | * \else |
Kojto | 111:4336505e4b1c | 374 | * There are no special considerations for this driver for the APIs listed in |
Kojto | 111:4336505e4b1c | 375 | * this document. |
Kojto | 111:4336505e4b1c | 376 | * \endif |
Kojto | 111:4336505e4b1c | 377 | * |
Kojto | 111:4336505e4b1c | 378 | * \section asfdoc_sam0_sercom_i2c_extra Extra Information |
Kojto | 111:4336505e4b1c | 379 | * For extra information, see \ref asfdoc_sam0_sercom_i2c_extra_info_page. |
Kojto | 111:4336505e4b1c | 380 | * This includes: |
Kojto | 111:4336505e4b1c | 381 | * - \ref asfdoc_sam0_sercom_i2c_acronyms |
Kojto | 111:4336505e4b1c | 382 | * - \ref asfdoc_sam0_sercom_i2c_extra_dependencies |
Kojto | 111:4336505e4b1c | 383 | * - \ref asfdoc_sam0_sercom_i2c_extra_errata |
Kojto | 111:4336505e4b1c | 384 | * - \ref asfdoc_sam0_sercom_i2c_extra_history |
Kojto | 111:4336505e4b1c | 385 | * |
Kojto | 111:4336505e4b1c | 386 | * \section asfdoc_sam0_sercom_i2c_examples Examples |
Kojto | 111:4336505e4b1c | 387 | * |
Kojto | 111:4336505e4b1c | 388 | * For a list of examples related to this driver, see |
Kojto | 111:4336505e4b1c | 389 | * \ref asfdoc_sam0_sercom_i2c_exqsg. |
Kojto | 111:4336505e4b1c | 390 | * |
Kojto | 111:4336505e4b1c | 391 | * \section asfdoc_sam0_sercom_i2c_api_overview API Overview |
Kojto | 111:4336505e4b1c | 392 | * @{ |
Kojto | 111:4336505e4b1c | 393 | */ |
Kojto | 111:4336505e4b1c | 394 | |
Kojto | 111:4336505e4b1c | 395 | /** |
Kojto | 111:4336505e4b1c | 396 | * \name Driver Feature Definition |
Kojto | 111:4336505e4b1c | 397 | * Define SERCOM I<SUP>2</SUP>C driver features set according to different device family. |
Kojto | 111:4336505e4b1c | 398 | * |
Kojto | 111:4336505e4b1c | 399 | * \note The high speed mode and 10-bit address feature are not |
Kojto | 111:4336505e4b1c | 400 | * supported by the driver now. |
Kojto | 111:4336505e4b1c | 401 | * @{ |
Kojto | 111:4336505e4b1c | 402 | */ |
Kojto | 111:4336505e4b1c | 403 | #if (SAMD21) || (SAMR21) || (SAMD10) || (SAMD11) || (SAML21) || (SAMDA1) || \ |
Kojto | 111:4336505e4b1c | 404 | (SAMC20) || (SAMC21) || defined(__DOXYGEN__) |
Kojto | 111:4336505e4b1c | 405 | /** Fast mode plus and high speed support. */ |
Kojto | 111:4336505e4b1c | 406 | # define FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED |
Kojto | 111:4336505e4b1c | 407 | /** 10-bit address support. */ |
Kojto | 111:4336505e4b1c | 408 | # define FEATURE_I2C_10_BIT_ADDRESS |
Kojto | 111:4336505e4b1c | 409 | /** SCL stretch mode support. */ |
Kojto | 111:4336505e4b1c | 410 | # define FEATURE_I2C_SCL_STRETCH_MODE |
Kojto | 111:4336505e4b1c | 411 | /** SCL extend timeout support. */ |
Kojto | 111:4336505e4b1c | 412 | # define FEATURE_I2C_SCL_EXTEND_TIMEOUT |
Kojto | 111:4336505e4b1c | 413 | # define FEATURE_I2C_DMA_SUPPORT |
Kojto | 111:4336505e4b1c | 414 | #endif |
Kojto | 111:4336505e4b1c | 415 | /*@}*/ |
Kojto | 111:4336505e4b1c | 416 | |
Kojto | 111:4336505e4b1c | 417 | /** \brief Transfer direction |
Kojto | 111:4336505e4b1c | 418 | * |
Kojto | 111:4336505e4b1c | 419 | * For master: transfer direction or setting direction bit in address. |
Kojto | 111:4336505e4b1c | 420 | * For slave: direction of request from master. |
Kojto | 111:4336505e4b1c | 421 | */ |
Kojto | 111:4336505e4b1c | 422 | enum i2c_transfer_direction { |
Kojto | 111:4336505e4b1c | 423 | /** Master write operation is in progress. */ |
Kojto | 111:4336505e4b1c | 424 | I2C_TRANSFER_WRITE = 0, |
Kojto | 111:4336505e4b1c | 425 | /** Master read operation is in progress. */ |
Kojto | 111:4336505e4b1c | 426 | I2C_TRANSFER_READ = 1, |
Kojto | 111:4336505e4b1c | 427 | }; |
Kojto | 111:4336505e4b1c | 428 | |
Kojto | 111:4336505e4b1c | 429 | /** @} */ |
Kojto | 111:4336505e4b1c | 430 | |
Kojto | 111:4336505e4b1c | 431 | #ifdef __cplusplus |
Kojto | 111:4336505e4b1c | 432 | } |
Kojto | 111:4336505e4b1c | 433 | #endif |
Kojto | 111:4336505e4b1c | 434 | |
Kojto | 111:4336505e4b1c | 435 | /** |
Kojto | 111:4336505e4b1c | 436 | * \page asfdoc_sam0_sercom_i2c_extra_info_page Extra Information for SERCOM I2C Driver |
Kojto | 111:4336505e4b1c | 437 | * |
Kojto | 111:4336505e4b1c | 438 | * \section asfdoc_sam0_sercom_i2c_acronyms Acronyms |
Kojto | 111:4336505e4b1c | 439 | * \ref asfdoc_sam0_sercom_i2c_acronyms_table "Below" is a table listing the acronyms |
Kojto | 111:4336505e4b1c | 440 | * used in this module, along with their intended meanings. |
Kojto | 111:4336505e4b1c | 441 | * |
Kojto | 111:4336505e4b1c | 442 | * \anchor asfdoc_sam0_sercom_i2c_acronyms_table |
Kojto | 111:4336505e4b1c | 443 | * <table> |
Kojto | 111:4336505e4b1c | 444 | * <caption>Acronyms</caption> |
Kojto | 111:4336505e4b1c | 445 | * <tr> |
Kojto | 111:4336505e4b1c | 446 | * <th>Acronym</th> |
Kojto | 111:4336505e4b1c | 447 | * <th>Description</th> |
Kojto | 111:4336505e4b1c | 448 | * </tr> |
Kojto | 111:4336505e4b1c | 449 | * <tr> |
Kojto | 111:4336505e4b1c | 450 | * <td>SDA</td> |
Kojto | 111:4336505e4b1c | 451 | * <td>Serial Data Line</td> |
Kojto | 111:4336505e4b1c | 452 | * </tr> |
Kojto | 111:4336505e4b1c | 453 | * <tr> |
Kojto | 111:4336505e4b1c | 454 | * <td>SCL</td> |
Kojto | 111:4336505e4b1c | 455 | * <td>Serial Clock Line</td> |
Kojto | 111:4336505e4b1c | 456 | * </tr> |
Kojto | 111:4336505e4b1c | 457 | * <tr> |
Kojto | 111:4336505e4b1c | 458 | * <td>SERCOM</td> |
Kojto | 111:4336505e4b1c | 459 | * <td>Serial Communication Interface</td> |
Kojto | 111:4336505e4b1c | 460 | * </tr> |
Kojto | 111:4336505e4b1c | 461 | * <tr> |
Kojto | 111:4336505e4b1c | 462 | * <td>DMA</td> |
Kojto | 111:4336505e4b1c | 463 | * <td>Direct Memory Access</td> |
Kojto | 111:4336505e4b1c | 464 | * </tr> |
Kojto | 111:4336505e4b1c | 465 | * </table> |
Kojto | 111:4336505e4b1c | 466 | * |
Kojto | 111:4336505e4b1c | 467 | * \section asfdoc_sam0_sercom_i2c_extra_dependencies Dependencies |
Kojto | 111:4336505e4b1c | 468 | * The I<SUP>2</SUP>C driver has the following dependencies: |
Kojto | 111:4336505e4b1c | 469 | * \li \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" |
Kojto | 111:4336505e4b1c | 470 | * |
Kojto | 111:4336505e4b1c | 471 | * |
Kojto | 111:4336505e4b1c | 472 | * \section asfdoc_sam0_sercom_i2c_extra_errata Errata |
Kojto | 111:4336505e4b1c | 473 | * There are no errata related to this driver. |
Kojto | 111:4336505e4b1c | 474 | * |
Kojto | 111:4336505e4b1c | 475 | * \section asfdoc_sam0_sercom_i2c_extra_history Module History |
Kojto | 111:4336505e4b1c | 476 | * \ref asfdoc_sam0_sercom_i2c_extra_history_table "Below" is an overview of the |
Kojto | 111:4336505e4b1c | 477 | * module history, detailing enhancements and fixes made to the module since |
Kojto | 111:4336505e4b1c | 478 | * its first release. The current version of this corresponds to the newest |
Kojto | 111:4336505e4b1c | 479 | * version listed in |
Kojto | 111:4336505e4b1c | 480 | * \ref asfdoc_sam0_sercom_i2c_extra_history_table "the table below". |
Kojto | 111:4336505e4b1c | 481 | * |
Kojto | 111:4336505e4b1c | 482 | * \anchor asfdoc_sam0_sercom_i2c_extra_history_table |
Kojto | 111:4336505e4b1c | 483 | * <table> |
Kojto | 111:4336505e4b1c | 484 | * <caption>Module History</caption> |
Kojto | 111:4336505e4b1c | 485 | * <tr> |
Kojto | 111:4336505e4b1c | 486 | * <th>Changelog</th> |
Kojto | 111:4336505e4b1c | 487 | * </tr> |
Kojto | 111:4336505e4b1c | 488 | * <tr> |
Kojto | 111:4336505e4b1c | 489 | * <td> |
Kojto | 111:4336505e4b1c | 490 | * \li Added 10-bit addressing and high speed support in SAM D21 |
Kojto | 111:4336505e4b1c | 491 | * \li Separate structure i2c_packet into i2c_master_packet and i2c_slave packet |
Kojto | 111:4336505e4b1c | 492 | * </td> |
Kojto | 111:4336505e4b1c | 493 | * </tr> |
Kojto | 111:4336505e4b1c | 494 | * <tr> |
Kojto | 111:4336505e4b1c | 495 | * <td> |
Kojto | 111:4336505e4b1c | 496 | * \li Added support for SCL stretch and extended timeout hardware features in SAM D21 |
Kojto | 111:4336505e4b1c | 497 | * \li Added fast mode plus support in SAM D21 |
Kojto | 111:4336505e4b1c | 498 | * </td> |
Kojto | 111:4336505e4b1c | 499 | * </tr> |
Kojto | 111:4336505e4b1c | 500 | * <tr> |
Kojto | 111:4336505e4b1c | 501 | * <td>Fixed incorrect logical mask for determining if a bus error has |
Kojto | 111:4336505e4b1c | 502 | * occurred in I<SUP>2</SUP>C Slave mode |
Kojto | 111:4336505e4b1c | 503 | * </td> |
Kojto | 111:4336505e4b1c | 504 | * </tr> |
Kojto | 111:4336505e4b1c | 505 | * <tr> |
Kojto | 111:4336505e4b1c | 506 | * <td>Initial Release</td> |
Kojto | 111:4336505e4b1c | 507 | * </tr> |
Kojto | 111:4336505e4b1c | 508 | * </table> |
Kojto | 111:4336505e4b1c | 509 | */ |
Kojto | 111:4336505e4b1c | 510 | |
Kojto | 111:4336505e4b1c | 511 | /** |
Kojto | 111:4336505e4b1c | 512 | * \page asfdoc_sam0_sercom_i2c_exqsg Examples for SERCOM I2C Driver |
Kojto | 111:4336505e4b1c | 513 | * |
Kojto | 111:4336505e4b1c | 514 | * This is a list of the available Quick Start guides (QSGs) and example |
Kojto | 111:4336505e4b1c | 515 | * applications for \ref asfdoc_sam0_sercom_i2c_group. QSGs are simple examples with |
Kojto | 111:4336505e4b1c | 516 | * step-by-step instructions to configure and use this driver in a selection of |
Kojto | 111:4336505e4b1c | 517 | * use cases. Note that QSGs can be compiled as a standalone application or be |
Kojto | 111:4336505e4b1c | 518 | * added to the user application. |
Kojto | 111:4336505e4b1c | 519 | * |
Kojto | 111:4336505e4b1c | 520 | * \if I2C_MASTER_MODE |
Kojto | 111:4336505e4b1c | 521 | * - \subpage asfdoc_sam0_sercom_i2c_master_basic_use_case "Quick Start Guide for the I2C Master module - Basic Use Case" |
Kojto | 111:4336505e4b1c | 522 | * \endif |
Kojto | 111:4336505e4b1c | 523 | * \if I2C_MASTER_CALLBACK_MODE |
Kojto | 111:4336505e4b1c | 524 | * - \subpage asfdoc_sam0_sercom_i2c_master_callback_use_case "Quick Start Guide for the I2C Master module - Callback Use Case" |
Kojto | 111:4336505e4b1c | 525 | * - \subpage asfdoc_sam0_sercom_i2c_master_dma_use_case "Quick Start Guide for the I2C Master module - DMA Use Case" |
Kojto | 111:4336505e4b1c | 526 | * \endif |
Kojto | 111:4336505e4b1c | 527 | * \if I2C_SLAVE_MODE |
Kojto | 111:4336505e4b1c | 528 | * - \subpage asfdoc_sam0_sercom_i2c_slave_basic_use_case "Quick Start Guide for the I2C Slave module - Basic Use Case" |
Kojto | 111:4336505e4b1c | 529 | * \endif |
Kojto | 111:4336505e4b1c | 530 | * \if I2C_SLAVE_CALLBACK_MODE |
Kojto | 111:4336505e4b1c | 531 | * - \subpage asfdoc_sam0_sercom_i2c_slave_callback_use_case "Quick Start Guide for the I2C Slave module - Callback Use Case" |
Kojto | 111:4336505e4b1c | 532 | * - \subpage asfdoc_sam0_sercom_i2c_slave_dma_use_case "Quick Start Guide for the I2C Slave module - DMA Use Case" |
Kojto | 111:4336505e4b1c | 533 | * \endif |
Kojto | 111:4336505e4b1c | 534 | * |
Kojto | 111:4336505e4b1c | 535 | * \page asfdoc_sam0_sercom_i2c_document_revision_history Document Revision History |
Kojto | 111:4336505e4b1c | 536 | * |
Kojto | 111:4336505e4b1c | 537 | * <table> |
Kojto | 111:4336505e4b1c | 538 | * <tr> |
Kojto | 111:4336505e4b1c | 539 | * <th>Doc. Rev.</td> |
Kojto | 111:4336505e4b1c | 540 | * <th>Date</td> |
Kojto | 111:4336505e4b1c | 541 | * <th>Comments</td> |
Kojto | 111:4336505e4b1c | 542 | * </tr> |
Kojto | 111:4336505e4b1c | 543 | * <tr> |
Kojto | 111:4336505e4b1c | 544 | * <td>E</td> |
Kojto | 111:4336505e4b1c | 545 | * <td>06/2015</td> |
Kojto | 111:4336505e4b1c | 546 | * <td>Added SAM L21, SAMDAx and SAMC21 support.</td> |
Kojto | 111:4336505e4b1c | 547 | * </tr> |
Kojto | 111:4336505e4b1c | 548 | * <tr> |
Kojto | 111:4336505e4b1c | 549 | * <td>D</td> |
Kojto | 111:4336505e4b1c | 550 | * <td>12/2014</td> |
Kojto | 111:4336505e4b1c | 551 | * <td>Added 10-bit addressing and high speed support in SAM D21 |
Kojto | 111:4336505e4b1c | 552 | * Added SAM R21/D10/D11 support.</td> |
Kojto | 111:4336505e4b1c | 553 | * </tr> |
Kojto | 111:4336505e4b1c | 554 | * <tr> |
Kojto | 111:4336505e4b1c | 555 | * <td>C</td> |
Kojto | 111:4336505e4b1c | 556 | * <td>01/2014</td> |
Kojto | 111:4336505e4b1c | 557 | * <td>Added the SAM D21 to the application note.</td> |
Kojto | 111:4336505e4b1c | 558 | * </tr> |
Kojto | 111:4336505e4b1c | 559 | * <tr> |
Kojto | 111:4336505e4b1c | 560 | * <td>B</td> |
Kojto | 111:4336505e4b1c | 561 | * <td>06/2013</td> |
Kojto | 111:4336505e4b1c | 562 | * <td>Corrected documentation typos. Updated I<SUP>2</SUP>C Bus State Diagram.</td> |
Kojto | 111:4336505e4b1c | 563 | * </tr> |
Kojto | 111:4336505e4b1c | 564 | * <tr> |
Kojto | 111:4336505e4b1c | 565 | * <td>A</td> |
Kojto | 111:4336505e4b1c | 566 | * <td>06/2013</td> |
Kojto | 111:4336505e4b1c | 567 | * <td>Initial release.</td> |
Kojto | 111:4336505e4b1c | 568 | * </tr> |
Kojto | 111:4336505e4b1c | 569 | * </table> |
Kojto | 111:4336505e4b1c | 570 | */ |
Kojto | 111:4336505e4b1c | 571 | |
Kojto | 111:4336505e4b1c | 572 | #endif /* I2C_COMMON_H_INCLUDED */ |