MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.91.13.01
eusci_b_i2c.h
1 //*****************************************************************************
2 //
3 // eusci_b_i2c.h - Driver for the EUSCI_B_I2C Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_EUSCI_B_I2C_H__
8 #define __MSP430WARE_EUSCI_B_I2C_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_EUSCI_Bx__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
28 //! \brief Used in the EUSCI_B_I2C_initMaster() function as the param
29 //! parameter.
30 //
31 //*****************************************************************************
33  //! Selects the clocksource. Refer to device specific datasheet for
34  //! available options.
35  //! \n Valid values are:
36  //! - \b EUSCI_B_I2C_CLOCKSOURCE_UCLK
37  //! - \b EUSCI_B_I2C_CLOCKSOURCE_ACLK
38  //! - \b EUSCI_B_I2C_CLOCKSOURCE_MODCLK
39  //! - \b EUSCI_B_I2C_CLOCKSOURCE_SMCLK
41  //! Is the rate of the clock supplied to the I2C module (the frequency in
42  //! Hz of the clock source specified in selectClockSource).
43  uint32_t i2cClk;
44  //! Setup for selecting data transfer rate.
45  //! \n Valid values are:
46  //! - \b EUSCI_B_I2C_SET_DATA_RATE_400KBPS
47  //! - \b EUSCI_B_I2C_SET_DATA_RATE_100KBPS
48  uint32_t dataRate;
49  //! Sets threshold for automatic STOP or UCSTPIFG
51  //! Sets up the STOP condition generation.
52  //! \n Valid values are:
53  //! - \b EUSCI_B_I2C_NO_AUTO_STOP
54  //! - \b EUSCI_B_I2C_SET_BYTECOUNT_THRESHOLD_FLAG
55  //! - \b EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD
58 
59 //*****************************************************************************
60 //
61 //! \brief Used in the EUSCI_B_I2C_initSlave() function as the param parameter.
62 //
63 //*****************************************************************************
65  //! 7-bit slave address
66  uint8_t slaveAddress;
67  //! Own address Offset referred to- 'x' value of UCBxI2COAx.
68  //! \n Valid values are:
69  //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET0
70  //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET1
71  //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET2
72  //! - \b EUSCI_B_I2C_OWN_ADDRESS_OFFSET3
74  //! Selects if the specified address is enabled or disabled.
75  //! \n Valid values are:
76  //! - \b EUSCI_B_I2C_OWN_ADDRESS_DISABLE
77  //! - \b EUSCI_B_I2C_OWN_ADDRESS_ENABLE
80 
81 
82 //*****************************************************************************
83 //
84 // The following are values that can be passed to the param parameter for
85 // functions: EUSCI_B_I2C_initMaster().
86 //
87 //*****************************************************************************
88 #define EUSCI_B_I2C_NO_AUTO_STOP UCASTP_0
89 #define EUSCI_B_I2C_SET_BYTECOUNT_THRESHOLD_FLAG UCASTP_1
90 #define EUSCI_B_I2C_SEND_STOP_AUTOMATICALLY_ON_BYTECOUNT_THRESHOLD UCASTP_2
91 
92 //*****************************************************************************
93 //
94 // The following are values that can be passed to the param parameter for
95 // functions: EUSCI_B_I2C_initMaster().
96 //
97 //*****************************************************************************
98 #define EUSCI_B_I2C_SET_DATA_RATE_400KBPS 400000
99 #define EUSCI_B_I2C_SET_DATA_RATE_100KBPS 100000
100 
101 //*****************************************************************************
102 //
103 // The following are values that can be passed to the param parameter for
104 // functions: EUSCI_B_I2C_initMaster().
105 //
106 //*****************************************************************************
107 #define EUSCI_B_I2C_CLOCKSOURCE_UCLK UCSSEL__UCLK
108 #define EUSCI_B_I2C_CLOCKSOURCE_ACLK 0x40
109 #define EUSCI_B_I2C_CLOCKSOURCE_MODCLK 0x40
110 #define EUSCI_B_I2C_CLOCKSOURCE_SMCLK UCSSEL__SMCLK
111 
112 //*****************************************************************************
113 //
114 // The following are values that can be passed to the param parameter for
115 // functions: EUSCI_B_I2C_initSlave().
116 //
117 //*****************************************************************************
118 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET0 0x00
119 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET1 0x02
120 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET2 0x04
121 #define EUSCI_B_I2C_OWN_ADDRESS_OFFSET3 0x06
122 
123 //*****************************************************************************
124 //
125 // The following are values that can be passed to the param parameter for
126 // functions: EUSCI_B_I2C_initSlave().
127 //
128 //*****************************************************************************
129 #define EUSCI_B_I2C_OWN_ADDRESS_DISABLE 0x00
130 #define EUSCI_B_I2C_OWN_ADDRESS_ENABLE UCOAEN
131 
132 //*****************************************************************************
133 //
134 // The following are values that can be passed to the mode parameter for
135 // functions: EUSCI_B_I2C_setMode() as well as returned by the
136 // EUSCI_B_I2C_getMode() function.
137 //
138 //*****************************************************************************
139 #define EUSCI_B_I2C_TRANSMIT_MODE UCTR
140 #define EUSCI_B_I2C_RECEIVE_MODE 0x0000
141 
142 //*****************************************************************************
143 //
144 // The following are values that can be passed to the mask parameter for
145 // functions: EUSCI_B_I2C_enableInterrupt(), EUSCI_B_I2C_disableInterrupt(),
146 // EUSCI_B_I2C_clearInterrupt(), and EUSCI_B_I2C_getInterruptStatus() as well
147 // as returned by the EUSCI_B_I2C_getInterruptStatus() function.
148 //
149 //*****************************************************************************
150 #define EUSCI_B_I2C_NAK_INTERRUPT UCNACKIE
151 #define EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT UCALIE
152 #define EUSCI_B_I2C_STOP_INTERRUPT UCSTPIE
153 #define EUSCI_B_I2C_START_INTERRUPT UCSTTIE
154 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT0 UCTXIE0
155 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT1 UCTXIE1
156 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT2 UCTXIE2
157 #define EUSCI_B_I2C_TRANSMIT_INTERRUPT3 UCTXIE3
158 #define EUSCI_B_I2C_RECEIVE_INTERRUPT0 UCRXIE0
159 #define EUSCI_B_I2C_RECEIVE_INTERRUPT1 UCRXIE1
160 #define EUSCI_B_I2C_RECEIVE_INTERRUPT2 UCRXIE2
161 #define EUSCI_B_I2C_RECEIVE_INTERRUPT3 UCRXIE3
162 #define EUSCI_B_I2C_BIT9_POSITION_INTERRUPT UCBIT9IE
163 #define EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT UCCLTOIE
164 #define EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT UCBCNTIE
165 
166 //*****************************************************************************
167 //
168 // The following are values that can be passed toThe following are values that
169 // can be returned by the EUSCI_B_I2C_isBusBusy() function.
170 //
171 //*****************************************************************************
172 #define EUSCI_B_I2C_BUS_BUSY UCBBUSY
173 #define EUSCI_B_I2C_BUS_NOT_BUSY 0x00
174 
175 //*****************************************************************************
176 //
177 // The following are values that can be passed toThe following are values that
178 // can be returned by the EUSCI_B_I2C_masterIsStopSent() function.
179 //
180 //*****************************************************************************
181 #define EUSCI_B_I2C_STOP_SEND_COMPLETE 0x00
182 #define EUSCI_B_I2C_SENDING_STOP UCTXSTP
183 
184 //*****************************************************************************
185 //
186 // The following are values that can be passed toThe following are values that
187 // can be returned by the EUSCI_B_I2C_masterIsStartSent() function.
188 //
189 //*****************************************************************************
190 #define EUSCI_B_I2C_START_SEND_COMPLETE 0x00
191 #define EUSCI_B_I2C_SENDING_START UCTXSTT
192 
193 //*****************************************************************************
194 //
195 // The following are values that can be passed to the pinsSelect parameter for
196 // functions: EUSCI_B_I2C_remapPins().
197 //
198 //*****************************************************************************
199 #define EUSCI_B_I2C_REMAP_PINS_FALSE (0x0000)
200 #define EUSCI_B_I2C_REMAP_PINS_TRUE (0x0001)
201 
202 //*****************************************************************************
203 //
204 // The following are values that can be passed to the timeout parameter for
205 // functions: EUSCI_B_I2C_setTimeout().
206 //
207 //*****************************************************************************
208 #define EUSCI_B_I2C_TIMEOUT_DISABLE UCCLTO_0
209 #define EUSCI_B_I2C_TIMEOUT_28_MS UCCLTO_1
210 #define EUSCI_B_I2C_TIMEOUT_31_MS UCCLTO_2
211 #define EUSCI_B_I2C_TIMEOUT_34_MS UCCLTO_3
212 
213 //*****************************************************************************
214 //
215 // Prototypes for the APIs.
216 //
217 //*****************************************************************************
218 
219 //*****************************************************************************
220 //
221 //! \brief Initializes the I2C Master block.
222 //!
223 //! This function initializes operation of the I2C Master block. Upon
224 //! successful initialization of the I2C block, this function will have set the
225 //! bus speed for the master; however I2C module is still disabled till
226 //! EUSCI_B_I2C_enable is invoked.
227 //!
228 //! \param baseAddress is the base address of the I2C Master module.
229 //! \param param is the pointer to the struct for master initialization.
230 //!
231 //! \return None
232 //
233 //*****************************************************************************
234 extern void EUSCI_B_I2C_initMaster(uint16_t baseAddress,
236 
237 //*****************************************************************************
238 //
239 //! \brief Initializes the I2C Slave block.
240 //!
241 //! This function initializes operation of the I2C as a Slave mode. Upon
242 //! successful initialization of the I2C blocks, this function will have set
243 //! the slave address but the I2C module is still disabled till
244 //! EUSCI_B_I2C_enable is invoked.
245 //!
246 //! \param baseAddress is the base address of the I2C Slave module.
247 //! \param param is the pointer to the struct for slave initialization.
248 //!
249 //! \return None
250 //
251 //*****************************************************************************
252 extern void EUSCI_B_I2C_initSlave(uint16_t baseAddress,
254 
255 //*****************************************************************************
256 //
257 //! \brief Enables the I2C block.
258 //!
259 //! This will enable operation of the I2C block.
260 //!
261 //! \param baseAddress is the base address of the USCI I2C module.
262 //!
263 //! Modified bits are \b UCSWRST of \b UCBxCTLW0 register.
264 //!
265 //! \return None
266 //
267 //*****************************************************************************
268 extern void EUSCI_B_I2C_enable(uint16_t baseAddress);
269 
270 //*****************************************************************************
271 //
272 //! \brief Disables the I2C block.
273 //!
274 //! This will disable operation of the I2C block.
275 //!
276 //! \param baseAddress is the base address of the USCI I2C module.
277 //!
278 //! Modified bits are \b UCSWRST of \b UCBxCTLW0 register.
279 //!
280 //! \return None
281 //
282 //*****************************************************************************
283 extern void EUSCI_B_I2C_disable(uint16_t baseAddress);
284 
285 //*****************************************************************************
286 //
287 //! \brief Sets the address that the I2C Master will place on the bus.
288 //!
289 //! This function will set the address that the I2C Master will place on the
290 //! bus when initiating a transaction.
291 //!
292 //! \param baseAddress is the base address of the USCI I2C module.
293 //! \param slaveAddress 7-bit slave address
294 //!
295 //! Modified bits of \b UCBxI2CSA register.
296 //!
297 //! \return None
298 //
299 //*****************************************************************************
300 extern void EUSCI_B_I2C_setSlaveAddress(uint16_t baseAddress,
301  uint8_t slaveAddress);
302 
303 //*****************************************************************************
304 //
305 //! \brief Sets the mode of the I2C device
306 //!
307 //! When the mode parameter is set to EUSCI_B_I2C_TRANSMIT_MODE, the address
308 //! will indicate that the I2C module is in send mode; otherwise, the I2C
309 //! module is in receive mode.
310 //!
311 //! \param baseAddress is the base address of the USCI I2C module.
312 //! \param mode Mode for the EUSCI_B_I2C module
313 //! Valid values are:
314 //! - \b EUSCI_B_I2C_TRANSMIT_MODE [Default]
315 //! - \b EUSCI_B_I2C_RECEIVE_MODE
316 //!
317 //! Modified bits are \b UCTR of \b UCBxCTLW0 register.
318 //!
319 //! \return None
320 //
321 //*****************************************************************************
322 extern void EUSCI_B_I2C_setMode(uint16_t baseAddress,
323  uint16_t mode);
324 
325 //*****************************************************************************
326 //
327 //! \brief Gets the mode of the I2C device
328 //!
329 //! Current I2C transmit/receive mode.
330 //!
331 //! \param baseAddress is the base address of the I2C module.
332 //!
333 //! Modified bits are \b UCTR of \b UCBxCTLW0 register.
334 //!
335 //! \return One of the following:
336 //! - \b EUSCI_B_I2C_TRANSMIT_MODE
337 //! - \b EUSCI_B_I2C_RECEIVE_MODE
338 //! \n indicating the current mode
339 //
340 //*****************************************************************************
341 extern uint8_t EUSCI_B_I2C_getMode(uint16_t baseAddress);
342 
343 //*****************************************************************************
344 //
345 //! \brief Transmits a byte from the I2C Module.
346 //!
347 //! This function will place the supplied data into I2C transmit data register
348 //! to start transmission.
349 //!
350 //! \param baseAddress is the base address of the I2C Slave module.
351 //! \param transmitData data to be transmitted from the I2C module
352 //!
353 //! Modified bits of \b UCBxTXBUF register.
354 //!
355 //! \return None
356 //
357 //*****************************************************************************
358 extern void EUSCI_B_I2C_slavePutData(uint16_t baseAddress,
359  uint8_t transmitData);
360 
361 //*****************************************************************************
362 //
363 //! \brief Receives a byte that has been sent to the I2C Module.
364 //!
365 //! This function reads a byte of data from the I2C receive data Register.
366 //!
367 //! \param baseAddress is the base address of the I2C Slave module.
368 //!
369 //! \return Returns the byte received from by the I2C module, cast as an
370 //! uint8_t.
371 //
372 //*****************************************************************************
373 extern uint8_t EUSCI_B_I2C_slaveGetData(uint16_t baseAddress);
374 
375 //*****************************************************************************
376 //
377 //! \brief Indicates whether or not the I2C bus is busy.
378 //!
379 //! This function returns an indication of whether or not the I2C bus is busy.
380 //! This function checks the status of the bus via UCBBUSY bit in UCBxSTAT
381 //! register.
382 //!
383 //! \param baseAddress is the base address of the I2C module.
384 //!
385 //! \return One of the following:
386 //! - \b EUSCI_B_I2C_BUS_BUSY
387 //! - \b EUSCI_B_I2C_BUS_NOT_BUSY
388 //! \n indicating whether the bus is busy
389 //
390 //*****************************************************************************
391 extern uint16_t EUSCI_B_I2C_isBusBusy(uint16_t baseAddress);
392 
393 //*****************************************************************************
394 //
395 //! \brief Indicates whether STOP got sent.
396 //!
397 //! This function returns an indication of whether or not STOP got sent This
398 //! function checks the status of the bus via UCTXSTP bit in UCBxCTL1 register.
399 //!
400 //! \param baseAddress is the base address of the I2C Master module.
401 //!
402 //! \return One of the following:
403 //! - \b EUSCI_B_I2C_STOP_SEND_COMPLETE
404 //! - \b EUSCI_B_I2C_SENDING_STOP
405 //! \n indicating whether the stop was sent
406 //
407 //*****************************************************************************
408 extern uint16_t EUSCI_B_I2C_masterIsStopSent(uint16_t baseAddress);
409 
410 //*****************************************************************************
411 //
412 //! \brief Indicates whether Start got sent.
413 //!
414 //! This function returns an indication of whether or not Start got sent This
415 //! function checks the status of the bus via UCTXSTT bit in UCBxCTL1 register.
416 //!
417 //! \param baseAddress is the base address of the I2C Master module.
418 //!
419 //! \return One of the following:
420 //! - \b EUSCI_B_I2C_START_SEND_COMPLETE
421 //! - \b EUSCI_B_I2C_SENDING_START
422 //! \n indicating whether the start was sent
423 //
424 //*****************************************************************************
425 extern uint16_t EUSCI_B_I2C_masterIsStartSent(uint16_t baseAddress);
426 
427 //*****************************************************************************
428 //
429 //! \brief Enables individual I2C interrupt sources.
430 //!
431 //! Enables the indicated I2C interrupt sources. Only the sources that are
432 //! enabled can be reflected to the processor interrupt; disabled sources have
433 //! no effect on the processor.
434 //!
435 //! \param baseAddress is the base address of the I2C module.
436 //! \param mask is the bit mask of the interrupt sources to be enabled.
437 //! Mask value is the logical OR of any of the following:
438 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
439 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost
440 //! interrupt
441 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
442 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
443 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
444 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
445 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
446 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
447 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
448 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
449 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
450 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
451 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
452 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout
453 //! interrupt enable
454 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt
455 //! enable
456 //!
457 //! Modified bits of \b UCBxIE register.
458 //!
459 //! \return None
460 //
461 //*****************************************************************************
462 extern void EUSCI_B_I2C_enableInterrupt(uint16_t baseAddress,
463  uint16_t mask);
464 
465 //*****************************************************************************
466 //
467 //! \brief Disables individual I2C interrupt sources.
468 //!
469 //! Disables the indicated I2C interrupt sources. Only the sources that are
470 //! enabled can be reflected to the processor interrupt; disabled sources have
471 //! no effect on the processor.
472 //!
473 //! \param baseAddress is the base address of the I2C module.
474 //! \param mask is the bit mask of the interrupt sources to be disabled.
475 //! Mask value is the logical OR of any of the following:
476 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
477 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost
478 //! interrupt
479 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
480 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
481 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
482 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
483 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
484 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
485 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
486 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
487 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
488 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
489 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
490 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout
491 //! interrupt enable
492 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt
493 //! enable
494 //!
495 //! Modified bits of \b UCBxIE register.
496 //!
497 //! \return None
498 //
499 //*****************************************************************************
500 extern void EUSCI_B_I2C_disableInterrupt(uint16_t baseAddress,
501  uint16_t mask);
502 
503 //*****************************************************************************
504 //
505 //! \brief Clears I2C interrupt sources.
506 //!
507 //! The I2C interrupt source is cleared, so that it no longer asserts. The
508 //! highest interrupt flag is automatically cleared when an interrupt vector
509 //! generator is used.
510 //!
511 //! \param baseAddress is the base address of the I2C module.
512 //! \param mask is a bit mask of the interrupt sources to be cleared.
513 //! Mask value is the logical OR of any of the following:
514 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
515 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost
516 //! interrupt
517 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
518 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
519 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
520 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
521 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
522 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
523 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
524 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
525 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
526 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
527 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
528 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout
529 //! interrupt enable
530 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt
531 //! enable
532 //!
533 //! Modified bits of \b UCBxIFG register.
534 //!
535 //! \return None
536 //
537 //*****************************************************************************
538 extern void EUSCI_B_I2C_clearInterrupt(uint16_t baseAddress,
539  uint16_t mask);
540 
541 //*****************************************************************************
542 //
543 //! \brief Gets the current I2C interrupt status.
544 //!
545 //! This returns the interrupt status for the I2C module based on which flag is
546 //! passed.
547 //!
548 //! \param baseAddress is the base address of the I2C module.
549 //! \param mask is the masked interrupt flag status to be returned.
550 //! Mask value is the logical OR of any of the following:
551 //! - \b EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
552 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost
553 //! interrupt
554 //! - \b EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
555 //! - \b EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
556 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
557 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
558 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
559 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
560 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
561 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
562 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
563 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
564 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
565 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout
566 //! interrupt enable
567 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt
568 //! enable
569 //!
570 //! \return Logical OR of any of the following:
571 //! - \b EUSCI_B_I2C_NAK_INTERRUPT Not-acknowledge interrupt
572 //! - \b EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT Arbitration lost
573 //! interrupt
574 //! - \b EUSCI_B_I2C_STOP_INTERRUPT STOP condition interrupt
575 //! - \b EUSCI_B_I2C_START_INTERRUPT START condition interrupt
576 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT0 Transmit interrupt0
577 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT1 Transmit interrupt1
578 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT2 Transmit interrupt2
579 //! - \b EUSCI_B_I2C_TRANSMIT_INTERRUPT3 Transmit interrupt3
580 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT0 Receive interrupt0
581 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT1 Receive interrupt1
582 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT2 Receive interrupt2
583 //! - \b EUSCI_B_I2C_RECEIVE_INTERRUPT3 Receive interrupt3
584 //! - \b EUSCI_B_I2C_BIT9_POSITION_INTERRUPT Bit position 9 interrupt
585 //! - \b EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT Clock low timeout
586 //! interrupt enable
587 //! - \b EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT Byte counter interrupt
588 //! enable
589 //! \n indicating the status of the masked interrupts
590 //
591 //*****************************************************************************
592 extern uint16_t EUSCI_B_I2C_getInterruptStatus(uint16_t baseAddress,
593  uint16_t mask);
594 
595 //*****************************************************************************
596 //
597 //! \brief Does single byte transmission from Master to Slave
598 //!
599 //! This function is used by the Master module to send a single byte. This
600 //! function sends a start, then transmits the byte to the slave and then sends
601 //! a stop.
602 //!
603 //! \param baseAddress is the base address of the I2C Master module.
604 //! \param txData is the data byte to be transmitted
605 //!
606 //! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits
607 //! of \b UCBxIE register and bits of \b UCBxIFG register.
608 //!
609 //! \return None
610 //
611 //*****************************************************************************
612 extern void EUSCI_B_I2C_masterSendSingleByte(uint16_t baseAddress,
613  uint8_t txData);
614 
615 //*****************************************************************************
616 //
617 //! \brief Does single byte reception from Slave
618 //!
619 //! This function is used by the Master module to receive a single byte. This
620 //! function sends start and stop, waits for data reception and then receives
621 //! the data from the slave
622 //!
623 //! \param baseAddress is the base address of the I2C Master module.
624 //!
625 //! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits
626 //! of \b UCBxIE register and bits of \b UCBxIFG register.
627 //!
628 //! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
629 //
630 //*****************************************************************************
631 extern uint8_t EUSCI_B_I2C_masterReceiveSingleByte(uint16_t baseAddress);
632 
633 //*****************************************************************************
634 //
635 //! \brief Does single byte transmission from Master to Slave with timeout
636 //!
637 //! This function is used by the Master module to send a single byte. This
638 //! function sends a start, then transmits the byte to the slave and then sends
639 //! a stop.
640 //!
641 //! \param baseAddress is the base address of the I2C Master module.
642 //! \param txData is the data byte to be transmitted
643 //! \param timeout is the amount of time to wait until giving up
644 //!
645 //! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits
646 //! of \b UCBxIE register and bits of \b UCBxIFG register.
647 //!
648 //! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
649 //
650 //*****************************************************************************
651 extern bool EUSCI_B_I2C_masterSendSingleByteWithTimeout(uint16_t baseAddress,
652  uint8_t txData,
653  uint32_t timeout);
654 
655 //*****************************************************************************
656 //
657 //! \brief Starts multi-byte transmission from Master to Slave
658 //!
659 //! This function is used by the master module to start a multi byte
660 //! transaction.
661 //!
662 //! \param baseAddress is the base address of the I2C Master module.
663 //! \param txData is the first data byte to be transmitted
664 //!
665 //! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits
666 //! of \b UCBxIE register and bits of \b UCBxIFG register.
667 //!
668 //! \return None
669 //
670 //*****************************************************************************
671 extern void EUSCI_B_I2C_masterSendMultiByteStart(uint16_t baseAddress,
672  uint8_t txData);
673 
674 //*****************************************************************************
675 //
676 //! \brief Starts multi-byte transmission from Master to Slave with timeout
677 //!
678 //! This function is used by the master module to start a multi byte
679 //! transaction.
680 //!
681 //! \param baseAddress is the base address of the I2C Master module.
682 //! \param txData is the first data byte to be transmitted
683 //! \param timeout is the amount of time to wait until giving up
684 //!
685 //! Modified bits of \b UCBxTXBUF register, bits of \b UCBxCTLW0 register, bits
686 //! of \b UCBxIE register and bits of \b UCBxIFG register.
687 //!
688 //! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
689 //
690 //*****************************************************************************
691 extern bool EUSCI_B_I2C_masterSendMultiByteStartWithTimeout(uint16_t baseAddress,
692  uint8_t txData,
693  uint32_t timeout);
694 
695 //*****************************************************************************
696 //
697 //! \brief Continues multi-byte transmission from Master to Slave
698 //!
699 //! This function is used by the Master module continue each byte of a multi-
700 //! byte transmission. This function transmits each data byte of a multi-byte
701 //! transmission to the slave.
702 //!
703 //! \param baseAddress is the base address of the I2C Master module.
704 //! \param txData is the next data byte to be transmitted
705 //!
706 //! Modified bits of \b UCBxTXBUF register.
707 //!
708 //! \return None
709 //
710 //*****************************************************************************
711 extern void EUSCI_B_I2C_masterSendMultiByteNext(uint16_t baseAddress,
712  uint8_t txData);
713 
714 //*****************************************************************************
715 //
716 //! \brief Continues multi-byte transmission from Master to Slave with timeout
717 //!
718 //! This function is used by the Master module continue each byte of a multi-
719 //! byte transmission. This function transmits each data byte of a multi-byte
720 //! transmission to the slave.
721 //!
722 //! \param baseAddress is the base address of the I2C Master module.
723 //! \param txData is the next data byte to be transmitted
724 //! \param timeout is the amount of time to wait until giving up
725 //!
726 //! Modified bits of \b UCBxTXBUF register.
727 //!
728 //! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
729 //
730 //*****************************************************************************
731 extern bool EUSCI_B_I2C_masterSendMultiByteNextWithTimeout(uint16_t baseAddress,
732  uint8_t txData,
733  uint32_t timeout);
734 
735 //*****************************************************************************
736 //
737 //! \brief Finishes multi-byte transmission from Master to Slave
738 //!
739 //! This function is used by the Master module to send the last byte and STOP.
740 //! This function transmits the last data byte of a multi-byte transmission to
741 //! the slave and then sends a stop.
742 //!
743 //! \param baseAddress is the base address of the I2C Master module.
744 //! \param txData is the last data byte to be transmitted in a multi-byte
745 //! transmission
746 //!
747 //! Modified bits of \b UCBxTXBUF register and bits of \b UCBxCTLW0 register.
748 //!
749 //! \return None
750 //
751 //*****************************************************************************
752 extern void EUSCI_B_I2C_masterSendMultiByteFinish(uint16_t baseAddress,
753  uint8_t txData);
754 
755 //*****************************************************************************
756 //
757 //! \brief Finishes multi-byte transmission from Master to Slave with timeout
758 //!
759 //! This function is used by the Master module to send the last byte and STOP.
760 //! This function transmits the last data byte of a multi-byte transmission to
761 //! the slave and then sends a stop.
762 //!
763 //! \param baseAddress is the base address of the I2C Master module.
764 //! \param txData is the last data byte to be transmitted in a multi-byte
765 //! transmission
766 //! \param timeout is the amount of time to wait until giving up
767 //!
768 //! Modified bits of \b UCBxTXBUF register and bits of \b UCBxCTLW0 register.
769 //!
770 //! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
771 //
772 //*****************************************************************************
773 extern bool EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout(uint16_t baseAddress,
774  uint8_t txData,
775  uint32_t timeout);
776 
777 //*****************************************************************************
778 //
779 //! \brief This function is used by the Master module to initiate START
780 //!
781 //! This function is used by the Master module to initiate START
782 //!
783 //! \param baseAddress is the base address of the I2C Master module.
784 //!
785 //! Modified bits are \b UCTXSTT of \b UCBxCTLW0 register.
786 //!
787 //! \return None
788 //
789 //*****************************************************************************
790 extern void EUSCI_B_I2C_masterSendStart(uint16_t baseAddress);
791 
792 //*****************************************************************************
793 //
794 //! \brief Send STOP byte at the end of a multi-byte transmission from Master
795 //! to Slave
796 //!
797 //! This function is used by the Master module send STOP at the end of a multi-
798 //! byte transmission. This function sends a stop after current transmission is
799 //! complete.
800 //!
801 //! \param baseAddress is the base address of the I2C Master module.
802 //!
803 //! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register.
804 //!
805 //! \return None
806 //
807 //*****************************************************************************
808 extern void EUSCI_B_I2C_masterSendMultiByteStop(uint16_t baseAddress);
809 
810 //*****************************************************************************
811 //
812 //! \brief Send STOP byte at the end of a multi-byte transmission from Master
813 //! to Slave with timeout
814 //!
815 //! This function is used by the Master module send STOP at the end of a multi-
816 //! byte transmission. This function sends a stop after current transmission is
817 //! complete.
818 //!
819 //! \param baseAddress is the base address of the I2C Master module.
820 //! \param timeout is the amount of time to wait until giving up
821 //!
822 //! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register.
823 //!
824 //! \return STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
825 //
826 //*****************************************************************************
827 extern bool EUSCI_B_I2C_masterSendMultiByteStopWithTimeout(uint16_t baseAddress,
828  uint32_t timeout);
829 
830 //*****************************************************************************
831 //
832 //! \brief Starts reception at the Master end
833 //!
834 //! This function is used by the Master module initiate reception of a single
835 //! byte. This function sends a start.
836 //!
837 //! \param baseAddress is the base address of the I2C Master module.
838 //!
839 //! Modified bits are \b UCTXSTT of \b UCBxCTLW0 register.
840 //!
841 //! \return None
842 //
843 //*****************************************************************************
844 extern void EUSCI_B_I2C_masterReceiveStart(uint16_t baseAddress);
845 
846 //*****************************************************************************
847 //
848 //! \brief Starts multi-byte reception at the Master end one byte at a time
849 //!
850 //! This function is used by the Master module to receive each byte of a multi-
851 //! byte reception. This function reads currently received byte.
852 //!
853 //! \param baseAddress is the base address of the I2C Master module.
854 //!
855 //! \return Received byte at Master end.
856 //
857 //*****************************************************************************
858 extern uint8_t EUSCI_B_I2C_masterReceiveMultiByteNext(uint16_t baseAddress);
859 
860 //*****************************************************************************
861 //
862 //! \brief Finishes multi-byte reception at the Master end
863 //!
864 //! This function is used by the Master module to initiate completion of a
865 //! multi-byte reception. This function receives the current byte and initiates
866 //! the STOP from master to slave.
867 //!
868 //! \param baseAddress is the base address of the I2C Master module.
869 //!
870 //! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register.
871 //!
872 //! \return Received byte at Master end.
873 //
874 //*****************************************************************************
875 extern uint8_t EUSCI_B_I2C_masterReceiveMultiByteFinish(uint16_t baseAddress);
876 
877 //*****************************************************************************
878 //
879 //! \brief Finishes multi-byte reception at the Master end with timeout
880 //!
881 //! This function is used by the Master module to initiate completion of a
882 //! multi-byte reception. This function receives the current byte and initiates
883 //! the STOP from master to slave.
884 //!
885 //! \param baseAddress is the base address of the I2C Master module.
886 //! \param txData is a pointer to the location to store the received byte at
887 //! master end
888 //! \param timeout is the amount of time to wait until giving up
889 //!
890 //! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register.
891 //!
892 //! \return STATUS_SUCCESS or STATUS_FAILURE of the reception process
893 //
894 //*****************************************************************************
895 extern bool EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout(uint16_t baseAddress,
896  uint8_t *txData,
897  uint32_t timeout);
898 
899 //*****************************************************************************
900 //
901 //! \brief Sends the STOP at the end of a multi-byte reception at the Master
902 //! end
903 //!
904 //! This function is used by the Master module to initiate STOP
905 //!
906 //! \param baseAddress is the base address of the I2C Master module.
907 //!
908 //! Modified bits are \b UCTXSTP of \b UCBxCTLW0 register.
909 //!
910 //! \return None
911 //
912 //*****************************************************************************
913 extern void EUSCI_B_I2C_masterReceiveMultiByteStop(uint16_t baseAddress);
914 
915 //*****************************************************************************
916 //
917 //! \brief Enables Multi Master Mode
918 //!
919 //! At the end of this function, the I2C module is still disabled till
920 //! EUSCI_B_I2C_enable is invoked
921 //!
922 //! \param baseAddress is the base address of the I2C module.
923 //!
924 //! Modified bits are \b UCSWRST and \b UCMM of \b UCBxCTLW0 register.
925 //!
926 //! \return None
927 //
928 //*****************************************************************************
929 extern void EUSCI_B_I2C_enableMultiMasterMode(uint16_t baseAddress);
930 
931 //*****************************************************************************
932 //
933 //! \brief Disables Multi Master Mode
934 //!
935 //! At the end of this function, the I2C module is still disabled till
936 //! EUSCI_B_I2C_enable is invoked
937 //!
938 //! \param baseAddress is the base address of the I2C module.
939 //!
940 //! Modified bits are \b UCSWRST and \b UCMM of \b UCBxCTLW0 register.
941 //!
942 //! \return None
943 //
944 //*****************************************************************************
945 extern void EUSCI_B_I2C_disableMultiMasterMode(uint16_t baseAddress);
946 
947 //*****************************************************************************
948 //
949 //! \brief receives a byte that has been sent to the I2C Master Module.
950 //!
951 //! This function reads a byte of data from the I2C receive data Register.
952 //!
953 //! \param baseAddress is the base address of the I2C Master module.
954 //!
955 //! \return Returns the byte received from by the I2C module, cast as an
956 //! uint8_t.
957 //
958 //*****************************************************************************
959 extern uint8_t EUSCI_B_I2C_masterReceiveSingle(uint16_t baseAddress);
960 
961 //*****************************************************************************
962 //
963 //! \brief Returns the address of the RX Buffer of the I2C for the DMA module.
964 //!
965 //! Returns the address of the I2C RX Buffer. This can be used in conjunction
966 //! with the DMA to store the received data directly to memory.
967 //!
968 //! \param baseAddress is the base address of the I2C module.
969 //!
970 //! \return The address of the I2C RX Buffer
971 //
972 //*****************************************************************************
973 extern uint32_t EUSCI_B_I2C_getReceiveBufferAddress(uint16_t baseAddress);
974 
975 //*****************************************************************************
976 //
977 //! \brief Returns the address of the TX Buffer of the I2C for the DMA module.
978 //!
979 //! Returns the address of the I2C TX Buffer. This can be used in conjunction
980 //! with the DMA to obtain transmitted data directly from memory.
981 //!
982 //! \param baseAddress is the base address of the I2C module.
983 //!
984 //! \return The address of the I2C TX Buffer
985 //
986 //*****************************************************************************
987 extern uint32_t EUSCI_B_I2C_getTransmitBufferAddress(uint16_t baseAddress);
988 
989 //*****************************************************************************
990 //
991 //! \brief Remaps eUSCI_B GPIO pins.
992 //!
993 //! Remaps eUSCI_B GPIO pins. After calling this function,
994 //! GPIO_setAsPeripheralModuleFunctionInputPin() or
995 //! GPIO_setAsPeripheralModuleFunctionInputPin() still needs to be invoked to
996 //! set peripheral functions. Caution: this will also remap eusci_b_spi GPIO
997 //! pins.
998 //!
999 //! \param baseAddress is the base address of the I2C module.
1000 //! \param pinsSelect remapping pins to select. Please refer to device specific
1001 //! datasheet for remapping pins details.
1002 //! Valid values are:
1003 //! - \b EUSCI_B_I2C_REMAP_PINS_FALSE [Default]
1004 //! - \b EUSCI_B_I2C_REMAP_PINS_TRUE
1005 //!
1006 //! \return None
1007 //
1008 //*****************************************************************************
1009 extern void EUSCI_B_I2C_remapPins(uint16_t baseAddress,
1010  uint8_t pinsSelect);
1011 
1012 //*****************************************************************************
1013 //
1014 //! \brief Enforces a timeout if the I2C clock is held low longer than a
1015 //! defined time.
1016 //!
1017 //! By using this function, the UCCLTOIFG interrupt will trigger if the clock
1018 //! is held low longer than this defined time. It is possible to detect the
1019 //! situation, when a clock is stretched by a master or slave for too long. The
1020 //! user can then handle this issue by, for example, resetting the eUSCI_B
1021 //! module. It is possible to select one of three predefined times for the
1022 //! clock low timeout.
1023 //!
1024 //! \param baseAddress is the base address of the I2C module.
1025 //! \param timeout how long the clock can be low before a timeout triggers.
1026 //! Enables generation of the UCCLTOIFG interrupt.
1027 //! Valid values are:
1028 //! - \b EUSCI_B_I2C_TIMEOUT_DISABLE [Default]
1029 //! - \b EUSCI_B_I2C_TIMEOUT_28_MS
1030 //! - \b EUSCI_B_I2C_TIMEOUT_31_MS
1031 //! - \b EUSCI_B_I2C_TIMEOUT_34_MS
1032 //!
1033 //! Modified bits are \b UCCLTO of \b UCBxCTLW1 register; bits \b UCSWRST of \b
1034 //! UCBxCTLW0 register.
1035 //!
1036 //! \return None
1037 //
1038 //*****************************************************************************
1039 extern void EUSCI_B_I2C_setTimeout(uint16_t baseAddress,
1040  uint16_t timeout);
1041 
1042 //*****************************************************************************
1043 //
1044 // The following are deprecated #defines.
1045 //
1046 //*****************************************************************************
1047 #define EUSCI_B_I2C_REMAP_PINS_1 EUSCI_B_I2C_REMAP_PINS_FALSE
1048 #define EUSCI_B_I2C_REMAP_PINS_2 EUSCI_B_I2C_REMAP_PINS_TRUE
1049 
1050 //*****************************************************************************
1051 //
1052 // Mark the end of the C bindings section for C++ compilers.
1053 //
1054 //*****************************************************************************
1055 #ifdef __cplusplus
1056 }
1057 #endif
1058 
1059 #endif
1060 #endif // __MSP430WARE_EUSCI_B_I2C_H__
uint32_t EUSCI_B_I2C_getReceiveBufferAddress(uint16_t baseAddress)
Returns the address of the RX Buffer of the I2C for the DMA module.
Definition: eusci_b_i2c.c:547
void EUSCI_B_I2C_masterSendMultiByteFinish(uint16_t baseAddress, uint8_t txData)
Finishes multi-byte transmission from Master to Slave.
Definition: eusci_b_i2c.c:363
void EUSCI_B_I2C_masterSendMultiByteNext(uint16_t baseAddress, uint8_t txData)
Continues multi-byte transmission from Master to Slave.
Definition: eusci_b_i2c.c:327
void EUSCI_B_I2C_enableMultiMasterMode(uint16_t baseAddress)
Enables Multi Master Mode.
Definition: eusci_b_i2c.c:523
bool EUSCI_B_I2C_masterSendMultiByteNextWithTimeout(uint16_t baseAddress, uint8_t txData, uint32_t timeout)
Continues multi-byte transmission from Master to Slave with timeout.
Definition: eusci_b_i2c.c:341
uint32_t EUSCI_B_I2C_getTransmitBufferAddress(uint16_t baseAddress)
Returns the address of the TX Buffer of the I2C for the DMA module.
Definition: eusci_b_i2c.c:552
uint8_t EUSCI_B_I2C_masterReceiveSingle(uint16_t baseAddress)
receives a byte that has been sent to the I2C Master Module.
Definition: eusci_b_i2c.c:536
bool EUSCI_B_I2C_masterSendMultiByteStartWithTimeout(uint16_t baseAddress, uint8_t txData, uint32_t timeout)
Starts multi-byte transmission from Master to Slave with timeout.
Definition: eusci_b_i2c.c:296
void EUSCI_B_I2C_masterSendMultiByteStop(uint16_t baseAddress)
Send STOP byte at the end of a multi-byte transmission from Master to Slave.
Definition: eusci_b_i2c.c:423
uint16_t EUSCI_B_I2C_getInterruptStatus(uint16_t baseAddress, uint16_t mask)
Gets the current I2C interrupt status.
Definition: eusci_b_i2c.c:164
void EUSCI_B_I2C_slavePutData(uint16_t baseAddress, uint8_t transmitData)
Transmits a byte from the I2C Module.
Definition: eusci_b_i2c.c:110
uint32_t slaveOwnAddressEnable
Definition: eusci_b_i2c.h:78
uint8_t byteCounterThreshold
Sets threshold for automatic STOP or UCSTPIFG.
Definition: eusci_b_i2c.h:50
void EUSCI_B_I2C_disable(uint16_t baseAddress)
Disables the I2C block.
Definition: eusci_b_i2c.c:81
uint32_t dataRate
Definition: eusci_b_i2c.h:48
uint16_t EUSCI_B_I2C_masterIsStopSent(uint16_t baseAddress)
Indicates whether STOP got sent.
Definition: eusci_b_i2c.c:130
void EUSCI_B_I2C_setTimeout(uint16_t baseAddress, uint16_t timeout)
Enforces a timeout if the I2C clock is held low longer than a defined time.
Definition: eusci_b_i2c.c:567
bool EUSCI_B_I2C_masterSendSingleByteWithTimeout(uint16_t baseAddress, uint8_t txData, uint32_t timeout)
Does single byte transmission from Master to Slave with timeout.
Definition: eusci_b_i2c.c:225
uint8_t EUSCI_B_I2C_slaveGetData(uint16_t baseAddress)
Receives a byte that has been sent to the I2C Module.
Definition: eusci_b_i2c.c:118
uint8_t EUSCI_B_I2C_getMode(uint16_t baseAddress)
Gets the mode of the I2C device.
Definition: eusci_b_i2c.c:103
uint8_t slaveAddressOffset
Definition: eusci_b_i2c.h:73
uint8_t selectClockSource
Definition: eusci_b_i2c.h:40
void EUSCI_B_I2C_masterSendStart(uint16_t baseAddress)
This function is used by the Master module to initiate START.
Definition: eusci_b_i2c.c:418
void EUSCI_B_I2C_clearInterrupt(uint16_t baseAddress, uint16_t mask)
Clears I2C interrupt sources.
Definition: eusci_b_i2c.c:156
bool EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout(uint16_t baseAddress, uint8_t *txData, uint32_t timeout)
Finishes multi-byte reception at the Master end with timeout.
Definition: eusci_b_i2c.c:484
void EUSCI_B_I2C_setSlaveAddress(uint16_t baseAddress, uint8_t slaveAddress)
Sets the address that the I2C Master will place on the bus.
Definition: eusci_b_i2c.c:87
void EUSCI_B_I2C_masterSendMultiByteStart(uint16_t baseAddress, uint8_t txData)
Starts multi-byte transmission from Master to Slave.
Definition: eusci_b_i2c.c:273
bool EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout(uint16_t baseAddress, uint8_t txData, uint32_t timeout)
Finishes multi-byte transmission from Master to Slave with timeout.
Definition: eusci_b_i2c.c:383
void EUSCI_B_I2C_masterSendSingleByte(uint16_t baseAddress, uint8_t txData)
Does single byte transmission from Master to Slave.
Definition: eusci_b_i2c.c:172
void EUSCI_B_I2C_initSlave(uint16_t baseAddress, EUSCI_B_I2C_initSlaveParam *param)
Initializes the I2C Slave block.
Definition: eusci_b_i2c.c:57
uint8_t autoSTOPGeneration
Definition: eusci_b_i2c.h:56
void EUSCI_B_I2C_disableInterrupt(uint16_t baseAddress, uint16_t mask)
Disables individual I2C interrupt sources.
Definition: eusci_b_i2c.c:148
uint16_t EUSCI_B_I2C_masterIsStartSent(uint16_t baseAddress)
Indicates whether Start got sent.
Definition: eusci_b_i2c.c:135
uint8_t EUSCI_B_I2C_masterReceiveMultiByteNext(uint16_t baseAddress)
Starts multi-byte reception at the Master end one byte at a time.
Definition: eusci_b_i2c.c:463
uint32_t i2cClk
Definition: eusci_b_i2c.h:43
void EUSCI_B_I2C_masterReceiveMultiByteStop(uint16_t baseAddress)
Sends the STOP at the end of a multi-byte reception at the Master end.
Definition: eusci_b_i2c.c:517
void EUSCI_B_I2C_enable(uint16_t baseAddress)
Enables the I2C block.
Definition: eusci_b_i2c.c:75
void EUSCI_B_I2C_disableMultiMasterMode(uint16_t baseAddress)
Disables Multi Master Mode.
Definition: eusci_b_i2c.c:529
bool EUSCI_B_I2C_masterSendMultiByteStopWithTimeout(uint16_t baseAddress, uint32_t timeout)
Send STOP byte at the end of a multi-byte transmission from Master to Slave with timeout.
Definition: eusci_b_i2c.c:435
Used in the EUSCI_B_I2C_initSlave() function as the param parameter.
Definition: eusci_b_i2c.h:64
void EUSCI_B_I2C_initMaster(uint16_t baseAddress, EUSCI_B_I2C_initMasterParam *param)
Initializes the I2C Master block.
Definition: eusci_b_i2c.c:21
uint8_t EUSCI_B_I2C_masterReceiveMultiByteFinish(uint16_t baseAddress)
Finishes multi-byte reception at the Master end.
Definition: eusci_b_i2c.c:468
void EUSCI_B_I2C_masterReceiveStart(uint16_t baseAddress)
Starts reception at the Master end.
Definition: eusci_b_i2c.c:455
uint8_t slaveAddress
7-bit slave address
Definition: eusci_b_i2c.h:66
uint16_t EUSCI_B_I2C_isBusBusy(uint16_t baseAddress)
Indicates whether or not the I2C bus is busy.
Definition: eusci_b_i2c.c:124
Used in the EUSCI_B_I2C_initMaster() function as the param parameter.
Definition: eusci_b_i2c.h:32
void EUSCI_B_I2C_remapPins(uint16_t baseAddress, uint8_t pinsSelect)
Remaps eUSCI_B GPIO pins.
Definition: eusci_b_i2c.c:556
uint8_t EUSCI_B_I2C_masterReceiveSingleByte(uint16_t baseAddress)
Does single byte reception from Slave.
Definition: eusci_b_i2c.c:204
void EUSCI_B_I2C_setMode(uint16_t baseAddress, uint16_t mode)
Sets the mode of the I2C device.
Definition: eusci_b_i2c.c:95
void EUSCI_B_I2C_enableInterrupt(uint16_t baseAddress, uint16_t mask)
Enables individual I2C interrupt sources.
Definition: eusci_b_i2c.c:140

Copyright 2020, Texas Instruments Incorporated