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