Rev 195 | Rev 228 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 195 | Rev 196 | ||
---|---|---|---|
Line 123... | Line 123... | ||
123 | // configure P2.2->I2C1_CLKOUT and P2.3->I2C1_DOUT to normal port operation |
123 | // configure P2.2->I2C1_CLKOUT and P2.3->I2C1_DOUT to normal port operation |
124 | GPIO_StructInit(&GPIO_InitStructure); |
124 | GPIO_StructInit(&GPIO_InitStructure); |
125 | GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; |
125 | GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; |
126 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; |
126 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; |
127 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
127 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
128 | GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable; |
128 | GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable; |
129 | GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1; |
129 | GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1; |
130 | GPIO_Init(GPIO2, &GPIO_InitStructure); |
130 | GPIO_Init(GPIO2, &GPIO_InitStructure); |
Line 131... | Line 131... | ||
131 | 131 | ||
132 | u8 i; |
132 | u8 i; |
Line 156... | Line 156... | ||
156 | // reconfigure P2.2->I2C1_CLKOUT and P2.3->I2C1_DOUT |
156 | // reconfigure P2.2->I2C1_CLKOUT and P2.3->I2C1_DOUT |
157 | GPIO_StructInit(&GPIO_InitStructure); |
157 | GPIO_StructInit(&GPIO_InitStructure); |
158 | GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; |
158 | GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput; |
159 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; |
159 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; |
160 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
160 | GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector; |
161 | GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable; |
161 | GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Enable; |
162 | GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2; //I2C1_CLKOUT, I2C1_DOUT |
162 | GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2; //I2C1_CLKOUT, I2C1_DOUT |
163 | GPIO_Init(GPIO2, &GPIO_InitStructure); |
163 | GPIO_Init(GPIO2, &GPIO_InitStructure); |
Line 164... | Line 164... | ||
164 | 164 | ||
165 | // enable I2C peripherie |
165 | // enable I2C peripherie |
Line 217... | Line 217... | ||
217 | SCU_APBPeriphClockConfig(__GPIO2, ENABLE); |
217 | SCU_APBPeriphClockConfig(__GPIO2, ENABLE); |
218 | GPIO_StructInit(&GPIO_InitStructure); |
218 | GPIO_StructInit(&GPIO_InitStructure); |
219 | GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; |
219 | GPIO_InitStructure.GPIO_Direction = GPIO_PinInput; |
220 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; |
220 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3; |
221 | GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull; |
221 | GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull; |
222 | GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable; |
222 | GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable; |
223 | GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; |
223 | GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1; |
224 | GPIO_Init(GPIO2, &GPIO_InitStructure); |
224 | GPIO_Init(GPIO2, &GPIO_InitStructure); |
Line 225... | Line 225... | ||
225 | 225 | ||
226 | I2C_TxBuffer = NULL; |
226 | I2C_TxBuffer = NULL; |