CC13xx Driver Library
i2c.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: i2c.h
3 * Revised: 2015-09-21 15:19:36 +0200 (Mon, 21 Sep 2015)
4 * Revision: 44629
5 *
6 * Description: Defines and prototypes for the I2C.
7 *
8 * Copyright (c) 2015, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 //*****************************************************************************
40 //
45 //
46 //*****************************************************************************
47 
48 #ifndef __I2C_H__
49 #define __I2C_H__
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include <inc/hw_types.h>
65 #include <inc/hw_ints.h>
66 #include <inc/hw_memmap.h>
67 #include <inc/hw_i2c.h>
68 #include <inc/hw_sysctl.h>
69 #include <driverlib/debug.h>
70 #include <driverlib/interrupt.h>
71 #include <driverlib/cpu.h>
72 
73 //*****************************************************************************
74 //
75 // Support for DriverLib in ROM:
76 // This section renames all functions that are not "static inline", so that
77 // calling these functions will default to implementation in flash. At the end
78 // of this file a second renaming will change the defaults to implementation in
79 // ROM for available functions.
80 //
81 // To force use of the implementation in flash, e.g. for debugging:
82 // - Globally: Define DRIVERLIB_NOROM at project level
83 // - Per function: Use prefix "NOROM_" when calling the function
84 //
85 //*****************************************************************************
86 #if !defined(DOXYGEN)
87  #define I2CMasterInitExpClk NOROM_I2CMasterInitExpClk
88  #define I2CMasterErr NOROM_I2CMasterErr
89  #define I2CIntRegister NOROM_I2CIntRegister
90  #define I2CIntUnregister NOROM_I2CIntUnregister
91 #endif
92 
93 //*****************************************************************************
94 //
95 // I2C Master commands
96 //
97 //*****************************************************************************
98 #define I2C_MASTER_CMD_SINGLE_SEND \
99  0x00000007
100 #define I2C_MASTER_CMD_SINGLE_RECEIVE \
101  0x00000007
102 #define I2C_MASTER_CMD_BURST_SEND_START \
103  0x00000003
104 #define I2C_MASTER_CMD_BURST_SEND_CONT \
105  0x00000001
106 #define I2C_MASTER_CMD_BURST_SEND_FINISH \
107  0x00000005
108 #define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP \
109  0x00000004
110 #define I2C_MASTER_CMD_BURST_RECEIVE_START \
111  0x0000000b
112 #define I2C_MASTER_CMD_BURST_RECEIVE_CONT \
113  0x00000009
114 #define I2C_MASTER_CMD_BURST_RECEIVE_FINISH \
115  0x00000005
116 #define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP \
117  0x00000004
118 
119 //*****************************************************************************
120 //
121 // I2C Master error status
122 //
123 //*****************************************************************************
124 #define I2C_MASTER_ERR_NONE 0
125 #define I2C_MASTER_ERR_ADDR_ACK 0x00000004
126 #define I2C_MASTER_ERR_DATA_ACK 0x00000008
127 #define I2C_MASTER_ERR_ARB_LOST 0x00000010
128 
129 //*****************************************************************************
130 //
131 // I2C Slave action requests
132 //
133 //*****************************************************************************
134 #define I2C_SLAVE_ACT_NONE 0
135 #define I2C_SLAVE_ACT_RREQ 0x00000001 // Master has sent data
136 #define I2C_SLAVE_ACT_TREQ 0x00000002 // Master has requested data
137 #define I2C_SLAVE_ACT_RREQ_FBR 0x00000005 // Master has sent first byte
138 
139 //*****************************************************************************
140 //
141 // I2C Slave interrupts
142 //
143 //*****************************************************************************
144 #define I2C_SLAVE_INT_STOP 0x00000004 // Stop Condition Interrupt.
145 #define I2C_SLAVE_INT_START 0x00000002 // Start Condition Interrupt.
146 #define I2C_SLAVE_INT_DATA 0x00000001 // Data Interrupt.
147 
148 //*****************************************************************************
149 //
150 // API Functions and prototypes
151 //
152 //*****************************************************************************
153 
154 #ifdef DRIVERLIB_DEBUG
155 //*****************************************************************************
156 //
167 //
168 //*****************************************************************************
169 static bool
170 I2CBaseValid(uint32_t ui32Base)
171 {
172  return(ui32Base == I2C0_BASE);
173 }
174 #endif
175 
176 //*****************************************************************************
177 //
194 //
195 //*****************************************************************************
196 extern void I2CMasterInitExpClk(uint32_t ui32Base, uint32_t ui32I2CClk,
197  bool bFast);
198 
199 //*****************************************************************************
200 //
221 //
222 //*****************************************************************************
223 __STATIC_INLINE void
224 I2CMasterControl(uint32_t ui32Base, uint32_t ui32Cmd)
225 {
226  //
227  // Check the arguments.
228  //
229  ASSERT(I2CBaseValid(ui32Base));
230  ASSERT((ui32Cmd == I2C_MASTER_CMD_SINGLE_SEND) ||
231  // (ui32Cmd == I2C_MASTER_CMD_SINGLE_RECEIVE) || -> Equal to SINGLE_SEND
232  (ui32Cmd == I2C_MASTER_CMD_BURST_SEND_START) ||
233  (ui32Cmd == I2C_MASTER_CMD_BURST_SEND_CONT) ||
234  (ui32Cmd == I2C_MASTER_CMD_BURST_SEND_FINISH) ||
236  (ui32Cmd == I2C_MASTER_CMD_BURST_RECEIVE_START) ||
237  (ui32Cmd == I2C_MASTER_CMD_BURST_RECEIVE_CONT) ||
240 
241  //
242  // Send the command.
243  //
244  HWREG(I2C0_BASE + I2C_O_MCTRL) = ui32Cmd;
245 
246  //
247  // Delay minimum four cycles in order to ensure that the I2C_O_MSTAT
248  // register has been correctly updated before function exit
249  //
250  CPUdelay(2);
251 }
252 
253 //*****************************************************************************
254 //
270 //
271 //*****************************************************************************
272 __STATIC_INLINE void
273 I2CMasterSlaveAddrSet(uint32_t ui32Base, uint8_t ui8SlaveAddr,
274  bool bReceive)
275 {
276  //
277  // Check the arguments.
278  //
279  ASSERT(I2CBaseValid(ui32Base));
280  ASSERT(!(ui8SlaveAddr & 0x80));
281 
282  //
283  // Set the address of the slave with which the master will communicate.
284  //
285  HWREG(I2C0_BASE + I2C_O_MSA) = (ui8SlaveAddr << 1) | bReceive;
286 }
287 
288 //*****************************************************************************
289 //
297 //
298 //*****************************************************************************
299 __STATIC_INLINE void
300 I2CMasterEnable(uint32_t ui32Base)
301 {
302  // Check the arguments.
303  ASSERT(I2CBaseValid(ui32Base));
304 
305  // Enable the clock for the master.
306  HWREGBITW(I2C0_BASE + I2C_O_MCR, I2C_MCR_MFE_BITN) = 1;
307 
308  // Enable the master block.
310 }
311 
312 //*****************************************************************************
313 //
321 //
322 //*****************************************************************************
323 __STATIC_INLINE void
324 I2CMasterDisable(uint32_t ui32Base)
325 {
326  // Check the arguments.
327  ASSERT(I2CBaseValid(ui32Base));
328 
329  // Disable the master block.
330  HWREG(I2C0_BASE + I2C_O_MCTRL) = 0;
331 
332  // Disable the clock for the master.
333  HWREGBITW(I2C0_BASE + I2C_O_MCR, I2C_MCR_MFE_BITN) = 0;
334 }
335 
336 //*****************************************************************************
337 //
348 //
349 //*****************************************************************************
350 __STATIC_INLINE bool
351 I2CMasterBusy(uint32_t ui32Base)
352 {
353  //
354  // Check the arguments.
355  //
356  ASSERT(I2CBaseValid(ui32Base));
357 
358  //
359  // Return the busy status.
360  //
361  if(HWREG(I2C0_BASE + I2C_O_MSTAT) & I2C_MSTAT_BUSY)
362  {
363  return(true);
364  }
365  else
366  {
367  return(false);
368  }
369 }
370 
371 //*****************************************************************************
372 //
384 //
385 //*****************************************************************************
386 __STATIC_INLINE bool
387 I2CMasterBusBusy(uint32_t ui32Base)
388 {
389  //
390  // Check the arguments.
391  //
392  ASSERT(I2CBaseValid(ui32Base));
393 
394  //
395  // Return the bus busy status.
396  //
397  if(HWREG(I2C0_BASE + I2C_O_MSTAT) & I2C_MSTAT_BUSBSY)
398  {
399  return(true);
400  }
401  else
402  {
403  return(false);
404  }
405 }
406 
407 //*****************************************************************************
408 //
417 //
418 //*****************************************************************************
419 __STATIC_INLINE uint32_t
420 I2CMasterDataGet(uint32_t ui32Base)
421 {
422  //
423  // Check the arguments.
424  //
425  ASSERT(I2CBaseValid(ui32Base));
426 
427  //
428  // Read a byte.
429  //
430  return(HWREG(I2C0_BASE + I2C_O_MDR));
431 }
432 
433 //*****************************************************************************
434 //
443 //
444 //*****************************************************************************
445 __STATIC_INLINE void
446 I2CMasterDataPut(uint32_t ui32Base, uint8_t ui8Data)
447 {
448  //
449  // Check the arguments.
450  //
451  ASSERT(I2CBaseValid(ui32Base));
452 
453  //
454  // Write the byte.
455  //
456  HWREG(I2C0_BASE + I2C_O_MDR) = ui8Data;
457 }
458 
459 //*****************************************************************************
460 //
473 //
474 //*****************************************************************************
475 extern uint32_t I2CMasterErr(uint32_t ui32Base);
476 
477 //*****************************************************************************
478 //
486 //
487 //*****************************************************************************
488 __STATIC_INLINE void
489 I2CMasterIntEnable(uint32_t ui32Base)
490 {
491  //
492  // Check the arguments.
493  //
494  ASSERT(I2CBaseValid(ui32Base));
495 
496  //
497  // Enable the master interrupt.
498  //
499  HWREG(I2C0_BASE + I2C_O_MIMR) = I2C_MIMR_IM;
500 }
501 
502 //*****************************************************************************
503 //
511 //
512 //*****************************************************************************
513 __STATIC_INLINE void
514 I2CMasterIntDisable(uint32_t ui32Base)
515 {
516  //
517  // Check the arguments.
518  //
519  ASSERT(I2CBaseValid(ui32Base));
520 
521  //
522  // Disable the master interrupt.
523  //
524  HWREG(I2C0_BASE + I2C_O_MIMR) = 0;
525 }
526 
527 //*****************************************************************************
528 //
553 //
554 //*****************************************************************************
555 __STATIC_INLINE void
556 I2CMasterIntClear(uint32_t ui32Base)
557 {
558  //
559  // Check the arguments.
560  //
561  ASSERT(I2CBaseValid(ui32Base));
562 
563  //
564  // Clear the I2C master interrupt source.
565  //
566  HWREG(I2C0_BASE + I2C_O_MICR) = I2C_MICR_IC;
567 }
568 
569 //*****************************************************************************
570 //
585 //
586 //*****************************************************************************
587 __STATIC_INLINE bool
588 I2CMasterIntStatus(uint32_t ui32Base, bool bMasked)
589 {
590  //
591  // Check the arguments.
592  //
593  ASSERT(I2CBaseValid(ui32Base));
594 
595  //
596  // Return either the interrupt status or the raw interrupt status as
597  // requested.
598  //
599  if(bMasked)
600  {
601  return((HWREG(I2C0_BASE + I2C_O_MMIS)) ? true : false);
602  }
603  else
604  {
605  return((HWREG(I2C0_BASE + I2C_O_MRIS)) ? true : false);
606  }
607 }
608 
609 //*****************************************************************************
610 //
618 //
619 //*****************************************************************************
620 __STATIC_INLINE void
621 I2CSlaveEnable(uint32_t ui32Base)
622 {
623  // Check the arguments.
624  ASSERT(I2CBaseValid(ui32Base));
625 
626  // Enable the clock to the slave block.
627  HWREGBITW(I2C0_BASE + I2C_O_MCR, I2C_MCR_SFE_BITN) = 1;
628 
629  // Enable the slave.
630  HWREG(I2C0_BASE + I2C_O_SCTL) = I2C_SCTL_DA;
631 }
632 
633 //*****************************************************************************
634 //
648 //
649 //*****************************************************************************
650 __STATIC_INLINE void
651 I2CSlaveInit(uint32_t ui32Base, uint8_t ui8SlaveAddr)
652 {
653  //
654  // Check the arguments.
655  //
656  ASSERT(I2CBaseValid(ui32Base));
657  ASSERT(!(ui8SlaveAddr & 0x80));
658 
659  //
660  // Must enable the device before doing anything else.
661  //
663 
664  //
665  // Set up the slave address.
666  //
667  HWREG(I2C0_BASE + I2C_O_SOAR) = ui8SlaveAddr;
668 }
669 
670 //*****************************************************************************
671 //
680 //
681 //*****************************************************************************
682 __STATIC_INLINE void
683 I2CSlaveAddressSet(uint32_t ui32Base, uint8_t ui8SlaveAddr)
684 {
685  //
686  // Check the arguments.
687  //
688  ASSERT(I2CBaseValid(ui32Base));
689  ASSERT(!(ui8SlaveAddr & 0x80));
690 
691  //
692  // Set up the primary slave address.
693  //
694  HWREG(I2C0_BASE + I2C_O_SOAR) = ui8SlaveAddr;
695 }
696 
697 //*****************************************************************************
698 //
706 //
707 //*****************************************************************************
708 __STATIC_INLINE void
709 I2CSlaveDisable(uint32_t ui32Base)
710 {
711  // Check the arguments.
712  ASSERT(I2CBaseValid(ui32Base));
713 
714  // Disable the slave.
715  HWREG(I2C0_BASE + I2C_O_SCTL) = 0x0;
716 
717  // Disable the clock to the slave block.
718  HWREGBITW(I2C0_BASE + I2C_O_MCR, I2C_MCR_SFE_BITN) = 0;
719 }
720 
721 //*****************************************************************************
722 //
735 //
736 //*****************************************************************************
737 __STATIC_INLINE uint32_t
738 I2CSlaveStatus(uint32_t ui32Base)
739 {
740  //
741  // Check the arguments.
742  //
743  ASSERT(I2CBaseValid(ui32Base));
744 
745  //
746  // Return the slave status.
747  //
748  return(HWREG(I2C0_BASE + I2C_O_SSTAT));
749 }
750 
751 //*****************************************************************************
752 //
761 //
762 //*****************************************************************************
763 __STATIC_INLINE uint32_t
764 I2CSlaveDataGet(uint32_t ui32Base)
765 {
766  //
767  // Check the arguments.
768  //
769  ASSERT(I2CBaseValid(ui32Base));
770 
771  //
772  // Read a byte.
773  //
774  return(HWREG(I2C0_BASE + I2C_O_SDR));
775 }
776 
777 //*****************************************************************************
778 //
787 //
788 //*****************************************************************************
789 __STATIC_INLINE void
790 I2CSlaveDataPut(uint32_t ui32Base, uint8_t ui8Data)
791 {
792  //
793  // Check the arguments.
794  //
795  ASSERT(I2CBaseValid(ui32Base));
796 
797  //
798  // Write the byte.
799  //
800  HWREG(I2C0_BASE + I2C_O_SDR) = ui8Data;
801 }
802 
803 //*****************************************************************************
804 //
819 //
820 //*****************************************************************************
821 __STATIC_INLINE void
822 I2CSlaveIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
823 {
824  uint32_t ui32Val;
825 
826  //
827  // Check the arguments.
828  //
829  ASSERT(I2CBaseValid(ui32Base));
830  ASSERT(ui32IntFlags & (I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_START |
832 
833  //
834  // Enable the slave interrupt.
835  //
836  ui32Val = HWREG(I2C0_BASE + I2C_O_SIMR);
837  ui32Val |= ui32IntFlags;
838  HWREG(I2C0_BASE + I2C_O_SIMR) = ui32Val;
839 }
840 
841 //*****************************************************************************
842 //
857 //
858 //*****************************************************************************
859 __STATIC_INLINE void
860 I2CSlaveIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
861 {
862  uint32_t ui32Val;
863 
864  //
865  // Check the arguments.
866  //
867  ASSERT(I2CBaseValid(ui32Base));
868  ASSERT(ui32IntFlags & (I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_START |
870 
871  //
872  // Disable the slave interrupt.
873  //
874  ui32Val = HWREG(I2C0_BASE + I2C_O_SIMR);
875  ui32Val &= ~ui32IntFlags;
876  HWREG(I2C0_BASE + I2C_O_SIMR) = ui32Val;
877 }
878 
879 //*****************************************************************************
880 //
910 //
911 //*****************************************************************************
912 __STATIC_INLINE void
913 I2CSlaveIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
914 {
915  //
916  // Check the arguments.
917  //
918  ASSERT(I2CBaseValid(ui32Base));
919 
920  //
921  // Clear the I2C slave interrupt source.
922  //
923  HWREG(I2C0_BASE + I2C_O_SICR) = ui32IntFlags;
924 }
925 
926 //*****************************************************************************
927 //
943 
944 //
945 //*****************************************************************************
946 __STATIC_INLINE uint32_t
947 I2CSlaveIntStatus(uint32_t ui32Base, bool bMasked)
948 {
949  //
950  // Check the arguments.
951  //
952  ASSERT(I2CBaseValid(ui32Base));
953 
954  //
955  // Return either the interrupt status or the raw interrupt status as
956  // requested.
957  //
958  if(bMasked)
959  {
960  return(HWREG(I2C0_BASE + I2C_O_SMIS));
961  }
962  else
963  {
964  return(HWREG(I2C0_BASE + I2C_O_SRIS));
965  }
966 }
967 
968 //*****************************************************************************
969 //
987 //
988 //*****************************************************************************
989 extern void I2CIntRegister(uint32_t ui32Base, void (*pfnHandler)(void));
990 
991 //*****************************************************************************
992 //
1005 //
1006 //*****************************************************************************
1007 extern void I2CIntUnregister(uint32_t ui32Base);
1008 
1009 //*****************************************************************************
1010 //
1011 // Support for DriverLib in ROM:
1012 // Redirect to implementation in ROM when available.
1013 //
1014 //*****************************************************************************
1015 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1016  #include <driverlib/rom.h>
1017  #ifdef ROM_I2CMasterInitExpClk
1018  #undef I2CMasterInitExpClk
1019  #define I2CMasterInitExpClk ROM_I2CMasterInitExpClk
1020  #endif
1021  #ifdef ROM_I2CMasterErr
1022  #undef I2CMasterErr
1023  #define I2CMasterErr ROM_I2CMasterErr
1024  #endif
1025  #ifdef ROM_I2CIntRegister
1026  #undef I2CIntRegister
1027  #define I2CIntRegister ROM_I2CIntRegister
1028  #endif
1029  #ifdef ROM_I2CIntUnregister
1030  #undef I2CIntUnregister
1031  #define I2CIntUnregister ROM_I2CIntUnregister
1032  #endif
1033 #endif
1034 
1035 //*****************************************************************************
1036 //
1037 // Mark the end of the C bindings section for C++ compilers.
1038 //
1039 //*****************************************************************************
1040 #ifdef __cplusplus
1041 }
1042 #endif
1043 
1044 #endif // __I2C_H__
1045 
1046 //*****************************************************************************
1047 //
1051 //
1052 //*****************************************************************************
static void I2CSlaveInit(uint32_t ui32Base, uint8_t ui8SlaveAddr)
Initializes the I2C Slave block.
Definition: i2c.h:651
static void I2CMasterEnable(uint32_t ui32Base)
Enables the I2C Master block.
Definition: i2c.h:300
#define I2C_SLAVE_INT_STOP
Definition: i2c.h:144
static void I2CMasterDataPut(uint32_t ui32Base, uint8_t ui8Data)
Transmits a byte from the I2C Master.
Definition: i2c.h:446
#define I2C_MASTER_CMD_BURST_SEND_START
Definition: i2c.h:102
static uint32_t I2CSlaveIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current I2C Slave interrupt status.
Definition: i2c.h:947
static void I2CSlaveDisable(uint32_t ui32Base)
Disables the I2C slave block.
Definition: i2c.h:709
static void I2CSlaveAddressSet(uint32_t ui32Base, uint8_t ui8SlaveAddr)
Sets the I2C slave address.
Definition: i2c.h:683
#define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP
Definition: i2c.h:108
static uint32_t I2CSlaveDataGet(uint32_t ui32Base)
Receives a byte that has been sent to the I2C Slave.
Definition: i2c.h:764
static void I2CSlaveEnable(uint32_t ui32Base)
Enables the I2C Slave block.
Definition: i2c.h:621
static void I2CSlaveDataPut(uint32_t ui32Base, uint8_t ui8Data)
Transmits a byte from the I2C Slave.
Definition: i2c.h:790
#define I2C_SLAVE_INT_START
Definition: i2c.h:145
void I2CMasterInitExpClk(uint32_t ui32Base, uint32_t ui32I2CClk, bool bFast)
Initializes the I2C Master block.
Definition: i2c.c:65
#define I2C_SLAVE_INT_DATA
Definition: i2c.h:146
static uint32_t I2CSlaveStatus(uint32_t ui32Base)
Gets the I2C Slave module status.
Definition: i2c.h:738
#define I2C_MASTER_CMD_SINGLE_SEND
Definition: i2c.h:98
#define I2C_MASTER_CMD_BURST_RECEIVE_CONT
Definition: i2c.h:112
#define ASSERT(expr)
Definition: debug.h:74
static bool I2CMasterIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current I2C Master interrupt status.
Definition: i2c.h:588
static void I2CMasterSlaveAddrSet(uint32_t ui32Base, uint8_t ui8SlaveAddr, bool bReceive)
Sets the address that the I2C Master will place on the bus.
Definition: i2c.h:273
#define I2C_MASTER_CMD_BURST_SEND_FINISH
Definition: i2c.h:106
#define I2C_MASTER_CMD_BURST_SEND_CONT
Definition: i2c.h:104
#define I2C_MASTER_CMD_BURST_RECEIVE_FINISH
Definition: i2c.h:114
static bool I2CMasterBusBusy(uint32_t ui32Base)
Indicates whether or not the I2C bus is busy.
Definition: i2c.h:387
uint32_t I2CMasterErr(uint32_t ui32Base)
Gets the error status of the I2C Master module.
Definition: i2c.c:110
static void I2CSlaveIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Clears I2C Slave interrupt sources.
Definition: i2c.h:913
static void I2CMasterControl(uint32_t ui32Base, uint32_t ui32Cmd)
Controls the state of the I2C Master module.
Definition: i2c.h:224
static void I2CMasterIntDisable(uint32_t ui32Base)
Disables the I2C Master interrupt.
Definition: i2c.h:514
static void I2CSlaveIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Enables individual I2C Slave interrupt sources.
Definition: i2c.h:822
static void I2CMasterIntEnable(uint32_t ui32Base)
Enables the I2C Master interrupt.
Definition: i2c.h:489
#define I2C_MASTER_CMD_BURST_RECEIVE_START
Definition: i2c.h:110
static uint32_t I2CMasterDataGet(uint32_t ui32Base)
Receives a byte that has been sent to the I2C Master.
Definition: i2c.h:420
static void I2CMasterDisable(uint32_t ui32Base)
Disables the I2C master block.
Definition: i2c.h:324
void I2CIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
Registers an interrupt handler for the I2C module.
Definition: i2c.c:152
#define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP
Definition: i2c.h:116
static bool I2CMasterBusy(uint32_t ui32Base)
Indicates whether or not the I2C Master is busy.
Definition: i2c.h:351
void CPUdelay(uint32_t ui32Count)
Provide a small delay.
Definition: cpu.c:372
static void I2CSlaveIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Disables individual I2C Slave interrupt sources.
Definition: i2c.h:860
static void I2CMasterIntClear(uint32_t ui32Base)
Clears I2C Master interrupt sources.
Definition: i2c.h:556
void I2CIntUnregister(uint32_t ui32Base)
Unregisters an interrupt handler for the I2C module.
Definition: i2c.c:183