2 * -------------------------------------------
3 * MSP432 DriverLib - v3_10_00_09
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2014, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 //*****************************************************************************
42 //! \addtogroup i2c_api
45 //*****************************************************************************
47 //*****************************************************************************
49 // If building with a C++ compiler, make all of the definitions in this header
52 //*****************************************************************************
63 #define EUSCI_B_I2C_NO_AUTO_STOP EUSCI_B_CTLW1_ASTP_0
64 #define EUSCI_B_I2C_SET_BYTECOUNT_THRESHOLD_FLAG EUSCI_B_CTLW1_ASTP_1
65 #define EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD \
68 #define EUSCI_B_I2C_SET_DATA_RATE_1MBPS 1000000
69 #define EUSCI_B_I2C_SET_DATA_RATE_400KBPS 400000
70 #define EUSCI_B_I2C_SET_DATA_RATE_100KBPS 100000
72 #define EUSCI_B_I2C_CLOCKSOURCE_ACLK EUSCI_B_CTLW0_SSEL__ACLK
73 #define EUSCI_B_I2C_CLOCKSOURCE_SMCLK EUSCI_B_CTLW0_SSEL__SMCLK
75 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET0 0x00
76 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET1 0x02
77 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET2 0x04
78 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET3 0x06
80 #define EUSCI_B_I2C_OWN_ADDRESS_DISABLE 0x00
81 #define EUSCI_B_I2C_OWN_ADDRESS_ENABLE EUSCI_B_I2COA0_OAEN
83 #define EUSCI_B_I2C_TRANSMIT_MODE EUSCI_B_CTLW0_TR
84 #define EUSCI_B_I2C_RECEIVE_MODE 0x00
86 #define EUSCI_B_I2C_NAK_INTERRUPT EUSCI_B_IE_NACKIE
87 #define EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT EUSCI_B_IE_ALIE
88 #define EUSCI_B_I2C_STOP_INTERRUPT EUSCI_B_IE_STPIE
89 #define EUSCI_B_I2C_START_INTERRUPT EUSCI_B_IE_STTIE
90 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT0 EUSCI_B_IE_TXIE0
91 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT1 EUSCI_B_IE_TXIE1
92 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT2 EUSCI_B_IE_TXIE2
93 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT3 EUSCI_B_IE_TXIE3
94 #define EUSCI_B_I2C_RECEIVE_INTERRUPT0 EUSCI_B_IE_RXIE0
95 #define EUSCI_B_I2C_RECEIVE_INTERRUPT1 EUSCI_B_IE_RXIE1
96 #define EUSCI_B_I2C_RECEIVE_INTERRUPT2 EUSCI_B_IE_RXIE2
97 #define EUSCI_B_I2C_RECEIVE_INTERRUPT3 EUSCI_B_IE_RXIE3
98 #define EUSCI_B_I2C_BIT9_POSITION_INTERRUPT EUSCI_B_IE_BIT9IE
99 #define EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT EUSCI_B_IE_CLTOIE
100 #define EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT EUSCI_B_IE_BCNTIE
102 #define EUSCI_B_I2C_BUS_BUSY EUSCI_B_STATW_BBUSY
103 #define EUSCI_B_I2C_BUS_NOT_BUSY 0x00
105 #define EUSCI_B_I2C_STOP_SEND_COMPLETE 0x00
106 #define EUSCI_B_I2C_SENDING_STOP EUSCI_B_CTLW0_TXSTP
108 #define EUSCI_B_I2C_START_SEND_COMPLETE 0x00
109 #define EUSCI_B_I2C_SENDING_START EUSCI_B_CTLW0_TXSTT
111 //*****************************************************************************
113 //! ypedef eUSCI_I2C_MasterConfig
114 //! \brief Type definition for \link _eUSCI_I2C_MasterConfig \endlink structure
116 //! \struct _eUSCI_I2C_MasterConfig
117 //! \brief Configuration structure for master mode in the \b I2C module. See
118 //! \link I2C_initMaster \endlink for parameter documentation.
120 //*****************************************************************************
123 uint_fast8_t selectClockSource;
126 uint_fast8_t byteCounterThreshold;
127 uint_fast8_t autoSTOPGeneration;
128 } eUSCI_I2C_MasterConfig;
131 //*****************************************************************************
133 //! Initializes the I2C Master block.
135 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
136 //! parameters vary from part to part, but can include:
137 //! - \b EUSCI_B0_BASE
138 //! - \b EUSCI_B1_BASE
139 //! - \b EUSCI_B2_BASE
140 //! - \b EUSCI_B3_BASE
141 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
142 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
144 //! \param config Configuration structure for I2C master mode
147 //! <b>Configuration options for \link eUSCI_I2C_MasterConfig \endlink structure.</b>
150 //! \param selectClockSource is the clock source.
152 //! - \b EUSCI_B_I2C_CLOCKSOURCE_ACLK
153 //! - \b EUSCI_B_I2C_CLOCKSOURCE_SMCLK
154 //! \param i2cClk is the rate of the clock supplied to the I2C module
155 //! (the frequency in Hz of the clock source specified in
156 //! selectClockSource).
157 //! \param dataRate set up for selecting data transfer rate.
159 //! - \b EUSCI_B_I2C_SET_DATA_RATE_1MBPS
160 //! - \b EUSCI_B_I2C_SET_DATA_RATE_400KBPS
161 //! - \b EUSCI_B_I2C_SET_DATA_RATE_100KBPS
162 //! \param byteCounterThreshold sets threshold for automatic STOP or UCSTPIFG
163 //! \param autoSTOPGeneration sets up the STOP condition generation.
165 //! - \b EUSCI_B_I2C_NO_AUTO_STOP
166 //! - \b EUSCI_B_I2C_SET_BYTECOUNT_THRESHOLD_FLAG
167 //! - \b EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD
169 //! This function initializes operation of the I2C Master block. Upon
170 //! successful initialization of the I2C block, this function will have set the
171 //! bus speed for the master; however I2C module is still disabled till
172 //! I2C_enableModule is invoked
174 //! Modified bits are \b UCMST,UCMODE_3,\b UCSYNC of \b UCBxCTL0 register
175 //! \b UCSSELx, \b UCSWRST, of \b UCBxCTL1 register
176 //! \b UCBxBR0 and \b UCBxBR1 registers
179 //*****************************************************************************
180 extern void I2C_initMaster(uint32_t moduleInstance,
181 const eUSCI_I2C_MasterConfig *config);
183 //*****************************************************************************
185 //! Initializes the I2C Slave block.
187 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
188 //! parameters vary from part to part, but can include:
189 //! - \b EUSCI_B0_BASE
190 //! - \b EUSCI_B1_BASE
191 //! - \b EUSCI_B2_BASE
192 //! - \b EUSCI_B3_BASE
193 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
194 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
197 //! \param slaveAddress 7-bit or 10-bit slave address
198 //! \param slaveAddressOffset Own address Offset referred to- 'x' value of
199 //! UCBxI2COAx. Valid values are:
200 //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET0,
201 //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET1,
202 //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET2,
203 //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET3
204 //! \param slaveOwnAddressEnable selects if the specified address is enabled
205 //! or disabled. Valid values are:
206 //! - \b EUSCI_B_I2C_OWN_ADDRESS_DISABLE,
207 //! - \b EUSCI_B_I2C_OWN_ADDRESS_ENABLE
209 //! This function initializes operation of the I2C as a Slave mode. Upon
210 //! successful initialization of the I2C blocks, this function will have set
211 //! the slave address but the I2C module is still disabled till
212 //! I2C_enableModule is invoked.
214 //! The parameter slaveAddress is the value that will be compared against the
215 //! slave address sent by an I2C master.
217 //! Modified bits are \b UCMODE_3, \b UCSYNC of \b UCBxCTL0 register
218 //! \b UCSWRST of \b UCBxCTL1 register
219 //! \b UCBxI2COA register
223 //*****************************************************************************
224 extern void I2C_initSlave(uint32_t moduleInstance, uint_fast16_t slaveAddress,
225 uint_fast8_t slaveAddressOffset, uint32_t slaveOwnAddressEnable);
227 //*****************************************************************************
229 //! Enables the I2C block.
231 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
232 //! parameters vary from part to part, but can include:
233 //! - \b EUSCI_B0_BASE
234 //! - \b EUSCI_B1_BASE
235 //! - \b EUSCI_B2_BASE
236 //! - \b EUSCI_B3_BASE
237 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
238 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
241 //! This will enable operation of the I2C block.
242 //! Modified bits are \b UCSWRST of \b UCBxCTL1 register.
246 //*****************************************************************************
247 extern void I2C_enableModule(uint32_t moduleInstance);
249 //*****************************************************************************
251 //! Disables the I2C block.
253 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
254 //! parameters vary from part to part, but can include:
255 //! - \b EUSCI_B0_BASE
256 //! - \b EUSCI_B1_BASE
257 //! - \b EUSCI_B2_BASE
258 //! - \b EUSCI_B3_BASE
259 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
260 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
263 //! This will disable operation of the I2C block.
264 //! Modified bits are \b UCSWRST of \b UCBxCTL1 register.
268 //*****************************************************************************
269 extern void I2C_disableModule(uint32_t moduleInstance);
271 //*****************************************************************************
273 //! Sets the address that the I2C Master will place on the bus.
275 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
276 //! parameters vary from part to part, but can include:
277 //! - \b EUSCI_B0_BASE
278 //! - \b EUSCI_B1_BASE
279 //! - \b EUSCI_B2_BASE
280 //! - \b EUSCI_B3_BASE
281 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
282 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
285 //! \param slaveAddress 7-bit or 10-bit slave address
287 //! This function will set the address that the I2C Master will place on the
288 //! bus when initiating a transaction.
289 //! Modified register is \b UCBxI2CSA register
293 //*****************************************************************************
294 extern void I2C_setSlaveAddress(uint32_t moduleInstance,
295 uint_fast16_t slaveAddress);
297 //*****************************************************************************
299 //! Sets the mode of the I2C device
301 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
302 //! parameters vary from part to part, but can include:
303 //! - \b EUSCI_B0_BASE
304 //! - \b EUSCI_B1_BASE
305 //! - \b EUSCI_B2_BASE
306 //! - \b EUSCI_B3_BASE
307 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
308 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
311 //! \param mode indicates whether module is in transmit/receive mode
312 //! - \b EUSCI_B_I2C_TRANSMIT_MODE
313 //! - \b EUSCI_B_I2C_RECEIVE_MODE [Default value]
315 //! Modified bits are \b UCTR of \b UCBxCTL1 register
319 //*****************************************************************************
320 extern void I2C_setMode(uint32_t moduleInstance, uint_fast8_t mode);
322 //*****************************************************************************
324 //! \brief Gets the mode of the I2C device
326 //! Current I2C transmit/receive mode.
328 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
329 //! parameters vary from part to part, but can include:
330 //! - \b EUSCI_B0_BASE
331 //! - \b EUSCI_B1_BASE
332 //! - \b EUSCI_B2_BASE
333 //! - \b EUSCI_B3_BASE
334 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
335 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
338 //! Modified bits are \b UCTR of \b UCBxCTL1 register.
341 //! Return one of the following:
342 //! - \b EUSCI_B_I2C_TRANSMIT_MODE
343 //! - \b EUSCI_B_I2C_RECEIVE_MODE
344 //! \n indicating the current mode
346 //*****************************************************************************
347 extern uint_fast8_t I2C_getMode(uint32_t moduleInstance);
349 //*****************************************************************************
351 //! Transmits a byte from the I2C Module.
353 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
354 //! parameters vary from part to part, but can include:
355 //! - \b EUSCI_B0_BASE
356 //! - \b EUSCI_B1_BASE
357 //! - \b EUSCI_B2_BASE
358 //! - \b EUSCI_B3_BASE
359 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
360 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
363 //! \param transmitData data to be transmitted from the I2C module
365 //! This function will place the supplied data into I2C transmit data register
366 //! to start transmission
367 //! Modified register is \b UCBxTXBUF register
371 //*****************************************************************************
372 extern void I2C_slavePutData(uint32_t moduleInstance, uint8_t transmitData);
374 //*****************************************************************************
376 //! Receives a byte that has been sent to the I2C Module.
378 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
379 //! parameters vary from part to part, but can include:
380 //! - \b EUSCI_B0_BASE
381 //! - \b EUSCI_B1_BASE
382 //! - \b EUSCI_B2_BASE
383 //! - \b EUSCI_B3_BASE
384 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
385 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
388 //! This function reads a byte of data from the I2C receive data Register.
390 //! \return Returns the byte received from by the I2C module, cast as an
392 //! Modified bit is \b UCBxRXBUF register
394 //*****************************************************************************
395 extern uint8_t I2C_slaveGetData(uint32_t moduleInstance);
397 //*****************************************************************************
399 //! Indicates whether or not the I2C bus is busy.
401 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
402 //! parameters vary from part to part, but can include:
403 //! - \b EUSCI_B0_BASE
404 //! - \b EUSCI_B1_BASE
405 //! - \b EUSCI_B2_BASE
406 //! - \b EUSCI_B3_BASE
407 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
408 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
412 //! This function returns an indication of whether or not the I2C bus is
413 //! busy.This function checks the status of the bus via UCBBUSY bit in
414 //! UCBxSTAT register.
416 //! \return Returns EUSCI_B_I2C_BUS_BUSY if the I2C Master is busy; otherwise,
417 //! returns EUSCI_B_I2C_BUS_NOT_BUSY.
419 //*****************************************************************************
420 extern uint8_t I2C_isBusBusy(uint32_t moduleInstance);
422 //*****************************************************************************
424 //! Does single byte transmission from Master to Slave
426 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
427 //! parameters vary from part to part, but can include:
428 //! - \b EUSCI_B0_BASE
429 //! - \b EUSCI_B1_BASE
430 //! - \b EUSCI_B2_BASE
431 //! - \b EUSCI_B3_BASE
432 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
433 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
436 //! \param txData is the data byte to be transmitted
438 //! This function is used by the Master module to send a single byte.
441 //! - Transmits the byte to the Slave
444 //! Modified registers are \b UCBxIE, \b UCBxCTL1, \b UCBxIFG, \b UCBxTXBUF,
449 //*****************************************************************************
450 extern void I2C_masterSendSingleByte(uint32_t moduleInstance, uint8_t txData);
452 //*****************************************************************************
454 //! Does single byte transmission from Master to Slave with timeout
456 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
457 //! parameters vary from part to part, but can include:
458 //! - \b EUSCI_B0_BASE
459 //! - \b EUSCI_B1_BASE
460 //! - \b EUSCI_B2_BASE
461 //! - \b EUSCI_B3_BASE
462 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
463 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
466 //! \param txData is the data byte to be transmitted
467 //! \param timeout is the amount of time to wait until giving up
469 //! This function is used by the Master module to send a single byte.
472 //! - Transmits the byte to the Slave
475 //! Modified registers are \b UCBxIE, \b UCBxCTL1, \b UCBxIFG, \b UCBxTXBUF,
478 //! \return 0x01 or 0x00URE of the transmission process.
480 //*****************************************************************************
481 extern bool I2C_masterSendSingleByteWithTimeout(uint32_t moduleInstance,
482 uint8_t txData, uint32_t timeout);
484 //*****************************************************************************
486 //! Starts multi-byte transmission from Master to Slave
488 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
489 //! parameters vary from part to part, but can include:
490 //! - \b EUSCI_B0_BASE
491 //! - \b EUSCI_B1_BASE
492 //! - \b EUSCI_B2_BASE
493 //! - \b EUSCI_B3_BASE
494 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
495 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
498 //! \param txData is the first data byte to be transmitted
500 //! This function is used by the Master module to send a single byte.
503 //! - Transmits the first data byte of a multi-byte transmission to the Slave
505 //! Modified registers are \b UCBxIE, \b UCBxCTL1, \b UCBxIFG, \b UCBxTXBUF,
510 //*****************************************************************************
511 extern void I2C_masterSendMultiByteStart(uint32_t moduleInstance,
514 //*****************************************************************************
516 //! Starts multi-byte transmission from Master to Slave with timeout
518 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
519 //! parameters vary from part to part, but can include:
520 //! - \b EUSCI_B0_BASE
521 //! - \b EUSCI_B1_BASE
522 //! - \b EUSCI_B2_BASE
523 //! - \b EUSCI_B3_BASE
524 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
525 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
528 //! \param txData is the first data byte to be transmitted
529 //! \param timeout is the amount of time to wait until giving up
531 //! This function is used by the Master module to send a single byte.
534 //! - Transmits the first data byte of a multi-byte transmission to the Slave
536 //! Modified registers are \b UCBxIE, \b UCBxCTL1, \b UCBxIFG, \b UCBxTXBUF,
539 //! \return 0x01 or 0x00URE of the transmission process.
541 //*****************************************************************************
542 extern bool I2C_masterSendMultiByteStartWithTimeout(uint32_t moduleInstance,
543 uint8_t txData, uint32_t timeout);
545 //*****************************************************************************
547 //! Continues multi-byte transmission from Master to Slave
549 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
550 //! parameters vary from part to part, but can include:
551 //! - \b EUSCI_B0_BASE
552 //! - \b EUSCI_B1_BASE
553 //! - \b EUSCI_B2_BASE
554 //! - \b EUSCI_B3_BASE
555 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
556 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
559 //! \param txData is the next data byte to be transmitted
561 //! This function is used by the Master module continue each byte of a
562 //! multi-byte trasmission. This function
563 //! - Transmits each data byte of a multi-byte transmission to the Slave
565 //! Modified registers are \b UCBxTXBUF
569 //*****************************************************************************
570 extern void I2C_masterSendMultiByteNext(uint32_t moduleInstance,
573 //*****************************************************************************
575 //! Continues multi-byte transmission from Master to Slave with timeout
577 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
578 //! parameters vary from part to part, but can include:
579 //! - \b EUSCI_B0_BASE
580 //! - \b EUSCI_B1_BASE
581 //! - \b EUSCI_B2_BASE
582 //! - \b EUSCI_B3_BASE
583 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
584 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
587 //! \param txData is the next data byte to be transmitted
589 //! \param timeout is the amount of time to wait until giving up
591 //! This function is used by the Master module continue each byte of a
592 //! multi-byte transmission. This function
593 //! - Transmits each data byte of a multi-byte transmission to the Slave
595 //! Modified registers are \b UCBxTXBUF
597 //! \return 0x01 or 0x00URE of the transmission process.
599 //*****************************************************************************
600 extern bool I2C_masterSendMultiByteNextWithTimeout(uint32_t moduleInstance,
601 uint8_t txData, uint32_t timeout);
603 //*****************************************************************************
605 //! Finishes multi-byte transmission from Master to Slave
607 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
608 //! parameters vary from part to part, but can include:
609 //! - \b EUSCI_B0_BASE
610 //! - \b EUSCI_B1_BASE
611 //! - \b EUSCI_B2_BASE
612 //! - \b EUSCI_B3_BASE
613 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
614 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
617 //! \param txData is the last data byte to be transmitted in a multi-byte
620 //! This function is used by the Master module to send the last byte and STOP.
622 //! - Transmits the last data byte of a multi-byte transmission to the Slave
625 //! Modified registers are \b UCBxTXBUF and \b UCBxCTL1.
629 //*****************************************************************************
630 extern void I2C_masterSendMultiByteFinish(uint32_t moduleInstance,
633 //*****************************************************************************
635 //! Finishes multi-byte transmission from Master to Slave with timeout
637 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
638 //! parameters vary from part to part, but can include:
639 //! - \b EUSCI_B0_BASE
640 //! - \b EUSCI_B1_BASE
641 //! - \b EUSCI_B2_BASE
642 //! - \b EUSCI_B3_BASE
643 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
644 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
647 //! \param txData is the last data byte to be transmitted in a multi-byte
649 //! \param timeout is the amount of time to wait until giving up
651 //! This function is used by the Master module to send the last byte and STOP.
653 //! - Transmits the last data byte of a multi-byte transmission to the Slave
656 //! Modified registers are \b UCBxTXBUF and \b UCBxCTL1.
658 //! \return 0x01 or 0x00URE of the transmission process.
660 //*****************************************************************************
661 extern bool I2C_masterSendMultiByteFinishWithTimeout(uint32_t moduleInstance,
662 uint8_t txData, uint32_t timeout);
664 //*****************************************************************************
666 //! Send STOP byte at the end of a multi-byte transmission from Master to Slave
668 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
669 //! parameters vary from part to part, but can include:
670 //! - \b EUSCI_B0_BASE
671 //! - \b EUSCI_B1_BASE
672 //! - \b EUSCI_B2_BASE
673 //! - \b EUSCI_B3_BASE
674 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
675 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
679 //! This function is used by the Master module send STOP at the end of a
680 //! multi-byte transmission
683 //! - Send a STOP after current transmission is complete
685 //! Modified bits are \b UCTXSTP bit of \b UCBxCTL1.
688 //*****************************************************************************
689 extern void I2C_masterSendMultiByteStop(uint32_t moduleInstance);
691 //*****************************************************************************
693 //! Send STOP byte at the end of a multi-byte transmission from Master to Slave
696 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
697 //! parameters vary from part to part, but can include:
698 //! - \b EUSCI_B0_BASE
699 //! - \b EUSCI_B1_BASE
700 //! - \b EUSCI_B2_BASE
701 //! - \b EUSCI_B3_BASE
702 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
703 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
706 //! \param timeout is the amount of time to wait until giving up
708 //! This function is used by the Master module send STOP at the end of a
709 //! multi-byte transmission
712 //! - Send a STOP after current transmission is complete
714 //! Modified bits are \b UCTXSTP bit of \b UCBxCTL1.
715 //! \return 0x01 or 0x00URE of the transmission process.
717 //*****************************************************************************
718 extern bool I2C_masterSendMultiByteStopWithTimeout(uint32_t moduleInstance,
721 //*****************************************************************************
723 //! Starts reception at the Master end
725 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
726 //! parameters vary from part to part, but can include:
727 //! - \b EUSCI_B0_BASE
728 //! - \b EUSCI_B1_BASE
729 //! - \b EUSCI_B2_BASE
730 //! - \b EUSCI_B3_BASE
731 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
732 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
736 //! This function is used by the Master module initiate reception of a single
737 //! byte. This function
740 //! Modified bits are \b UCTXSTT bit of \b UCBxCTL1.
743 //*****************************************************************************
744 extern void I2C_masterReceiveStart(uint32_t moduleInstance);
746 //*****************************************************************************
748 //! Starts multi-byte reception at the Master end one byte at a time
750 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
751 //! parameters vary from part to part, but can include:
752 //! - \b EUSCI_B0_BASE
753 //! - \b EUSCI_B1_BASE
754 //! - \b EUSCI_B2_BASE
755 //! - \b EUSCI_B3_BASE
756 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
757 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
761 //! This function is used by the Master module to receive each byte of a
762 //! multi-byte reception
763 //! This function reads currently received byte
765 //! Modified register is \b UCBxRXBUF.
766 //! \return Received byte at Master end.
768 //*****************************************************************************
769 extern uint8_t I2C_masterReceiveMultiByteNext(uint32_t moduleInstance);
771 //*****************************************************************************
773 //! Finishes multi-byte reception at the Master end
775 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
776 //! parameters vary from part to part, but can include:
777 //! - \b EUSCI_B0_BASE
778 //! - \b EUSCI_B1_BASE
779 //! - \b EUSCI_B2_BASE
780 //! - \b EUSCI_B3_BASE
781 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
782 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
786 //! This function is used by the Master module to initiate completion of a
787 //! multi-byte reception
789 //! - Receives the current byte and initiates the STOP from Master to Slave
791 //! Modified bits are \b UCTXSTP bit of \b UCBxCTL1.
793 //! \return Received byte at Master end.
795 //*****************************************************************************
796 extern uint8_t I2C_masterReceiveMultiByteFinish(uint32_t moduleInstance);
798 //*****************************************************************************
800 //! Finishes multi-byte reception at the Master end with timeout
802 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
803 //! parameters vary from part to part, but can include:
804 //! - \b EUSCI_B0_BASE
805 //! - \b EUSCI_B1_BASE
806 //! - \b EUSCI_B2_BASE
807 //! - \b EUSCI_B3_BASE
808 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
809 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
812 //! \param txData is a pointer to the location to store the received byte at
814 //! \param timeout is the amount of time to wait until giving up
816 //! This function is used by the Master module to initiate completion of a
817 //! multi-byte reception
819 //! - Receives the current byte and initiates the STOP from Master to Slave
821 //! Modified bits are \b UCTXSTP bit of \b UCBxCTL1.
823 //! \return 0x01 or 0x00URE of the transmission process.
825 //*****************************************************************************
826 extern bool I2C_masterReceiveMultiByteFinishWithTimeout(uint32_t moduleInstance,
827 uint8_t *txData, uint32_t timeout);
829 //*****************************************************************************
831 //! Sends the STOP at the end of a multi-byte reception at the Master end
833 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
834 //! parameters vary from part to part, but can include:
835 //! - \b EUSCI_B0_BASE
836 //! - \b EUSCI_B1_BASE
837 //! - \b EUSCI_B2_BASE
838 //! - \b EUSCI_B3_BASE
839 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
840 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
844 //! This function is used by the Master module to initiate STOP
846 //! Modified bits are UCTXSTP bit of UCBxCTL1.
850 //*****************************************************************************
851 extern void I2C_masterReceiveMultiByteStop(uint32_t moduleInstance);
853 //*****************************************************************************
855 //! Does single byte reception from the slave
857 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
858 //! parameters vary from part to part, but can include:
859 //! - \b EUSCI_B0_BASE
860 //! - \b EUSCI_B1_BASE
861 //! - \b EUSCI_B2_BASE
862 //! - \b EUSCI_B3_BASE
863 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
864 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
867 //! This function is used by the Master module to receive a single byte.
869 //! - Sends START and STOP
870 //! - Waits for data reception
871 //! - Receives one byte from the Slave
873 //! Modified registers are \b UCBxIE, \b UCBxCTL1, \b UCBxIFG, \b UCBxTXBUF,
876 //! \return The byte that has been received from the slave
878 //*****************************************************************************
879 extern uint8_t I2C_masterReceiveSingleByte(uint32_t moduleInstance);
881 //*****************************************************************************
883 //! Receives a byte that has been sent to the I2C Master Module.
885 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
886 //! parameters vary from part to part, but can include:
887 //! - \b EUSCI_B0_BASE
888 //! - \b EUSCI_B1_BASE
889 //! - \b EUSCI_B2_BASE
890 //! - \b EUSCI_B3_BASE
891 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
892 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
896 //! This function reads a byte of data from the I2C receive data Register.
898 //! \return Returns the byte received from by the I2C module, cast as an
901 //*****************************************************************************
902 extern uint8_t I2C_masterReceiveSingle(uint32_t moduleInstance);
904 //*****************************************************************************
906 //! Returns the address of the RX Buffer of the I2C for the DMA module.
908 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
909 //! parameters vary from part to part, but can include:
910 //! - \b EUSCI_B0_BASE
911 //! - \b EUSCI_B1_BASE
912 //! - \b EUSCI_B2_BASE
913 //! - \b EUSCI_B3_BASE
914 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
915 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
919 //! Returns the address of the I2C RX Buffer. This can be used in conjunction
920 //! with the DMA to store the received data directly to memory.
924 //*****************************************************************************
925 extern uint32_t I2C_getReceiveBufferAddressForDMA(uint32_t moduleInstance);
927 //*****************************************************************************
929 //! Returns the address of the TX Buffer of the I2C for the DMA module.
931 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
932 //! parameters vary from part to part, but can include:
933 //! - \b EUSCI_B0_BASE
934 //! - \b EUSCI_B1_BASE
935 //! - \b EUSCI_B2_BASE
936 //! - \b EUSCI_B3_BASE
937 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
938 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
942 //! Returns the address of the I2C TX Buffer. This can be used in conjunction
943 //! with the DMA to obtain transmitted data directly from memory.
947 //*****************************************************************************
948 extern uint32_t I2C_getTransmitBufferAddressForDMA(uint32_t moduleInstance);
950 //*****************************************************************************
952 //! Indicates whether STOP got sent.
954 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
955 //! parameters vary from part to part, but can include:
956 //! - \b EUSCI_B0_BASE
957 //! - \b EUSCI_B1_BASE
958 //! - \b EUSCI_B2_BASE
959 //! - \b EUSCI_B3_BASE
960 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
961 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
965 //! This function returns an indication of whether or not STOP got sent
966 //! This function checks the status of the bus via UCTXSTP bit in
967 //! UCBxCTL1 register.
969 //! \return Returns EUSCI_B_I2C_STOP_SEND_COMPLETE if the I2C Master
970 //! finished sending STOP; otherwise, returns EUSCI_B_I2C_SENDING_STOP.
972 //*****************************************************************************
973 extern uint8_t I2C_masterIsStopSent(uint32_t moduleInstance);
975 //*****************************************************************************
977 //! Indicates whether Start got sent.
979 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
980 //! parameters vary from part to part, but can include:
981 //! - \b EUSCI_B0_BASE
982 //! - \b EUSCI_B1_BASE
983 //! - \b EUSCI_B2_BASE
984 //! - \b EUSCI_B3_BASE
985 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
986 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
990 //! This function returns an indication of whether or not Start got sent
991 //! This function checks the status of the bus via UCTXSTT bit in
992 //! UCBxCTL1 register.
994 //! \return Returns true if the START has been sent, false if it is sending
996 //*****************************************************************************
997 extern bool I2C_masterIsStartSent(uint32_t moduleInstance);
999 //*****************************************************************************
1001 //! This function is used by the Master module to initiate START
1003 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1004 //! parameters vary from part to part, but can include:
1005 //! - \b EUSCI_B0_BASE
1006 //! - \b EUSCI_B1_BASE
1007 //! - \b EUSCI_B2_BASE
1008 //! - \b EUSCI_B3_BASE
1009 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1010 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1014 //! This function is used by the Master module to initiate STOP
1016 //! Modified bits are UCTXSTT bit of UCBxCTLW0.
1020 //*****************************************************************************
1021 extern void I2C_masterSendStart(uint32_t moduleInstance);
1023 //*****************************************************************************
1025 //! Enables Multi Master Mode
1027 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1028 //! parameters vary from part to part, but can include:
1029 //! - \b EUSCI_B0_BASE
1030 //! - \b EUSCI_B1_BASE
1031 //! - \b EUSCI_B2_BASE
1032 //! - \b EUSCI_B3_BASE
1033 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1034 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1038 //! At the end of this function, the I2C module is still disabled till
1039 //! I2C_enableModule is invoked
1041 //! Modified bits are \b UCSWRST of \b OFS_UCBxCTLW0, \b UCMM bit of
1046 //*****************************************************************************
1047 extern void I2C_enableMultiMasterMode(uint32_t moduleInstance);
1049 //*****************************************************************************
1051 //! Disables Multi Master Mode
1053 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1054 //! parameters vary from part to part, but can include:
1055 //! - \b EUSCI_B0_BASE
1056 //! - \b EUSCI_B1_BASE
1057 //! - \b EUSCI_B2_BASE
1058 //! - \b EUSCI_B3_BASE
1059 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1060 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1064 //! At the end of this function, the I2C module is still disabled till
1065 //! I2C_enableModule is invoked
1067 //! Modified bits are \b UCSWRST of \b OFS_UCBxCTLW0, \b UCMM bit of
1072 //*****************************************************************************
1073 extern void I2C_disableMultiMasterMode(uint32_t moduleInstance);
1075 //*****************************************************************************
1077 //! Enables individual I2C interrupt sources.
1079 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1080 //! parameters vary from part to part, but can include:
1081 //! - \b EUSCI_B0_BASE
1082 //! - \b EUSCI_B1_BASE
1083 //! - \b EUSCI_B2_BASE
1084 //! - \b EUSCI_B3_BASE
1085 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1086 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1089 //! \param mask is the bit mask of the interrupt sources to
1092 //! Enables the indicated I2C interrupt sources. Only the sources that
1093 //! are enabled can be reflected to the processor interrupt; disabled sources
1094 //! have no effect on the processor.
1096 //! The mask parameter is the logical OR of any of the following:
1098 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
1099 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
1100 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
1101 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
1102 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
1103 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
1104 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
1105 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
1106 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
1107 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
1108 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
1109 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
1110 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt enable
1111 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt
1113 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable
1115 //! Modified registers are UCBxIFG and OFS_UCBxIE.
1119 //*****************************************************************************
1120 extern void I2C_enableInterrupt(uint32_t moduleInstance, uint_fast16_t mask);
1122 //*****************************************************************************
1124 //! Disables individual I2C interrupt sources.
1126 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1127 //! parameters vary from part to part, but can include:
1128 //! - \b EUSCI_B0_BASE
1129 //! - \b EUSCI_B1_BASE
1130 //! - \b EUSCI_B2_BASE
1131 //! - \b EUSCI_B3_BASE
1132 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1133 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1136 //! \param mask is the bit mask of the interrupt sources to be
1139 //! Disables the indicated I2C interrupt sources. Only the sources that
1140 //! are enabled can be reflected to the processor interrupt; disabled sources
1141 //! have no effect on the processor.
1143 //! The mask parameter is the logical OR of any of the following:
1145 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
1146 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
1147 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
1148 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
1149 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
1150 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
1151 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
1152 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
1153 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
1154 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
1155 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
1156 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
1157 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt enable
1158 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt
1160 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable
1162 //! Modified register is \b UCBxIE.
1166 //*****************************************************************************
1167 extern void I2C_disableInterrupt(uint32_t moduleInstance, uint_fast16_t mask);
1169 //*****************************************************************************
1171 //! Clears I2C interrupt sources.
1173 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1174 //! parameters vary from part to part, but can include:
1175 //! - \b EUSCI_B0_BASE
1176 //! - \b EUSCI_B1_BASE
1177 //! - \b EUSCI_B2_BASE
1178 //! - \b EUSCI_B3_BASE
1179 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1180 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1183 //! \param mask is a bit mask of the interrupt sources to be cleared.
1185 //! The I2C interrupt source is cleared, so that it no longer asserts.
1186 //! The highest interrupt flag is automatically cleared when an interrupt vector
1187 //! generator is used.
1189 //! The mask parameter has the same definition as the mask
1190 //! parameter to I2C_enableInterrupt().
1192 //! Modified register is \b UCBxIFG.
1196 //*****************************************************************************
1197 extern void I2C_clearInterruptFlag(uint32_t moduleInstance, uint_fast16_t mask);
1199 //*****************************************************************************
1201 //! Gets the current I2C interrupt status.
1203 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1204 //! parameters vary from part to part, but can include:
1205 //! - \b EUSCI_B0_BASE
1206 //! - \b EUSCI_B1_BASE
1207 //! - \b EUSCI_B2_BASE
1208 //! - \b EUSCI_B3_BASE
1209 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1210 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1212 //! \param mask is the masked interrupt flag status to be returned.
1213 //! Mask value is the logical OR of any of the following:
1214 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
1215 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost
1217 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
1218 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
1219 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
1220 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
1221 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
1222 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
1223 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
1224 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
1225 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
1226 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
1227 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
1228 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout
1229 //! interrupt enable
1230 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt
1233 //! \return the masked status of the interrupt flag
1234 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
1235 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
1236 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
1237 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
1238 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
1239 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
1240 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
1241 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
1242 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
1243 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
1244 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
1245 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
1246 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt enable
1247 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt
1249 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable
1251 //*****************************************************************************
1252 extern uint_fast16_t I2C_getInterruptStatus(uint32_t moduleInstance, uint16_t mask);
1254 //*****************************************************************************
1256 //! Gets the current I2C interrupt status masked with the enabled interrupts.
1257 //! This function is useful to call in ISRs to get a list of pending interrupts
1258 //! that are actually enabled and could have caused the ISR.
1260 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1261 //! parameters vary from part to part, but can include:
1262 //! - \b EUSCI_B0_BASE
1263 //! - \b EUSCI_B1_BASE
1264 //! - \b EUSCI_B2_BASE
1265 //! - \b EUSCI_B3_BASE
1266 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1267 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1270 //! \return the masked status of the interrupt flag
1271 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
1272 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
1273 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
1274 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
1275 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
1276 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
1277 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
1278 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
1279 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
1280 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
1281 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
1282 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
1283 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt enable
1284 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt
1286 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable
1288 //*****************************************************************************
1289 extern uint_fast16_t I2C_getEnabledInterruptStatus(uint32_t moduleInstance);
1291 //*****************************************************************************
1293 //! Registers an interrupt handler for I2C interrupts.
1295 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1296 //! parameters vary from part to part, but can include:
1297 //! - \b EUSCI_B0_BASE
1298 //! - \b EUSCI_B1_BASE
1299 //! - \b EUSCI_B2_BASE
1300 //! - \b EUSCI_B3_BASE
1301 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1302 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1305 //! \param intHandler is a pointer to the function to be called when the
1306 //! timer capture compare interrupt occurs.
1308 //! This function registers the handler to be called when an I2C
1309 //! interrupt occurs. This function enables the global interrupt in the
1310 //! interrupt controller; specific I2C interrupts must be enabled
1311 //! via I2C_enableInterrupt(). It is the interrupt handler's responsibility to
1312 //! clear the interrupt source via I2C_clearInterruptFlag().
1314 //! \sa Interrupt_registerInterrupt() for important information about
1315 //! registering interrupt handlers.
1319 //*****************************************************************************
1320 extern void I2C_registerInterrupt(uint32_t moduleInstance,
1321 void (*intHandler)(void));
1323 //*****************************************************************************
1325 //! Unregisters the interrupt handler for the timer
1327 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1328 //! parameters vary from part to part, but can include:
1329 //! - \b EUSCI_B0_BASE
1330 //! - \b EUSCI_B1_BASE
1331 //! - \b EUSCI_B2_BASE
1332 //! - \b EUSCI_B3_BASE
1333 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1334 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1337 //! This function unregisters the handler to be called when timer
1338 //! interrupt occurs. This function also masks off the interrupt in the
1339 //! interrupt controller so that the interrupt handler no longer is called.
1341 //! \sa Interrupt_registerInterrupt() for important information about
1342 //! registering interrupt handlers.
1346 //*****************************************************************************
1347 extern void I2C_unregisterInterrupt(uint32_t moduleInstance);
1350 //*****************************************************************************
1352 //! This function is used by the slave to send a NAK out over the I2C line
1354 //! \param moduleInstance is the instance of the eUSCI B (I2C) module. Valid
1355 //! parameters vary from part to part, but can include:
1356 //! - \b EUSCI_B0_BASE
1357 //! - \b EUSCI_B1_BASE
1358 //! - \b EUSCI_B2_BASE
1359 //! - \b EUSCI_B3_BASE
1360 //! <br>It is important to note that for eUSCI modules, only "B" modules such as
1361 //! EUSCI_B0 can be used. "A" modules such as EUSCI_A0 do not support the
1366 //*****************************************************************************
1367 extern void I2C_slaveSendNAK(uint32_t moduleInstance);
1369 /* Backwards Compatibility Layer */
1370 #define EUSCI_B_I2C_slaveInit I2C_initSlave
1371 #define EUSCI_B_I2C_enable I2C_enableModule
1372 #define EUSCI_B_I2C_disable I2C_disableModule
1373 #define EUSCI_B_I2C_setSlaveAddress I2C_setSlaveAddress
1374 #define EUSCI_B_I2C_setMode I2C_setMode
1375 #define EUSCI_B_I2C_getMode I2C_getMode
1376 #define EUSCI_B_I2C_slaveDataPut I2C_slavePutData
1377 #define EUSCI_B_I2C_slaveDataGet I2C_slaveGetData
1378 #define EUSCI_B_I2C_isBusBusy I2C_isBusBusy
1379 #define EUSCI_B_I2C_masterIsStopSent I2C_masterIsStopSent
1380 #define EUSCI_B_I2C_masterIsStartSent I2C_masterIsStartSent
1381 #define EUSCI_B_I2C_enableInterrupt I2C_enableInterrupt
1382 #define EUSCI_B_I2C_disableInterrupt I2C_disableInterrupt
1383 #define EUSCI_B_I2C_clearInterruptFlag I2C_clearInterruptFlag
1384 #define EUSCI_B_I2C_getInterruptStatus I2C_getEnabledInterruptStatus
1385 #define EUSCI_B_I2C_masterSendSingleByte I2C_masterSendSingleByte
1386 #define EUSCI_B_I2C_masterReceiveSingleByte I2C_masterReceiveSingleByte
1387 #define EUSCI_B_I2C_masterSendSingleByteWithTimeout I2C_masterSendSingleByteWithTimeout
1388 #define EUSCI_B_I2C_masterMultiByteSendStart I2C_masterSendMultiByteStart
1389 #define EUSCI_B_I2C_masterMultiByteSendStartWithTimeout I2C_masterSendMultiByteStartWithTimeout
1390 #define EUSCI_B_I2C_masterMultiByteSendNext I2C_masterSendMultiByteNext
1391 #define EUSCI_B_I2C_masterMultiByteSendNextWithTimeout I2C_masterSendMultiByteNextWithTimeout
1392 #define EUSCI_B_I2C_masterMultiByteSendFinish I2C_masterSendMultiByteFinish
1393 #define EUSCI_B_I2C_masterMultiByteSendFinishWithTimeout I2C_masterSendMultiByteFinishWithTimeout
1394 #define EUSCI_B_I2C_masterSendStart I2C_masterSendStart
1395 #define EUSCI_B_I2C_masterMultiByteSendStop I2C_masterSendMultiByteStop
1396 #define EUSCI_B_I2C_masterMultiByteSendStopWithTimeout I2C_masterSendMultiByteStopWithTimeout
1397 #define EUSCI_B_I2C_masterReceiveStart I2C_masterReceiveStart
1398 #define EUSCI_B_I2C_masterMultiByteReceiveNext I2C_masterReceiveMultiByteNext
1399 #define EUSCI_B_I2C_masterMultiByteReceiveFinish I2C_masterReceiveMultiByteFinish
1400 #define EUSCI_B_I2C_masterMultiByteReceiveFinishWithTimeout I2C_masterReceiveMultiByteFinishWithTimeout
1401 #define EUSCI_B_I2C_masterMultiByteReceiveStop I2C_masterReceiveMultiByteStop
1402 #define EUSCI_B_I2C_enableMultiMasterMode I2C_enableMultiMasterMode
1403 #define EUSCI_B_I2C_disableMultiMasterMode I2C_disableMultiMasterMode
1404 #define EUSCI_B_I2C_masterSingleReceive I2C_masterReceiveSingle
1405 #define EUSCI_B_I2C_getReceiveBufferAddressForDMA I2C_getReceiveBufferAddressForDMA
1406 #define EUSCI_B_I2C_getTransmitBufferAddressForDMA I2C_getTransmitBufferAddressForDMA
1409 //*****************************************************************************
1411 // Mark the end of the C bindings section for C++ compilers.
1413 //*****************************************************************************
1418 //*****************************************************************************
1420 // Close the Doxygen group.
1423 //*****************************************************************************