1 /* -----------------------------------------------------------------------------
2 * Copyright (c) 2013-2014 ARM Limited. All rights reserved.
4 * $Date: 2. January 2014
7 * Project: I2C Driver API
8 * -------------------------------------------------------------------------- */
12 \defgroup i2c_interface_gr I2C Interface
13 \brief Driver API for I2C Bus Peripheral (%Driver_I2C.h)
16 I<sup>2</sup>C (Inter-Integrated Circuit, referred to as I-squared-C, I-two-C, or IIC) is a multi-master serial single-ended bus and is mostly used
17 on single boards, but can also connect to components which are linked via cable.
19 Most significant features of the I<sup>2</sup>C bus include:
20 - Only two bus lines are required
21 - I<sup>2</sup>C is a true multi-master bus. Simple master/slave relationships exist between all components
22 - A baud rate is not required; the master device determines a bus clock
23 - Each connected device is addressable by a unique address
24 - Providing arbitration and collision detection
26 For more information about I<sup>2</sup>C refer to the following web pages:
27 - Wikipedia: <a href="http://en.wikipedia.org/wiki/I%C2%B2C" target="_blank">I<sup>2</sup>C</a>
28 - <a href="http://www.i2c-bus.org" target="_blank">www.i2c-bus.org</a>.
30 Devices can operation in Master or Slave mode:
32 - To operate in Master mode call the functions \ref ARM_I2C_MasterTransmit or \ref ARM_I2C_MasterReceive. These functions get as argument a <em>slave address</em>.
34 - To operate in Slave mode set the <em>slave address</em> using the function \ref ARM_I2C_Control. The functions \ref ARM_I2C_SlaveTransmit or \ref ARM_I2C_SlaveReceive are used to transfer data in Slave mode.
36 <b>I<sup>2</sup>C Slave Address</b>
38 Depending on the device, I<sup>2</sup>C supports 7-bit and 10-bit Slaves addresses.
39 The element <em>address_10_bit</em> in \ref ARM_I2C_CAPABILITIES indicates that the driver is able to handle 10-bit addresses.
40 A 10-bit Slave address is ORed with \ref ARM_I2C_ADDRESS_10BIT.
42 I<sup>2</sup>C also supports a General Call to all Slaves by using the slave address value \token{0}.
43 A General Call is recognized by Slaves have a slave address value \ref ARM_I2C_ADDRESS_GC registered with the
44 function \ref ARM_I2C_Control.
48 The I2C driver allows you to connect low-speed peripherals to a motherboard, embedded system, cellphone, or other electronic device.
50 \image html I2C_BlockDiagram.png "Master/Slave connected via I2C interface"
53 <b>I<sup>2</sup>C API</b>
55 The following header files define the Application Programming Interface (API) for the I<sup>2</sup>C interface:
56 - \b %Driver_I2C.h : Driver API for I2C Bus Peripheral
58 The driver implementation is a typical part of the Device Family Pack (DFP) that supports the
59 peripherals of the microcontroller family.
62 <b>Driver Functions</b>
64 The driver functions are published in the access struct as explained in \ref DriverFunctions
65 - \ref ARM_DRIVER_I2C : access struct for I2C driver functions
68 \anchor example <b>Example Code</b>
70 The following example code shows the usage of the I<sup>2</sup>C interface in Master mode.
74 The following example code shows the usage of the I<sup>2</sup>C interface in Slave mode.
76 \include I2C_SlaveDemo.c
83 \struct ARM_DRIVER_I2C
85 The functions of the I2C interface are accessed by function pointers exposed by this structure. Refer to \ref DriverFunctions for
88 Each instance of an I2C provides such an access structure. The instance is indicated by
89 a postfix in the symbol name of the access structure, for example:
90 - \b Driver_I2C0 is the name of the access struct of the first instance (no. 0).
91 - \b Driver_I2C1 is the name of the access struct of the second instance (no. 1).
94 A configuration setting in the middleware allows connecting the middleware to a specific driver instance <b>%Driver_I2C<i>n</i></b>.
95 The default is \token{0}, which connects a middleware to the first instance of a driver.
96 *******************************************************************************************************************/
99 \struct ARM_I2C_CAPABILITIES
101 An I2C driver can be implemented with different capabilities.
102 The data fields of this struct encode the capabilities implemented by this driver.
104 The element \em address_10_bit indicates that the driver is able to handle 10-bit addressing natively.
105 User can still emulate the 10-bit addressing in software if the driver does not support it.
108 - \ref ARM_I2C_GetCapabilities
109 *******************************************************************************************************************/
112 \struct ARM_I2C_STATUS
114 Structure with information about the status of the I2C.
116 The flag \em busy indicates that the driver is busy executing Master/Slave Transmit/Receive operation.
119 - when Master operation starts: after calling \ref ARM_I2C_MasterTransmit or \ref ARM_I2C_MasterReceive
120 - when Slave operation starts: after calling \ref ARM_I2C_SlaveTransmit or \ref ARM_I2C_SlaveReceive and after being addressed by a Master as the Slave
122 It is cleared when Master/Slave operation has finished.
124 The flag \em mode indicates the current mode which is Master when Master Transmit/Receive is active or Slave otherwise.
126 The flag \em direction indicates either Transmitter or Receiver mode. It is updated during Master/Slave operation when the Slave is addressed by a Master.
128 The flag \em general_call indicates a General call (address \token{0}) when in Slave mode.
130 The flag \em arbitration_lost indicates that the Master has lost arbitration. The current Master operation is aborted.
132 The flag \em bus_error indicates that a bus error has been detected. The current Master/Slave operation is aborted.
135 - \ref ARM_I2C_GetStatus
136 *******************************************************************************************************************/
139 \typedef ARM_I2C_SignalEvent_t
141 Provides the typedef for the callback function \ref ARM_I2C_SignalEvent.
143 <b>Parameter for:</b>
144 - \ref ARM_I2C_Initialize
145 *******************************************************************************************************************/
148 \defgroup I2C_events I2C Events
149 \ingroup i2c_interface_gr
150 \brief The I2C driver generates call back events that are notified via the function \ref ARM_I2C_SignalEvent.
152 This section provides the event values for the \ref ARM_I2C_SignalEvent callback function.
154 The following call back notification events are generated:
156 \def ARM_I2C_EVENT_TRANSFER_DONE
157 \def ARM_I2C_EVENT_TRANSFER_INCOMPLETE
158 \def ARM_I2C_EVENT_SLAVE_TRANSMIT
159 \def ARM_I2C_EVENT_SLAVE_RECEIVE
160 \def ARM_I2C_EVENT_ADDRESS_NACK
161 \def ARM_I2C_EVENT_GENERAL_CALL
162 \def ARM_I2C_EVENT_ARBITRATION_LOST
163 \def ARM_I2C_EVENT_BUS_ERROR
164 \def ARM_I2C_EVENT_BUS_CLEAR
173 ARM_DRIVER_VERSION ARM_I2C_GetVersion (void) {
177 \fn ARM_DRIVER_VERSION ARM_I2C_GetVersion (void)
179 The function \b ARM_I2C_GetVersion returns version information of the driver implementation in \ref ARM_DRIVER_VERSION
180 - API version is the version of the CMSIS-Driver specification used to implement this driver.
181 - Driver version is source code version of the actual driver implementation.
185 extern ARM_DRIVER_I2C Driver_I2C0;
186 ARM_DRIVER_I2C *drv_info;
188 void setup_i2c (void) {
189 ARM_DRIVER_VERSION version;
191 drv_info = &Driver_I2C0;
192 version = drv_info->GetVersion ();
193 if (version.api < 0x10A) { // requires at minimum API version 1.10 or higher
199 *******************************************************************************************************************/
201 ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities (void) {
205 \fn ARM_I2C_CAPABILITIES ARM_I2C_GetCapabilities (void)
207 The function \b ARM_I2C_GetCapabilities returns information about capabilities of this driver implementation.
208 The data fields of the struct \ref ARM_I2C_CAPABILITIES encodes the driver capabilities.
212 extern ARM_DRIVER_I2C Driver_I2C0;
213 ARM_DRIVER_I2C *drv_info;
215 void read_capabilities (void) {
216 ARM_I2C_CAPABILITIES drv_capabilities;
218 drv_info = &Driver_I2C0;
219 drv_capabilities = drv_info->GetCapabilities ();
220 // interrogate capabilities
224 *******************************************************************************************************************/
226 int32_t ARM_I2C_Initialize (ARM_I2C_SignalEvent_t cb_event) {
227 return ARM_DRIVER_OK;
230 \fn int32_t ARM_I2C_Initialize (ARM_I2C_SignalEvent_t cb_event)
232 The function \b ARM_I2C_Initialize initializes the I2C interface.
233 It is called when the middleware component starts operation.
235 The function performs the following operations:
236 - Initializes and the I/O resources for the I2C interface.
237 - Registers the \ref ARM_I2C_SignalEvent callback function.
239 The parameter \em cb_event is a pointer to the \ref ARM_I2C_SignalEvent callback function.
240 Use a NULL pointer when no callback events are required.
242 Can be called multiple times. If the peripheral is already initialized the function performs no operation and
243 returns with \ref ARM_DRIVER_OK. Refer to \ref CallSequence for more information.
245 \sa ARM_I2C_PowerControl
246 \sa ARM_I2C_Uninitialize
249 - refer to \ref example "Example Code"
251 *******************************************************************************************************************/
253 int32_t ARM_I2C_Uninitialize (void) {
254 return ARM_DRIVER_OK;
257 \fn int32_t ARM_I2C_Uninitialize (void)
259 The function \b ARM_I2C_Uninitialize releases the I/O resources of I2C interface.
261 It is called when the middleware component stops operation and releases the I/O resources used by the I2C interface.
262 Refer to \ref CallSequence for more information.
264 \sa ARM_I2C_Initialize
265 \sa ARM_I2C_PowerControl
267 *******************************************************************************************************************/
269 int32_t ARM_I2C_PowerControl (ARM_POWER_STATE state) {
270 return ARM_DRIVER_OK;
273 \fn int32_t ARM_I2C_PowerControl (ARM_POWER_STATE state)
275 The function \b ARM_I2C_PowerControl operates the power modes of the I2C interface.
277 The parameter \em state can have the following values:
278 - \ref ARM_POWER_FULL : set-up peripheral for data transfers, enable interrupts (NVIC) and optionally DMA.
279 Can be called multiple times. If the peripheral is already in this mode,
280 then the function performs no operation and returns with \ref ARM_DRIVER_OK.
281 - \ref ARM_POWER_LOW : may use power saving. Returns \ref ARM_DRIVER_ERROR_UNSUPPORTED when not implemented.
282 - \ref ARM_POWER_OFF : terminates any pending data transfers, disables peripheral, disables related interrupts and DMA.
284 Refer to \ref CallSequence for more information.
286 \sa ARM_I2C_Initialize
287 \sa ARM_I2C_Uninitialize
289 *******************************************************************************************************************/
291 int32_t ARM_I2C_MasterTransmit (uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending) {
292 return ARM_DRIVER_OK;
295 \fn int32_t ARM_I2C_MasterTransmit (uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)
297 This function \b ARM_I2C_MasterTransmit transmits data as Master to the selected Slave.
299 The operation consists of:
300 - Master generates START condition
301 - Master addresses the Slave as Master Transmitter
302 - Master transmits data to the addressed Slave
303 - Master generates STOP condition (if \em xfer_pending is "false")
305 The parameter \em addr is the address of the slave to transmit the data to. The value can be ORed with \ref ARM_I2C_ADDRESS_10BIT to
306 identify a 10-bit address value. \n
307 The parameter \em data and \em num specify the address of a data buffer and the number of bytes to transmit. \n
308 Set the parameter \em xfer_pending to 'true' if another transfer operation follows. With \em xfer_pending set to 'false' a STOP condition is generated.
310 The function is non-blocking and returns as soon as the driver has started the operation.
311 During the operation it is not allowed to call any Master function again. Also the data buffer must stay allocated and the contents of data must not be modified.
312 When transmit operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
313 When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.
315 Number of data bytes transmitted and acknowledged is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.
317 The operation is aborted in the following cases (\ref ARM_I2C_EVENT_TRANSFER_DONE event is generated together with):
318 - selected slave has not acknowledged the address: \ref ARM_I2C_EVENT_ADDRESS_NACK event
319 - arbitration has been lost: \ref ARM_I2C_EVENT_ARBITRATION_LOST event
320 - bus error has been detected: \ref ARM_I2C_EVENT_BUS_ERROR event
322 Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.
324 Transmit operation can be aborted also by calling \ref ARM_I2C_Control with the parameter \em control \ref ARM_I2C_ABORT_TRANSFER.
325 *******************************************************************************************************************/
327 int32_t ARM_I2C_MasterReceive (uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending) {
328 return ARM_DRIVER_OK;
331 \fn int32_t ARM_I2C_MasterReceive (uint32_t addr, uint8_t *data, uint32_t num, bool xfer_pending)
333 This function \b ARM_I2C_MasterReceive is used to receive data as Master from the selected Slave.
335 The operation consists of:
336 - Master generates START condition
337 - Master addresses the Slave as Master Receiver
338 - Master receives data from the addressed Slave
339 - Master generates STOP condition (if \em xfer_pending is "false")
341 The parameter \em addr is the address of the slave to receive the data from. The value can be ORed with \ref ARM_I2C_ADDRESS_10BIT to
342 identify a 10-bit address value. \n
343 The parameter \em data and \em num specify the address of a data buffer and the number of bytes to receive. \n
344 Set the parameter \em xfer_pending to 'true' if another transfer operation follows. With \em xfer_pending set to 'false' a STOP condition is generated.
346 The function is non-blocking and returns as soon as the driver has started the operation.
347 During the operation it is not allowed to call any Master function again. Also the data buffer must stay allocated.
348 When receive operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
349 When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.
351 Number of data bytes received is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.
353 The operation is aborted in the following cases (\ref ARM_I2C_EVENT_TRANSFER_DONE event is generated together with):
354 - selected slave has not acknowledged the address: \ref ARM_I2C_EVENT_ADDRESS_NACK event
355 - arbitration has been lost: \ref ARM_I2C_EVENT_ARBITRATION_LOST event
356 - bus error has been detected: \ref ARM_I2C_EVENT_BUS_ERROR event
358 Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.
360 Receive operation can be aborted also by calling \ref ARM_I2C_Control with the parameter \em control = \ref ARM_I2C_ABORT_TRANSFER.
361 *******************************************************************************************************************/
363 int32_t ARM_I2C_SlaveTransmit (const uint8_t *data, uint32_t num) {
364 return ARM_DRIVER_OK;
367 \fn int32_t ARM_I2C_SlaveTransmit (const uint8_t *data, uint32_t num)
369 This function \b ARM_I2C_SlaveTransmit is used to transmit data as Slave to the Master.
371 The parameter \em data is a pointer to the data to transmit. \n
372 The parameter \em num specifies the number of bytes to transmit.
374 The function is non-blocking and returns as soon as the driver has registered the operation.
375 The actual operation will start after being addressed by the master as a Slave Transmitter. If the operation has not been registered at that point the \ref ARM_I2C_EVENT_SLAVE_TRANSMIT event is generated.
376 The same event is also generated if the operation has finished (specified number of bytes transmitted) but more data is requested by the master.
378 It is not allowed to call this function again if the operation has started until it finishes. Also the data buffer must stay allocated and the contents of data must not be modified.
379 When transmit operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
380 When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.
382 Number of data bytes transmitted is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.
384 In case that a General call has been detected the \ref ARM_I2C_EVENT_GENERAL_CALL flag is indicated together with the \ref ARM_I2C_EVENT_TRANSFER_DONE event (also with \ref ARM_I2C_EVENT_SLAVE_TRANSMIT event).
386 In case that bus error has been detected then the operation is aborted and the \ref ARM_I2C_EVENT_BUS_ERROR event is generated together with \ref ARM_I2C_EVENT_TRANSFER_DONE.
388 Slave will only respond to its own address (or General call if enabled) that is specified by calling \ref ARM_I2C_Control with \ref ARM_I2C_OWN_ADDRESS as control parameter.
389 Using address \token{0} disables the slave.
391 Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.
393 Transmit operation can be canceled or aborted by calling \ref ARM_I2C_Control with the parameter \em control = \ref ARM_I2C_ABORT_TRANSFER.
394 *******************************************************************************************************************/
396 int32_t ARM_I2C_SlaveReceive (uint8_t *data, uint32_t num) {
397 return ARM_DRIVER_OK;
400 \fn int32_t ARM_I2C_SlaveReceive (uint8_t *data, uint32_t num)
402 This function \b ARM_I2C_SlaveReceive receives data as Slave from the Master.
404 The parameter \em data is a pointer to the data to receive. \n
405 The parameter \em num specifies the number of bytes to receive.
407 The function is non-blocking and returns as soon as the driver has registered the operation.
408 The actual operation will start after being addressed by the master as a Slave Receiver. If the operation has not been registered at that point the \ref ARM_I2C_EVENT_SLAVE_RECEIVE event is generated.
410 It is not allowed to call this function again if the operation has started until it finishes. Also the data buffer must stay allocated.
411 When receive operation has finished the \ref ARM_I2C_EVENT_TRANSFER_DONE event is generated.
412 When not all the data is transferred then the \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE flag is set at the same time.
414 Number of data bytes received and acknowledged is returned by the function \ref ARM_I2C_GetDataCount during and after the operation has finished.
416 In case that a General call has been detected the \ref ARM_I2C_EVENT_GENERAL_CALL flag is indicated together with the \ref ARM_I2C_EVENT_TRANSFER_DONE event (also with \ref ARM_I2C_EVENT_SLAVE_RECEIVE event).
418 In case that bus error has been detected then the operation is aborted and the \ref ARM_I2C_EVENT_BUS_ERROR event is generated together with \ref ARM_I2C_EVENT_TRANSFER_DONE.
420 Slave will only respond to its own address (or General call if enabled) that is specified by calling \ref ARM_I2C_Control with \ref ARM_I2C_OWN_ADDRESS as control parameter.
421 Using address \token{0} disables the slave.
423 Status can be monitored by calling the \ref ARM_I2C_GetStatus and checking the flags.
425 Receive operation can be canceled or aborted by calling \ref ARM_I2C_Control with the parameter \em control = \ref ARM_I2C_ABORT_TRANSFER.
426 *******************************************************************************************************************/
428 int32_t ARM_I2C_GetDataCount (void) {
432 \fn int32_t ARM_I2C_GetDataCount (void)
434 The function \b ARM_I2C_GetDataCount returns the number of currently transferred data bytes during and after:
435 - \ref ARM_I2C_MasterTransmit : number of data bytes transmitted and acknowledged
436 - \ref ARM_I2C_MasterReceive : number of data bytes received
437 - \ref ARM_I2C_SlaveTransmit : number of data bytes transmitted
438 - \ref ARM_I2C_SlaveReceive : number of data bytes received and acknowledged
440 When the Slave is not yet addressed by the Master then \token{-1} is returned.
441 *****************************************************************************************************************/
443 int32_t ARM_I2C_Control (uint32_t control, uint32_t arg) {
444 return ARM_DRIVER_OK;
447 \fn int32_t ARM_I2C_Control (uint32_t control, uint32_t arg)
449 The function \b ARM_I2C_Control operates the I2C interface and executes various operations.
451 The parameter \em control specifies various operations as listed in the table below. \n
452 The parameter \em arg provides, depending on the operation, additional information. \n
454 Parameter \em control | Operation
455 :--------------------------------|:--------------------------------------------
456 \ref ARM_I2C_OWN_ADDRESS | Set Own Slave Address; \em arg = slave address
457 \ref ARM_I2C_BUS_SPEED | Set Bus Speed; \em arg = bus speed
458 \ref ARM_I2C_BUS_CLEAR | Clear the bus by sending nine clock pulses
459 \ref ARM_I2C_ABORT_TRANSFER | Aborts the data transfer between Master and Slave for Transmit or Receive
461 <b>Set Own Slave Address</b>
463 After initialization, the I2C Device has no slave address assigned and does not accept any requests from
466 The \em control operation \ref ARM_I2C_OWN_ADDRESS sets the slave address with the parameter \em arg.
467 The slave address can be ORed with \ref ARM_I2C_ADDRESS_10BIT to indicate a 10-bit address.
469 The slave address can be ORed with \ref ARM_I2C_ADDRESS_GC to indicate that the slave accepts a General Call.
470 If the slave address value is only \ref ARM_I2C_ADDRESS_GC, then the slave only accepts a General Call.
472 The slave address value \token{0} disables Slave mode and clears any assigned slave address.
476 Set the Slave address value \token{0x45} as 7-bit address.
478 I2Cdrv->Control (ARM_I2C_OWN_ADDRESS, 0x45);
481 Set the Slave address value \token{0x135} as 10-bit address and accept a General Call.
483 I2Cdrv->Control (ARM_I2C_OWN_ADDRESS, 0x135 | ARM_I2C_ADDRESS_10BIT | ARM_I2C_ADDRESS_GC);
488 The \em control operation \ref ARM_I2C_BUS_SPEED sets the bus speed using the parameter \em arg.
490 Parameter \em arg | Bus Speed
491 :--------------------------------|:--------------------------------------------
492 \ref ARM_I2C_BUS_SPEED_STANDARD | Standard Speed to (\token{100 kHz})
493 \ref ARM_I2C_BUS_SPEED_FAST | Fast Speed (\token{400kHz})
494 \ref ARM_I2C_BUS_SPEED_FAST_PLUS | Fast + Speed (\token{1MHz})
495 \ref ARM_I2C_BUS_SPEED_HIGH | High Speed (\token{3.4MHz})
500 I2Cdrv->Control (ARM_I2C_BUS_SPEED, I2C_BUS_SPEED_FAST);
502 *****************************************************************************************************************/
504 ARM_I2C_STATUS ARM_I2C_GetStatus (void) {
508 \fn ARM_I2C_STATUS ARM_I2C_GetStatus (void)
510 The function \b ARM_I2C_GetStatus returns the current I2C interface status.
512 Refer to \ref ARM_I2C_STATUS for details.
513 *****************************************************************************************************************/
515 void ARM_I2C_SignalEvent (uint32_t event) {
519 \fn void ARM_I2C_SignalEvent (uint32_t event)
521 The function \b ARM_I2C_SignalEvent is a callback function registered by the function \ref ARM_I2C_Initialize..
522 It is called by the I2C driver to notify the application about \ref I2C_events occured during operation.
524 The parameter \a event indicates one or more events that occurred during driver operation.
525 Each event is encoded in a separate bit and therefore it is possible to signal multiple events within the same call.
527 The following events can be generated:
529 Parameter \em event | Bit | Description
530 :---------------------------------------- |:---------:|:----------------------------------------------------------
531 \ref ARM_I2C_EVENT_TRANSFER_DONE | 1UL << 0 | Occurs after Master/Slave Transmit/Receive operation has finished.
532 \ref ARM_I2C_EVENT_TRANSFER_INCOMPLETE | 1UL << 1 | Occurs together with \ref ARM_I2C_EVENT_TRANSFER_DONE when less data is transferred then requested.
533 \ref ARM_I2C_EVENT_SLAVE_TRANSMIT | 1UL << 2 | Occurs when addressed as Slave Transmitter and \ref ARM_I2C_SlaveTransmit has not been started.
534 \ref ARM_I2C_EVENT_SLAVE_RECEIVE | 1UL << 3 | Occurs when addressed as Slave Receiver and \ref ARM_I2C_SlaveReceive has not been started.
535 \ref ARM_I2C_EVENT_ADDRESS_NACK | 1UL << 4 | Occurs in master mode when address is not acknowledged from slave.
536 \ref ARM_I2C_EVENT_GENERAL_CALL | 1UL << 5 | Indicates General Call in slave mode together with \ref ARM_I2C_EVENT_TRANSFER_DONE, \ref ARM_I2C_EVENT_SLAVE_TRANSMIT and \ref ARM_I2C_EVENT_SLAVE_RECEIVE.
537 \ref ARM_I2C_EVENT_ARBITRATION_LOST | 1UL << 6 | Occurs in master mode when arbitration is lost.
538 \ref ARM_I2C_EVENT_BUS_ERROR | 1UL << 7 | Occurs when bus error is detected.
539 \ref ARM_I2C_EVENT_BUS_CLEAR | 1UL << 8 | Occurs after \ref ARM_I2C_BUS_CLEAR Control operation has finished.
541 **************************************************************************************************************************/
545 \defgroup i2c_control_gr I2C Control Codes
546 \ingroup i2c_interface_gr
547 \brief Many parameters of the I2C driver are configured using the \ref ARM_I2C_Control function.
550 The various I2C control codes define:
551 - \ref i2c_control_codes specify operation parameters and various controls
552 - \ref i2c_bus_speed_ctrls specify the I2C bus speed
554 Refer to the \ref ARM_I2C_Control function for further details.
558 \defgroup i2c_control_codes I2C Control Codes
559 \ingroup i2c_control_gr
560 \brief Specify operation parameters and various controls.
563 \def ARM_I2C_OWN_ADDRESS
565 \def ARM_I2C_BUS_SPEED
566 Speed is specified using the following values: \ref i2c_bus_speed_ctrls
568 \def ARM_I2C_BUS_CLEAR
570 \def ARM_I2C_ABORT_TRANSFER
576 \defgroup i2c_bus_speed_ctrls I2C Bus Speed
577 \ingroup i2c_control_gr
578 \brief Specify the I2C bus speed.
581 \def ARM_I2C_BUS_SPEED_STANDARD
583 \def ARM_I2C_BUS_SPEED_FAST
585 \def ARM_I2C_BUS_SPEED_FAST_PLUS
587 \def ARM_I2C_BUS_SPEED_HIGH
596 \defgroup i2c_address_flags I2C Address Flags
597 \ingroup i2c_interface_gr
598 \brief Specify address flags
600 Specifies the address type for the functions \ref ARM_I2C_MasterReceive, \ref ARM_I2C_MasterTransmit and \ref ARM_I2C_OWN_ADDRESS.
602 \def ARM_I2C_ADDRESS_10BIT
603 \sa ARM_I2C_OWN_ADDRESS
604 \sa ARM_I2C_MasterTransmit
605 \sa ARM_I2C_MasterReceive
606 \def ARM_I2C_ADDRESS_GC
607 \sa ARM_I2C_OWN_ADDRESS