MSP430™CapTIvateSoftwareLibraryAPIGuide  1_70_00_03
I2CSlave.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // I2CSlave.h
3 //
5 //
10 //
13 //
14 //*****************************************************************************
15 //*****************************************************************************
18 //*****************************************************************************
19 
20 #ifndef CAPT_I2C_H_
21 #define CAPT_I2C_H_
22 
23 #include "I2CSlave_Definitions.h"
24 
25 #if (I2CSLAVE__ENABLE==true)
26 
27 #if (I2CSLAVE__TIMEOUT_ENABLE==true)
28 #include "FunctionTimer.h"
29 #endif
30 
31 //*****************************************************************************
32 //
35 //
38 //
39 //*****************************************************************************
40 #if (I2CSLAVE__EUSCI_B_PERIPHERAL == EUSCI_B0_BASE)
41 #define I2CSLAVE__EUSCI_VECTOR (USCI_B0_VECTOR)
42 #define I2CSLAVE__EUSCI_IV (UCB0IV)
43 #else
44 #error INVALID_EUSCI_B_SELECTION
45 #endif
46 
47 //*****************************************************************************
48 //
51 //
52 //*****************************************************************************
53 #define I2CSLAVE__INT_MASK (0x0F)
54 
55 //*****************************************************************************
56 //
59 //
60 //*****************************************************************************
61 #define I2C__INIT_REQ_SIGNAL (I2CSLAVE__REQ_POUT &= ~I2CSLAVE__REQ_MASK)
62 
63 //*****************************************************************************
64 //
67 //
68 //*****************************************************************************
69 #define I2C__PULL_REQ_SIGNAL (I2CSLAVE__REQ_PDIR |= I2CSLAVE__REQ_MASK)
70 
71 //*****************************************************************************
72 //
75 //
76 //*****************************************************************************
77 #define I2C__RELEASE_REQ_SIGNAL (I2CSLAVE__REQ_PDIR &= ~I2CSLAVE__REQ_MASK)
78 
79 //*****************************************************************************
80 //
85 //
86 //*****************************************************************************
87 typedef struct
88 {
89  //
94  //
95  bool (*pbReceiveCallback)(uint16_t);
96 
97  //
101  //
102  void (*pvErrorCallback)(uint8_t);
103 
104  //
108  //
110 
111  //
115  //
116  uint8_t *pReceiveBuffer;
117 
118  //
123  //
125 
126 } tI2CSlavePort;
127 
128 //*****************************************************************************
129 //
131 //
132 //*****************************************************************************
138 };
139 
140 //*****************************************************************************
141 //
144 //
145 //*****************************************************************************
151 };
152 
153 //*****************************************************************************
154 //
157 //
163 //
164 //*****************************************************************************
165 extern void I2CSlave_openPort(const tI2CSlavePort *pPort);
166 
167 //*****************************************************************************
168 //
171 //
176 //
177 //*****************************************************************************
178 extern void I2CSlave_closePort(void);
179 
180 //*****************************************************************************
181 //
184 //
188 //
189 //*****************************************************************************
190 extern uint8_t I2CSlave_getPortStatus(void);
191 
192 //*****************************************************************************
193 //
199 //
203 //
209 //
210 //*****************************************************************************
211 extern void I2CSlave_setTransmitBuffer(uint8_t *pBuffer, uint16_t ui16Length);
212 
213 //*****************************************************************************
214 //
217 //
221 //
226 //
227 //*****************************************************************************
228 extern void I2CSlave_setRequestFlag(void);
229 
230 #endif /* I2CSLAVE__ENABLE==true */
231 
232 #endif /* CAPT_I2C_H_ */
233 //*****************************************************************************
236 //*****************************************************************************
void I2CSlave_closePort(void)
Definition: I2CSlave.c:170
void I2CSlave_openPort(const tI2CSlavePort *pPort)
Definition: I2CSlave.c:146
Definition: I2CSlave.h:150
uint16_t ui16ReceiveBufferSize
Definition: I2CSlave.h:109
Definition: I2CSlave.h:149
Definition: I2CSlave.h:147
Definition: I2CSlave.h:148
Definition: I2CSlave.h:135
void I2CSlave_setTransmitBuffer(uint8_t *pBuffer, uint16_t ui16Length)
Definition: I2CSlave.c:184
bool bSendReadLengthFirst
Definition: I2CSlave.h:124
void I2CSlave_setRequestFlag(void)
Definition: I2CSlave.c:218
Definition: I2CSlave.h:137
tI2CSlaveErrors
Definition: I2CSlave.h:146
tI2CSlaveStates
enumerates the possible I2C slave driver states.
Definition: I2CSlave.h:133
Definition: I2CSlave.h:136
uint8_t I2CSlave_getPortStatus(void)
Definition: I2CSlave.c:179
uint8_t * pReceiveBuffer
Definition: I2CSlave.h:116
Definition: I2CSlave.h:87
Definition: I2CSlave.h:134
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale