CC13xx Driver Library
i2c.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: i2c.h
3 * Revised: 2015-07-16 12:12:04 +0200 (Thu, 16 Jul 2015)
4 * Revision: 44151
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 //
547 //
548 //*****************************************************************************
549 __STATIC_INLINE void
550 I2CMasterIntClear(uint32_t ui32Base)
551 {
552  //
553  // Check the arguments.
554  //
555  ASSERT(I2CBaseValid(ui32Base));
556 
557  //
558  // Clear the I2C master interrupt source.
559  //
560  HWREG(I2C0_BASE + I2C_O_MICR) = I2C_MICR_IC;
561 }
562 
563 //*****************************************************************************
564 //
579 //
580 //*****************************************************************************
581 __STATIC_INLINE bool
582 I2CMasterIntStatus(uint32_t ui32Base, bool bMasked)
583 {
584  //
585  // Check the arguments.
586  //
587  ASSERT(I2CBaseValid(ui32Base));
588 
589  //
590  // Return either the interrupt status or the raw interrupt status as
591  // requested.
592  //
593  if(bMasked)
594  {
595  return((HWREG(I2C0_BASE + I2C_O_MMIS)) ? true : false);
596  }
597  else
598  {
599  return((HWREG(I2C0_BASE + I2C_O_MRIS)) ? true : false);
600  }
601 }
602 
603 //*****************************************************************************
604 //
612 //
613 //*****************************************************************************
614 __STATIC_INLINE void
615 I2CSlaveEnable(uint32_t ui32Base)
616 {
617  // Check the arguments.
618  ASSERT(I2CBaseValid(ui32Base));
619 
620  // Enable the clock to the slave block.
621  HWREGBITW(I2C0_BASE + I2C_O_MCR, I2C_MCR_SFE_BITN) = 1;
622 
623  // Enable the slave.
624  HWREG(I2C0_BASE + I2C_O_SCTL) = I2C_SCTL_DA;
625 }
626 
627 //*****************************************************************************
628 //
642 //
643 //*****************************************************************************
644 __STATIC_INLINE void
645 I2CSlaveInit(uint32_t ui32Base, uint8_t ui8SlaveAddr)
646 {
647  //
648  // Check the arguments.
649  //
650  ASSERT(I2CBaseValid(ui32Base));
651  ASSERT(!(ui8SlaveAddr & 0x80));
652 
653  //
654  // Must enable the device before doing anything else.
655  //
657 
658  //
659  // Set up the slave address.
660  //
661  HWREG(I2C0_BASE + I2C_O_SOAR) = ui8SlaveAddr;
662 }
663 
664 //*****************************************************************************
665 //
674 //
675 //*****************************************************************************
676 __STATIC_INLINE void
677 I2CSlaveAddressSet(uint32_t ui32Base, uint8_t ui8SlaveAddr)
678 {
679  //
680  // Check the arguments.
681  //
682  ASSERT(I2CBaseValid(ui32Base));
683  ASSERT(!(ui8SlaveAddr & 0x80));
684 
685  //
686  // Set up the primary slave address.
687  //
688  HWREG(I2C0_BASE + I2C_O_SOAR) = ui8SlaveAddr;
689 }
690 
691 //*****************************************************************************
692 //
700 //
701 //*****************************************************************************
702 __STATIC_INLINE void
703 I2CSlaveDisable(uint32_t ui32Base)
704 {
705  // Check the arguments.
706  ASSERT(I2CBaseValid(ui32Base));
707 
708  // Disable the slave.
709  HWREG(I2C0_BASE + I2C_O_SCTL) = 0x0;
710 
711  // Disable the clock to the slave block.
712  HWREGBITW(I2C0_BASE + I2C_O_MCR, I2C_MCR_SFE_BITN) = 0;
713 }
714 
715 //*****************************************************************************
716 //
729 //
730 //*****************************************************************************
731 __STATIC_INLINE uint32_t
732 I2CSlaveStatus(uint32_t ui32Base)
733 {
734  //
735  // Check the arguments.
736  //
737  ASSERT(I2CBaseValid(ui32Base));
738 
739  //
740  // Return the slave status.
741  //
742  return(HWREG(I2C0_BASE + I2C_O_SSTAT));
743 }
744 
745 //*****************************************************************************
746 //
755 //
756 //*****************************************************************************
757 __STATIC_INLINE uint32_t
758 I2CSlaveDataGet(uint32_t ui32Base)
759 {
760  //
761  // Check the arguments.
762  //
763  ASSERT(I2CBaseValid(ui32Base));
764 
765  //
766  // Read a byte.
767  //
768  return(HWREG(I2C0_BASE + I2C_O_SDR));
769 }
770 
771 //*****************************************************************************
772 //
781 //
782 //*****************************************************************************
783 __STATIC_INLINE void
784 I2CSlaveDataPut(uint32_t ui32Base, uint8_t ui8Data)
785 {
786  //
787  // Check the arguments.
788  //
789  ASSERT(I2CBaseValid(ui32Base));
790 
791  //
792  // Write the byte.
793  //
794  HWREG(I2C0_BASE + I2C_O_SDR) = ui8Data;
795 }
796 
797 //*****************************************************************************
798 //
813 //
814 //*****************************************************************************
815 __STATIC_INLINE void
816 I2CSlaveIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
817 {
818  uint32_t ui32Val;
819 
820  //
821  // Check the arguments.
822  //
823  ASSERT(I2CBaseValid(ui32Base));
824  ASSERT(ui32IntFlags & (I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_START |
826 
827  //
828  // Enable the slave interrupt.
829  //
830  ui32Val = HWREG(I2C0_BASE + I2C_O_SIMR);
831  ui32Val |= ui32IntFlags;
832  HWREG(I2C0_BASE + I2C_O_SIMR) = ui32Val;
833 }
834 
835 //*****************************************************************************
836 //
851 //
852 //*****************************************************************************
853 __STATIC_INLINE void
854 I2CSlaveIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
855 {
856  uint32_t ui32Val;
857 
858  //
859  // Check the arguments.
860  //
861  ASSERT(I2CBaseValid(ui32Base));
862  ASSERT(ui32IntFlags & (I2C_SLAVE_INT_STOP | I2C_SLAVE_INT_START |
864 
865  //
866  // Disable the slave interrupt.
867  //
868  ui32Val = HWREG(I2C0_BASE + I2C_O_SIMR);
869  ui32Val &= ~ui32IntFlags;
870  HWREG(I2C0_BASE + I2C_O_SIMR) = ui32Val;
871 }
872 
873 //*****************************************************************************
874 //
898 //
899 //*****************************************************************************
900 __STATIC_INLINE void
901 I2CSlaveIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
902 {
903  //
904  // Check the arguments.
905  //
906  ASSERT(I2CBaseValid(ui32Base));
907 
908  //
909  // Clear the I2C slave interrupt source.
910  //
911  HWREG(I2C0_BASE + I2C_O_SICR) = ui32IntFlags;
912 }
913 
914 //*****************************************************************************
915 //
931 
932 //
933 //*****************************************************************************
934 __STATIC_INLINE uint32_t
935 I2CSlaveIntStatus(uint32_t ui32Base, bool bMasked)
936 {
937  //
938  // Check the arguments.
939  //
940  ASSERT(I2CBaseValid(ui32Base));
941 
942  //
943  // Return either the interrupt status or the raw interrupt status as
944  // requested.
945  //
946  if(bMasked)
947  {
948  return(HWREG(I2C0_BASE + I2C_O_SMIS));
949  }
950  else
951  {
952  return(HWREG(I2C0_BASE + I2C_O_SRIS));
953  }
954 }
955 
956 //*****************************************************************************
957 //
975 //
976 //*****************************************************************************
977 extern void I2CIntRegister(uint32_t ui32Base, void (*pfnHandler)(void));
978 
979 //*****************************************************************************
980 //
993 //
994 //*****************************************************************************
995 extern void I2CIntUnregister(uint32_t ui32Base);
996 
997 //*****************************************************************************
998 //
999 // Support for DriverLib in ROM:
1000 // Redirect to implementation in ROM when available.
1001 //
1002 //*****************************************************************************
1003 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1004  #include <driverlib/rom.h>
1005  #ifdef ROM_I2CMasterInitExpClk
1006  #undef I2CMasterInitExpClk
1007  #define I2CMasterInitExpClk ROM_I2CMasterInitExpClk
1008  #endif
1009  #ifdef ROM_I2CMasterErr
1010  #undef I2CMasterErr
1011  #define I2CMasterErr ROM_I2CMasterErr
1012  #endif
1013  #ifdef ROM_I2CIntRegister
1014  #undef I2CIntRegister
1015  #define I2CIntRegister ROM_I2CIntRegister
1016  #endif
1017  #ifdef ROM_I2CIntUnregister
1018  #undef I2CIntUnregister
1019  #define I2CIntUnregister ROM_I2CIntUnregister
1020  #endif
1021 #endif
1022 
1023 //*****************************************************************************
1024 //
1025 // Mark the end of the C bindings section for C++ compilers.
1026 //
1027 //*****************************************************************************
1028 #ifdef __cplusplus
1029 }
1030 #endif
1031 
1032 #endif // __I2C_H__
1033 
1034 //*****************************************************************************
1035 //
1039 //
1040 //*****************************************************************************
static void I2CSlaveInit(uint32_t ui32Base, uint8_t ui8SlaveAddr)
Initializes the I2C Slave block.
Definition: i2c.h:645
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:935
static void I2CSlaveDisable(uint32_t ui32Base)
Disables the I2C slave block.
Definition: i2c.h:703
static void I2CSlaveAddressSet(uint32_t ui32Base, uint8_t ui8SlaveAddr)
Sets the I2C slave address.
Definition: i2c.h:677
#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:758
static void I2CSlaveEnable(uint32_t ui32Base)
Enables the I2C Slave block.
Definition: i2c.h:615
static void I2CSlaveDataPut(uint32_t ui32Base, uint8_t ui8Data)
Transmits a byte from the I2C Slave.
Definition: i2c.h:784
#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:732
#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:582
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:901
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:816
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:854
static void I2CMasterIntClear(uint32_t ui32Base)
Clears I2C Master interrupt sources.
Definition: i2c.h:550
void I2CIntUnregister(uint32_t ui32Base)
Unregisters an interrupt handler for the I2C module.
Definition: i2c.c:183