Some devices (e.g. the Atmel AT24C11) have no concept of a device address; they respond to every device address and use this value as the word address. Some other devices use part of the device address field to extend the word address field. Generalise the i2c bit-bashing support to handle this by defining the device address length and word address length as properties of an i2c device. The word address is assumed to overflow into the device address field if the address used exceeds the width of the word address field. Also add a bus reset mechanism. i2c chips don't usually have a reset line, so rebooting the host will not clear any bizarre state that the chip may be in. We reset the bus by clocking SCL until we see SDA high, at which point we know we can generate a start condition and have it seen by all devices. We then generate a stop condition to leave the bus in a known state prior to use. Finally, add some extra debugging messages to i2c_bit.c.tags/v0.9.6
|
|
||
19 |
|
19 |
|
20 |
|
20 |
|
21 |
|
21 |
|
|
22 |
|
|
22 |
|
23 |
|
23 |
|
24 |
|
24 |
|
25 |
|
|
|
||
49 |
|
50 |
|
50 |
|
51 |
|
51 |
|
52 |
|
|
53 |
|
|
52 |
|
54 |
|
53 |
|
55 |
|
54 |
|
56 |
|
|
|
||
60 |
|
62 |
|
61 |
|
63 |
|
62 |
|
64 |
|
|
65 |
|
|
63 |
|
66 |
|
64 |
|
67 |
|
65 |
|
68 |
|
|
|
||
71 |
|
74 |
|
72 |
|
75 |
|
73 |
|
76 |
|
74 |
|
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
75 |
|
81 |
|
76 |
|
82 |
|
77 |
|
83 |
|
|
|
||
137 |
|
143 |
|
138 |
|
144 |
|
139 |
|
145 |
|
140 |
|
|
|
|
146 |
|
|
|
147 |
|
|
141 |
|
148 |
|
|
149 |
|
|
142 |
|
150 |
|
143 |
|
151 |
|
144 |
|
152 |
|
145 |
|
153 |
|
146 |
|
154 |
|
147 |
|
155 |
|
148 |
|
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
149 |
|
160 |
|
150 |
|
161 |
|
151 |
|
162 |
|
|
|
||
157 |
|
168 |
|
158 |
|
169 |
|
159 |
|
170 |
|
160 |
|
|
|
|
171 |
|
|
161 |
|
172 |
|
162 |
|
173 |
|
163 |
|
174 |
|
164 |
|
175 |
|
165 |
|
|
|
166 |
|
|
|
|
176 |
|
|
|
177 |
|
|
167 |
|
178 |
|
168 |
|
179 |
|
169 |
|
180 |
|
170 |
|
181 |
|
171 |
|
182 |
|
172 |
|
|
|
|
183 |
|
|
|
184 |
|
|
173 |
|
185 |
|
174 |
|
186 |
|
175 |
|
187 |
|
|
|
||
177 |
|
189 |
|
178 |
|
190 |
|
179 |
|
191 |
|
|
192 |
|
|
180 |
|
193 |
|
181 |
|
194 |
|
182 |
|
195 |
|
183 |
|
196 |
|
184 |
|
|
|
|
197 |
|
|
185 |
|
198 |
|
|
199 |
|
|
|
200 |
|
|
186 |
|
201 |
|
187 |
|
202 |
|
188 |
|
203 |
|
189 |
|
204 |
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
199 |
|
209 |
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
204 |
|
215 |
|
205 |
|
216 |
|
206 |
|
217 |
|
207 |
|
218 |
|
208 |
|
219 |
|
209 |
|
220 |
|
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
210 |
|
261 |
|
211 |
|
262 |
|
212 |
|
263 |
|
|
|
||
228 |
|
279 |
|
229 |
|
280 |
|
230 |
|
281 |
|
231 |
|
|
|
|
282 |
|
|
|
283 |
|
|
232 |
|
284 |
|
233 |
|
|
|
|
285 |
|
|
234 |
|
286 |
|
235 |
|
287 |
|
236 |
|
|
|
|
288 |
|
|
|
289 |
|
|
237 |
|
290 |
|
238 |
|
291 |
|
239 |
|
292 |
|
|
|
||
241 |
|
294 |
|
242 |
|
295 |
|
243 |
|
296 |
|
244 |
|
|
|
|
297 |
|
|
245 |
|
298 |
|
246 |
|
299 |
|
247 |
|
300 |
|
248 |
|
|
|
|
301 |
|
|
|
302 |
|
|
249 |
|
303 |
|
250 |
|
304 |
|
251 |
|
305 |
|
252 |
|
|
|
253 |
|
|
|
|
306 |
|
|
|
307 |
|
|
254 |
|
308 |
|
255 |
|
309 |
|
256 |
|
|
|
|
310 |
|
|
257 |
|
311 |
|
258 |
|
312 |
|
259 |
|
313 |
|
|
|
||
279 |
|
333 |
|
280 |
|
334 |
|
281 |
|
335 |
|
282 |
|
|
|
|
336 |
|
|
|
337 |
|
|
283 |
|
338 |
|
284 |
|
|
|
|
339 |
|
|
285 |
|
340 |
|
286 |
|
341 |
|
287 |
|
|
|
|
342 |
|
|
|
343 |
|
|
288 |
|
344 |
|
289 |
|
345 |
|
290 |
|
346 |
|
|
|
||
292 |
|
348 |
|
293 |
|
349 |
|
294 |
|
350 |
|
295 |
|
|
|
|
351 |
|
|
296 |
|
352 |
|
297 |
|
353 |
|
298 |
|
354 |
|
299 |
|
|
|
300 |
|
|
|
|
355 |
|
|
|
356 |
|
|
301 |
|
357 |
|
302 |
|
358 |
|
303 |
|
359 |
|
304 |
|
|
|
|
360 |
|
|
305 |
|
361 |
|
306 |
|
362 |
|
307 |
|
363 |
|
|
|
||
310 |
|
366 |
|
311 |
|
367 |
|
312 |
|
368 |
|
|
369 |
|
|
313 |
|
370 |
|
314 |
|
|
|
|
371 |
|
|
|
372 |
|
|
315 |
|
373 |
|
316 |
|
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
317 |
|
378 |
|
318 |
|
379 |
|
319 |
|
380 |
|
320 |
|
381 |
|
321 |
|
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
322 |
|
391 |
|
|
|
||
1069 |
|
1069 |
|
1070 |
|
1070 |
|
1071 |
|
1071 |
|
1072 |
|
|
|
1073 |
|
|
|
1074 |
|
|
|
|
1072 |
|
|
|
1073 |
|
|
|
1074 |
|
|
1075 |
|
1075 |
|
1076 |
|
1076 |
|
1077 |
|
1077 |
|
|
|
||
8 |
|
8 |
|
9 |
|
9 |
|
10 |
|
10 |
|
|
11 |
|
|
11 |
|
12 |
|
12 |
|
13 |
|
13 |
|
14 |
|
|
|
||
15 |
|
16 |
|
16 |
|
17 |
|
17 |
|
18 |
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
22 |
|
48 |
|
23 |
|
49 |
|
24 |
|
50 |
|
|
|
||
91 |
|
117 |
|
92 |
|
118 |
|
93 |
|
119 |
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
94 |
|
123 |
|
95 |
|
124 |
|
96 |
|
125 |
|
|
|
||
106 |
|
135 |
|
107 |
|
136 |
|
108 |
|
137 |
|
109 |
|
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
110 |
|
168 |
|
111 |
|
169 |
|