Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1755 - 1
   1               		.file	"twimaster.c"
2
   2               		.arch atmega644p
3
   3               	__SREG__ = 0x3f
4
   4               	__SP_H__ = 0x3e
5
   5               	__SP_L__ = 0x3d
6
   6               	__tmp_reg__ = 0
7
   7               	__zero_reg__ = 1
8
   8               		.global __do_copy_data
9
   9               		.global __do_clear_bss
10
  10               	.global	BLConfig_ReadMask
11
  11               	.global	BLConfig_ReadMask
12
  12               		.section .bss
13
  15               	BLConfig_ReadMask:
14
  16 0000 0000      		.skip 2,0
15
  17               	.global	BLConfig_WriteMask
16
  18               	.global	BLConfig_WriteMask
17
  21               	BLConfig_WriteMask:
18
  22 0002 0000      		.skip 2,0
19
  23               	.global	BLFlags
20
  24               	.global	BLFlags
21
  27               	BLFlags:
22
  28 0004 00        		.skip 1,0
23
  29               	.global	MissingMotor
24
  30               	.global	MissingMotor
25
  33               	MissingMotor:
26
  34 0005 00        		.skip 1,0
27
  35               	.global	I2CTimeout
28
  36               		.data
29
  39               	I2CTimeout:
30
  40 0000 6400      		.word	100
31
  41               	.global	motor_read
32
  42               	.global	motor_read
33
  43               		.section .bss
34
  46               	motor_read:
35
  47 0006 00        		.skip 1,0
36
  48               	.global	motor_write
37
  49               	.global	motor_write
38
  52               	motor_write:
39
  53 0007 00        		.skip 1,0
40
  54               	.global	dac_channel
41
  55               	.global	dac_channel
42
  58               	dac_channel:
43
  59 0008 00        		.skip 1,0
44
  60               	.global	twi_state
45
  61               	.global	twi_state
46
  64               	twi_state:
47
  65 0009 00        		.skip 1,0
48
  66               		.text
49
  67               	.global	I2C_Init
50
  69               	I2C_Init:
51
  70               	/* prologue: frame size=0 */
52
  71               	/* prologue end (size=0) */
53
  72 0000 9FB7      		in r25,95-0x20
54
  73               	/* #APP */
55
  74 0002 F894      		cli
56
  75               	/* #NOAPP */
57
  76 0004 3998      		cbi 39-0x20,1
58
  77 0006 389A      		sbi 39-0x20,0
59
  78 0008 88B1      		in r24,40-0x20
60
  79 000a 8360      		ori r24,lo8(3)
61
  80 000c 88B9      		out 40-0x20,r24
62
  81 000e 8091 B900 		lds r24,185
63
  82 0012 8C7F      		andi r24,lo8(-4)
64
  83 0014 8093 B900 		sts 185,r24
65
  84 0018 8AE2      		ldi r24,lo8(42)
66
  85 001a 8093 B800 		sts 184,r24
67
  86 001e 1092 0000 		sts twi_state,__zero_reg__
68
  87 0022 1092 0000 		sts motor_write,__zero_reg__
69
  88 0026 1092 0000 		sts motor_read,__zero_reg__
70
  89 002a E0E0      		ldi r30,lo8(Motor)
71
  90 002c F0E0      		ldi r31,hi8(Motor)
72
  91 002e 8BE0      		ldi r24,lo8(11)
73
  92               	.L5:
74
  93 0030 1082      		st Z,__zero_reg__
75
  94 0032 1182      		std Z+1,__zero_reg__
76
  95 0034 1282      		std Z+2,__zero_reg__
77
  96 0036 1382      		std Z+3,__zero_reg__
78
  97 0038 1482      		std Z+4,__zero_reg__
79
  98 003a 1582      		std Z+5,__zero_reg__
80
  99 003c 1682      		std Z+6,__zero_reg__
81
 100 003e 1782      		std Z+7,__zero_reg__
82
 101 0040 8150      		subi r24,lo8(-(-1))
83
 102 0042 3896      		adiw r30,8
84
 103 0044 87FF      		sbrs r24,7
85
 104 0046 F4CF      		rjmp .L5
86
 105 0048 9FBF      		out 95-0x20,r25
87
 106               	/* epilogue: frame size=0 */
88
 107 004a 0895      		ret
89
 108               	/* epilogue end (size=1) */
90
 109               	/* function I2C_Init size 39 (38) */
91
 111               	.global	I2C_Reset
92
 113               	I2C_Reset:
93
 114               	/* prologue: frame size=0 */
94
 115               	/* prologue end (size=0) */
95
 116 004c 1092 0000 		sts twi_state,__zero_reg__
96
 117 0050 84E9      		ldi r24,lo8(-108)
97
 118 0052 8093 BC00 		sts 188,r24
98
 119 0056 1092 0000 		sts motor_write,__zero_reg__
99
 120 005a 1092 0000 		sts motor_read,__zero_reg__
100
 121 005e 80E8      		ldi r24,lo8(-128)
101
 122 0060 8093 BC00 		sts 188,r24
102
 123 0064 1092 BD00 		sts 189,__zero_reg__
103
 124 0068 1092 BA00 		sts 186,__zero_reg__
104
 125 006c 1092 BB00 		sts 187,__zero_reg__
105
 126 0070 1092 B900 		sts 185,__zero_reg__
106
 127 0074 1092 B800 		sts 184,__zero_reg__
107
 128 0078 0E94 0000 		call I2C_Init
108
 129 007c 1092 BB00 		sts 187,__zero_reg__
109
 130 0080 85E8      		ldi r24,lo8(-123)
110
 131 0082 8093 BC00 		sts 188,r24
111
 132 0086 8091 0000 		lds r24,BLFlags
112
 133 008a 8260      		ori r24,lo8(2)
113
 134 008c 8093 0000 		sts BLFlags,r24
114
 135               	/* epilogue: frame size=0 */
115
 136 0090 0895      		ret
116
 137               	/* epilogue end (size=1) */
117
 138               	/* function I2C_Reset size 35 (34) */
118
 140               		.lcomm missing_motor.0,1
119
 141               		.lcomm motor_read_temperature.1,1
120
 142               		.lcomm pBuff.2,2
121
 143               		.lcomm BuffLen.3,1
122
 144               	.global	__vector_26
123
 146               	__vector_26:
124
 147               	/* prologue: frame size=0 */
125
 148 0092 1F92      		push __zero_reg__
126
 149 0094 0F92      		push __tmp_reg__
127
 150 0096 0FB6      		in __tmp_reg__,__SREG__
128
 151 0098 0F92      		push __tmp_reg__
129
 152 009a 1124      		clr __zero_reg__
130
 153 009c 2F93      		push r18
131
 154 009e 3F93      		push r19
132
 155 00a0 4F93      		push r20
133
 156 00a2 5F93      		push r21
134
 157 00a4 8F93      		push r24
135
 158 00a6 9F93      		push r25
136
 159 00a8 EF93      		push r30
137
 160 00aa FF93      		push r31
138
 161               	/* prologue end (size=13) */
139
 162 00ac 8091 0000 		lds r24,twi_state
140
 163 00b0 282F      		mov r18,r24
141
 164 00b2 3327      		clr r19
142
 165 00b4 4427      		clr r20
143
 166 00b6 5527      		clr r21
144
 167 00b8 8F5F      		subi r24,lo8(-(1))
145
 168 00ba 8093 0000 		sts twi_state,r24
146
 169 00be F901      		movw r30,r18
147
 170 00c0 2731      		cpi r18,23
148
 171 00c2 3105      		cpc r19,__zero_reg__
149
 172 00c4 08F0      		brlo .+2
150
 173 00c6 B3C2      		rjmp .L72
151
 174 00c8 E050      		subi r30,lo8(-(pm(.L73)))
152
 175 00ca F040      		sbci r31,hi8(-(pm(.L73)))
153
 176 00cc 0C94 0000 		jmp __tablejump2__
154
 177               		.data
155
 178               		.section .progmem.gcc_sw_table, "a", @progbits
156
 179               		.p2align 1
157
 180               	.L73:
158
 181 0000 0000      		.word pm(.L76)
159
 182 0002 0000      		.word pm(.L17)
160
 183 0004 0000      		.word pm(.L22)
161
 184 0006 0000      		.word pm(.L27)
162
 185 0008 0000      		.word pm(.L29)
163
 186 000a 0000      		.word pm(.L33)
164
 187 000c 0000      		.word pm(.L50)
165
 188 000e 0000      		.word pm(.L72)
166
 189 0010 0000      		.word pm(.L72)
167
 190 0012 0000      		.word pm(.L72)
168
 191 0014 0000      		.word pm(.L72)
169
 192 0016 0000      		.word pm(.L72)
170
 193 0018 0000      		.word pm(.L72)
171
 194 001a 0000      		.word pm(.L72)
172
 195 001c 0000      		.word pm(.L72)
173
 196 001e 0000      		.word pm(.L72)
174
 197 0020 0000      		.word pm(.L72)
175
 198 0022 0000      		.word pm(.L72)
176
 199 0024 0000      		.word pm(.L60)
177
 200 0026 0000      		.word pm(.L61)
178
 201 0028 0000      		.word pm(.L62)
179
 202 002a 0000      		.word pm(.L68)
180
 203 002c 0000      		.word pm(.L69)
181
 204               		.text
182
 205               	.L75:
183
 206 00d0 8091 0000 		lds r24,motor_write
184
 207 00d4 8C30      		cpi r24,lo8(12)
185
 208 00d6 90F4      		brsh .L13
186
 209 00d8 8091 0000 		lds r24,motor_write
187
 210 00dc 8F5F      		subi r24,lo8(-(1))
188
 211 00de 8093 0000 		sts motor_write,r24
189
 212               	.L76:
190
 213 00e2 8091 0000 		lds r24,motor_write
191
 214 00e6 E82F      		mov r30,r24
192
 215 00e8 FF27      		clr r31
193
 216 00ea EE0F      		lsl r30
194
 217 00ec FF1F      		rol r31
195
 218 00ee EE0F      		lsl r30
196
 219 00f0 FF1F      		rol r31
197
 220 00f2 E050      		subi r30,lo8(-(Mixer))
198
 221 00f4 F040      		sbci r31,hi8(-(Mixer))
199
 222 00f6 8585      		ldd r24,Z+13
200
 223 00f8 1816      		cp __zero_reg__,r24
201
 224 00fa 54F7      		brge .L75
202
 225               	.L13:
203
 226 00fc 8091 0000 		lds r24,motor_write
204
 227 0100 8C30      		cpi r24,lo8(12)
205
 228 0102 70F0      		brlo .L15
206
 229 0104 1092 0000 		sts (BLConfig_WriteMask)+1,__zero_reg__
207
 230 0108 1092 0000 		sts BLConfig_WriteMask,__zero_reg__
208
 231 010c 1092 0000 		sts motor_write,__zero_reg__
209
 232 0110 85E0      		ldi r24,lo8(5)
210
 233 0112 8093 0000 		sts twi_state,r24
211
 234 0116 8091 0000 		lds r24,motor_read
212
 235 011a 880F      		lsl r24
213
 236 011c 8D5A      		subi r24,lo8(-(83))
214
 237 011e 04C0      		rjmp .L84
215
 238               	.L15:
216
 239 0120 8091 0000 		lds r24,motor_write
217
 240 0124 880F      		lsl r24
218
 241 0126 8E5A      		subi r24,lo8(-(82))
219
 242               	.L84:
220
 243 0128 8093 BB00 		sts 187,r24
221
 244 012c 85E8      		ldi r24,lo8(-123)
222
 245 012e 74C2      		rjmp .L80
223
 246               	.L17:
224
 247 0130 8091 0000 		lds r24,motor_write
225
 248 0134 E82F      		mov r30,r24
226
 249 0136 FF27      		clr r31
227
 250 0138 83E0      		ldi r24,3
228
 251 013a EE0F      	1:	lsl r30
229
 252 013c FF1F      		rol r31
230
 253 013e 8A95      		dec r24
231
 254 0140 E1F7      		brne 1b
232
 255 0142 E050      		subi r30,lo8(-(Motor))
233
 256 0144 F040      		sbci r31,hi8(-(Motor))
234
 257 0146 8181      		ldd r24,Z+1
235
 258 0148 8093 BB00 		sts 187,r24
236
 259 014c 85E8      		ldi r24,lo8(-123)
237
 260 014e 8093 BC00 		sts 188,r24
238
 261 0152 8091 0000 		lds r24,motor_write
239
 262 0156 E82F      		mov r30,r24
240
 263 0158 FF27      		clr r31
241
 264 015a EE0F      		lsl r30
242
 265 015c FF1F      		rol r31
243
 266 015e EE0F      		lsl r30
244
 267 0160 FF1F      		rol r31
245
 268 0162 EE0F      		lsl r30
246
 269 0164 FF1F      		rol r31
247
 270 0166 E050      		subi r30,lo8(-(Motor))
248
 271 0168 F040      		sbci r31,hi8(-(Motor))
249
 272 016a 8081      		ld r24,Z
250
 273 016c 80FF      		sbrs r24,0
251
 274 016e 91C0      		rjmp .L25
252
 275 0170 8091 0000 		lds r24,motor_write
253
 276 0174 E82F      		mov r30,r24
254
 277 0176 FF27      		clr r31
255
 278 0178 EE0F      		lsl r30
256
 279 017a FF1F      		rol r31
257
 280 017c EE0F      		lsl r30
258
 281 017e FF1F      		rol r31
259
 282 0180 EE0F      		lsl r30
260
 283 0182 FF1F      		rol r31
261
 284 0184 E050      		subi r30,lo8(-(Motor))
262
 285 0186 F040      		sbci r31,hi8(-(Motor))
263
 286 0188 8281      		ldd r24,Z+2
264
 287 018a 8823      		tst r24
265
 288 018c 29F0      		breq .L21
266
 289 018e 8091 0000 		lds r24,RequiredMotors
267
 290 0192 8730      		cpi r24,lo8(7)
268
 291 0194 08F4      		brsh .+2
269
 292 0196 5FC2      		rjmp .L9
270
 293               	.L21:
271
 294 0198 8091 0000 		lds r24,BLConfig_WriteMask
272
 295 019c 9091 0000 		lds r25,(BLConfig_WriteMask)+1
273
 296 01a0 892B      		or r24,r25
274
 297 01a2 09F0      		breq .+2
275
 298 01a4 58C2      		rjmp .L9
276
 299 01a6 8091 0000 		lds r24,BLConfig_ReadMask
277
 300 01aa 9091 0000 		lds r25,(BLConfig_ReadMask)+1
278
 301 01ae 892B      		or r24,r25
279
 302 01b0 09F0      		breq .+2
280
 303 01b2 51C2      		rjmp .L9
281
 304 01b4 6EC0      		rjmp .L25
282
 305               	.L22:
283
 306 01b6 8091 0000 		lds r24,motor_write
284
 307 01ba 21E0      		ldi r18,lo8(1)
285
 308 01bc 30E0      		ldi r19,hi8(1)
286
 309 01be 02C0      		rjmp 2f
287
 310 01c0 220F      	1:	lsl r18
288
 311 01c2 331F      		rol r19
289
 312 01c4 8A95      	2:	dec r24
290
 313 01c6 E2F7      		brpl 1b
291
 314 01c8 8091 0000 		lds r24,BLConfig_ReadMask
292
 315 01cc 9091 0000 		lds r25,(BLConfig_ReadMask)+1
293
 316 01d0 2823      		and r18,r24
294
 317 01d2 3923      		and r19,r25
295
 318 01d4 232B      		or r18,r19
296
 319 01d6 79F0      		breq .L23
297
 320 01d8 8091 0000 		lds r24,motor_write
298
 321 01dc E82F      		mov r30,r24
299
 322 01de FF27      		clr r31
300
 323 01e0 EE0F      		lsl r30
301
 324 01e2 FF1F      		rol r31
302
 325 01e4 EE0F      		lsl r30
303
 326 01e6 FF1F      		rol r31
304
 327 01e8 EE0F      		lsl r30
305
 328 01ea FF1F      		rol r31
306
 329 01ec E050      		subi r30,lo8(-(Motor))
307
 330 01ee F040      		sbci r31,hi8(-(Motor))
308
 331 01f0 80E1      		ldi r24,lo8(16)
309
 332 01f2 8483      		std Z+4,r24
310
 333 01f4 0DC0      		rjmp .L24
311
 334               	.L23:
312
 335 01f6 8091 0000 		lds r24,motor_write
313
 336 01fa E82F      		mov r30,r24
314
 337 01fc FF27      		clr r31
315
 338 01fe EE0F      		lsl r30
316
 339 0200 FF1F      		rol r31
317
 340 0202 EE0F      		lsl r30
318
 341 0204 FF1F      		rol r31
319
 342 0206 EE0F      		lsl r30
320
 343 0208 FF1F      		rol r31
321
 344 020a E050      		subi r30,lo8(-(Motor))
322
 345 020c F040      		sbci r31,hi8(-(Motor))
323
 346 020e 1482      		std Z+4,__zero_reg__
324
 347               	.L24:
325
 348 0210 8091 0000 		lds r24,motor_write
326
 349 0214 E82F      		mov r30,r24
327
 350 0216 FF27      		clr r31
328
 351 0218 53E0      		ldi r21,3
329
 352 021a EE0F      	1:	lsl r30
330
 353 021c FF1F      		rol r31
331
 354 021e 5A95      		dec r21
332
 355 0220 E1F7      		brne 1b
333
 356 0222 E050      		subi r30,lo8(-(Motor))
334
 357 0224 F040      		sbci r31,hi8(-(Motor))
335
 358 0226 8481      		ldd r24,Z+4
336
 359 0228 282F      		mov r18,r24
337
 360 022a 3327      		clr r19
338
 361 022c 43E0      		ldi r20,3
339
 362 022e 220F      	1:	lsl r18
340
 363 0230 331F      		rol r19
341
 364 0232 4A95      		dec r20
342
 365 0234 E1F7      		brne 1b
343
 366 0236 8091 0000 		lds r24,motor_write
344
 367 023a E82F      		mov r30,r24
345
 368 023c FF27      		clr r31
346
 369 023e 93E0      		ldi r25,3
347
 370 0240 EE0F      	1:	lsl r30
348
 371 0242 FF1F      		rol r31
349
 372 0244 9A95      		dec r25
350
 373 0246 E1F7      		brne 1b
351
 374 0248 E050      		subi r30,lo8(-(Motor))
352
 375 024a F040      		sbci r31,hi8(-(Motor))
353
 376 024c 8281      		ldd r24,Z+2
354
 377 024e 8770      		andi r24,lo8(7)
355
 378 0250 822B      		or r24,r18
356
 379 0252 8093 BB00 		sts 187,r24
357
 380 0256 85E8      		ldi r24,lo8(-123)
358
 381 0258 8093 BC00 		sts 188,r24
359
 382 025c 2091 0000 		lds r18,motor_write
360
 383 0260 81E0      		ldi r24,lo8(1)
361
 384 0262 90E0      		ldi r25,hi8(1)
362
 385 0264 02C0      		rjmp 2f
363
 386 0266 880F      	1:	lsl r24
364
 387 0268 991F      		rol r25
365
 388 026a 2A95      	2:	dec r18
366
 389 026c E2F7      		brpl 1b
367
 390 026e 2091 0000 		lds r18,BLConfig_WriteMask
368
 391 0272 3091 0000 		lds r19,(BLConfig_WriteMask)+1
369
 392 0276 8223      		and r24,r18
370
 393 0278 9323      		and r25,r19
371
 394 027a 892B      		or r24,r25
372
 395 027c 51F0      		breq .L25
373
 396 027e 80E0      		ldi r24,lo8(BLConfig)
374
 397 0280 90E0      		ldi r25,hi8(BLConfig)
375
 398 0282 9093 0000 		sts (pBuff.2)+1,r25
376
 399 0286 8093 0000 		sts pBuff.2,r24
377
 400 028a 88E0      		ldi r24,lo8(8)
378
 401 028c 8093 0000 		sts BuffLen.3,r24
379
 402 0290 E2C1      		rjmp .L9
380
 403               	.L25:
381
 404 0292 84E0      		ldi r24,lo8(4)
382
 405 0294 80C1      		rjmp .L82
383
 406               	.L27:
384
 407 0296 E091 0000 		lds r30,pBuff.2
385
 408 029a F091 0000 		lds r31,(pBuff.2)+1
386
 409 029e 8191      		ld r24,Z+
387
 410 02a0 8093 BB00 		sts 187,r24
388
 411 02a4 85E8      		ldi r24,lo8(-123)
389
 412 02a6 8093 BC00 		sts 188,r24
390
 413 02aa F093 0000 		sts (pBuff.2)+1,r31
391
 414 02ae E093 0000 		sts pBuff.2,r30
392
 415 02b2 8091 0000 		lds r24,BuffLen.3
393
 416 02b6 8150      		subi r24,lo8(-(-1))
394
 417 02b8 8093 0000 		sts BuffLen.3,r24
395
 418 02bc 8823      		tst r24
396
 419 02be 09F4      		brne .+2
397
 420 02c0 CAC1      		rjmp .L9
398
 421 02c2 83E0      		ldi r24,lo8(3)
399
 422 02c4 68C1      		rjmp .L82
400
 423               	.L29:
401
 424 02c6 8091 B900 		lds r24,185
402
 425 02ca 8033      		cpi r24,lo8(48)
403
 426 02cc 51F5      		brne .L30
404
 427 02ce 8091 0000 		lds r24,missing_motor.0
405
 428 02d2 8823      		tst r24
406
 429 02d4 29F4      		brne .L31
407
 430 02d6 8091 0000 		lds r24,motor_write
408
 431 02da 8F5F      		subi r24,lo8(-(1))
409
 432 02dc 8093 0000 		sts missing_motor.0,r24
410
 433               	.L31:
411
 434 02e0 8091 0000 		lds r24,motor_write
412
 435 02e4 E82F      		mov r30,r24
413
 436 02e6 FF27      		clr r31
414
 437 02e8 83E0      		ldi r24,3
415
 438 02ea EE0F      	1:	lsl r30
416
 439 02ec FF1F      		rol r31
417
 440 02ee 8A95      		dec r24
418
 441 02f0 E1F7      		brne 1b
419
 442 02f2 E050      		subi r30,lo8(-(Motor))
420
 443 02f4 F040      		sbci r31,hi8(-(Motor))
421
 444 02f6 8381      		ldd r24,Z+3
422
 445 02f8 9927      		clr r25
423
 446 02fa 8F77      		andi r24,lo8(127)
424
 447 02fc 9070      		andi r25,hi8(127)
425
 448 02fe 8F37      		cpi r24,127
426
 449 0300 9105      		cpc r25,__zero_reg__
427
 450 0302 7CF4      		brge .L30
428
 451 0304 8091 0000 		lds r24,motor_write
429
 452 0308 E82F      		mov r30,r24
430
 453 030a FF27      		clr r31
431
 454 030c EE0F      		lsl r30
432
 455 030e FF1F      		rol r31
433
 456 0310 EE0F      		lsl r30
434
 457 0312 FF1F      		rol r31
435
 458 0314 EE0F      		lsl r30
436
 459 0316 FF1F      		rol r31
437
 460 0318 E050      		subi r30,lo8(-(Motor))
438
 461 031a F040      		sbci r31,hi8(-(Motor))
439
 462 031c 8381      		ldd r24,Z+3
440
 463 031e 8F5F      		subi r24,lo8(-(1))
441
 464 0320 8383      		std Z+3,r24
442
 465               	.L30:
443
 466 0322 1092 0000 		sts twi_state,__zero_reg__
444
 467 0326 84E9      		ldi r24,lo8(-108)
445
 468 0328 8093 BC00 		sts 188,r24
446
 469 032c 8AE0      		ldi r24,lo8(10)
447
 470 032e 90E0      		ldi r25,hi8(10)
448
 471 0330 9093 0000 		sts (I2CTimeout)+1,r25
449
 472 0334 8093 0000 		sts I2CTimeout,r24
450
 473 0338 8091 0000 		lds r24,motor_write
451
 474 033c 8F5F      		subi r24,lo8(-(1))
452
 475 033e 8093 0000 		sts motor_write,r24
453
 476 0342 1092 0000 		sts twi_state,__zero_reg__
454
 477 0346 62C1      		rjmp .L85
455
 478               	.L33:
456
 479 0348 8091 B900 		lds r24,185
457
 480 034c 8034      		cpi r24,lo8(64)
458
 481 034e A9F1      		breq .L34
459
 482 0350 8091 0000 		lds r24,motor_read
460
 483 0354 E82F      		mov r30,r24
461
 484 0356 FF27      		clr r31
462
 485 0358 EE0F      		lsl r30
463
 486 035a FF1F      		rol r31
464
 487 035c EE0F      		lsl r30
465
 488 035e FF1F      		rol r31
466
 489 0360 EE0F      		lsl r30
467
 490 0362 FF1F      		rol r31
468
 491 0364 E050      		subi r30,lo8(-(Motor))
469
 492 0366 F040      		sbci r31,hi8(-(Motor))
470
 493 0368 8381      		ldd r24,Z+3
471
 494 036a 8F77      		andi r24,lo8(127)
472
 495 036c 8383      		std Z+3,r24
473
 496 036e 8091 0000 		lds r24,motor_read
474
 497 0372 8F5F      		subi r24,lo8(-(1))
475
 498 0374 8093 0000 		sts motor_read,r24
476
 499 0378 8091 0000 		lds r24,motor_read
477
 500 037c 8C30      		cpi r24,lo8(12)
478
 501 037e A0F0      		brlo .L35
479
 502 0380 1092 0000 		sts motor_read,__zero_reg__
480
 503 0384 1092 0000 		sts (BLConfig_ReadMask)+1,__zero_reg__
481
 504 0388 1092 0000 		sts BLConfig_ReadMask,__zero_reg__
482
 505 038c 8091 0000 		lds r24,motor_read_temperature.1
483
 506 0390 8F5F      		subi r24,lo8(-(1))
484
 507 0392 8093 0000 		sts motor_read_temperature.1,r24
485
 508 0396 8C30      		cpi r24,lo8(12)
486
 509 0398 38F0      		brlo .L35
487
 510 039a 1092 0000 		sts motor_read_temperature.1,__zero_reg__
488
 511 039e 8091 0000 		lds r24,BLFlags
489
 512 03a2 8D7F      		andi r24,lo8(-3)
490
 513 03a4 8093 0000 		sts BLFlags,r24
491
 514               	.L35:
492
 515 03a8 8091 0000 		lds r24,BLFlags
493
 516 03ac 8160      		ori r24,lo8(1)
494
 517 03ae 8093 0000 		sts BLFlags,r24
495
 518 03b2 1092 0000 		sts twi_state,__zero_reg__
496
 519 03b6 84E9      		ldi r24,lo8(-108)
497
 520 03b8 71C0      		rjmp .L78
498
 521               	.L34:
499
 522 03ba 8091 0000 		lds r24,motor_read
500
 523 03be E82F      		mov r30,r24
501
 524 03c0 FF27      		clr r31
502
 525 03c2 EE0F      		lsl r30
503
 526 03c4 FF1F      		rol r31
504
 527 03c6 EE0F      		lsl r30
505
 528 03c8 FF1F      		rol r31
506
 529 03ca EE0F      		lsl r30
507
 530 03cc FF1F      		rol r31
508
 531 03ce E050      		subi r30,lo8(-(Motor))
509
 532 03d0 F040      		sbci r31,hi8(-(Motor))
510
 533 03d2 8381      		ldd r24,Z+3
511
 534 03d4 8068      		ori r24,lo8(-128)
512
 535 03d6 8383      		std Z+3,r24
513
 536 03d8 8091 0000 		lds r24,motor_read
514
 537 03dc E82F      		mov r30,r24
515
 538 03de FF27      		clr r31
516
 539 03e0 EE0F      		lsl r30
517
 540 03e2 FF1F      		rol r31
518
 541 03e4 EE0F      		lsl r30
519
 542 03e6 FF1F      		rol r31
520
 543 03e8 EE0F      		lsl r30
521
 544 03ea FF1F      		rol r31
522
 545 03ec E050      		subi r30,lo8(-(Motor))
523
 546 03ee F040      		sbci r31,hi8(-(Motor))
524
 547 03f0 8081      		ld r24,Z
525
 548 03f2 80FF      		sbrs r24,0
526
 549 03f4 2FC0      		rjmp .L38
527
 550 03f6 8091 0000 		lds r24,motor_read
528
 551 03fa E82F      		mov r30,r24
529
 552 03fc FF27      		clr r31
530
 553 03fe 53E0      		ldi r21,3
531
 554 0400 EE0F      	1:	lsl r30
532
 555 0402 FF1F      		rol r31
533
 556 0404 5A95      		dec r21
534
 557 0406 E1F7      		brne 1b
535
 558 0408 E050      		subi r30,lo8(-(Motor))
536
 559 040a F040      		sbci r31,hi8(-(Motor))
537
 560 040c 8481      		ldd r24,Z+4
538
 561 040e 9927      		clr r25
539
 562 0410 0097      		sbiw r24,0
540
 563 0412 51F0      		breq .L41
541
 564 0414 4097      		sbiw r24,16
542
 565 0416 D9F5      		brne .L44
543
 566 0418 80E0      		ldi r24,lo8(BLConfig)
544
 567 041a 90E0      		ldi r25,hi8(BLConfig)
545
 568 041c 9093 0000 		sts (pBuff.2)+1,r25
546
 569 0420 8093 0000 		sts pBuff.2,r24
547
 570 0424 88E0      		ldi r24,lo8(8)
548
 571 0426 31C0      		rjmp .L77
549
 572               	.L41:
550
 573 0428 8091 0000 		lds r24,motor_read
551
 574 042c 9927      		clr r25
552
 575 042e 43E0      		ldi r20,3
553
 576 0430 880F      	1:	lsl r24
554
 577 0432 991F      		rol r25
555
 578 0434 4A95      		dec r20
556
 579 0436 E1F7      		brne 1b
557
 580 0438 8050      		subi r24,lo8(-(Motor+5))
558
 581 043a 9040      		sbci r25,hi8(-(Motor+5))
559
 582 043c 9093 0000 		sts (pBuff.2)+1,r25
560
 583 0440 8093 0000 		sts pBuff.2,r24
561
 584 0444 9091 0000 		lds r25,motor_read
562
 585 0448 8091 0000 		lds r24,motor_read_temperature.1
563
 586 044c 9817      		cp r25,r24
564
 587 044e E1F4      		brne .L45
565
 588 0450 83E0      		ldi r24,lo8(3)
566
 589 0452 1BC0      		rjmp .L77
567
 590               	.L38:
568
 591 0454 8091 0000 		lds r24,motor_read
569
 592 0458 9927      		clr r25
570
 593 045a 33E0      		ldi r19,3
571
 594 045c 880F      	1:	lsl r24
572
 595 045e 991F      		rol r25
573
 596 0460 3A95      		dec r19
574
 597 0462 E1F7      		brne 1b
575
 598 0464 8050      		subi r24,lo8(-(Motor+5))
576
 599 0466 9040      		sbci r25,hi8(-(Motor+5))
577
 600 0468 9093 0000 		sts (pBuff.2)+1,r25
578
 601 046c 8093 0000 		sts pBuff.2,r24
579
 602 0470 8091 0000 		lds r24,BLFlags
580
 603 0474 81FD      		sbrc r24,1
581
 604 0476 06C0      		rjmp .L46
582
 605 0478 9091 0000 		lds r25,motor_read
583
 606 047c 8091 0000 		lds r24,motor_read_temperature.1
584
 607 0480 9817      		cp r25,r24
585
 608 0482 11F4      		brne .L45
586
 609               	.L46:
587
 610 0484 82E0      		ldi r24,lo8(2)
588
 611 0486 01C0      		rjmp .L77
589
 612               	.L45:
590
 613 0488 81E0      		ldi r24,lo8(1)
591
 614               	.L77:
592
 615 048a 8093 0000 		sts BuffLen.3,r24
593
 616               	.L44:
594
 617 048e 8091 0000 		lds r24,BuffLen.3
595
 618 0492 8130      		cpi r24,lo8(1)
596
 619 0494 11F4      		brne .L48
597
 620 0496 85E8      		ldi r24,lo8(-123)
598
 621 0498 01C0      		rjmp .L78
599
 622               	.L48:
600
 623 049a 85EC      		ldi r24,lo8(-59)
601
 624               	.L78:
602
 625 049c 8093 BC00 		sts 188,r24
603
 626 04a0 8091 0000 		lds r24,missing_motor.0
604
 627 04a4 8093 0000 		sts MissingMotor,r24
605
 628 04a8 1092 0000 		sts missing_motor.0,__zero_reg__
606
 629 04ac D4C0      		rjmp .L9
607
 630               	.L50:
608
 631 04ae E091 0000 		lds r30,pBuff.2
609
 632 04b2 F091 0000 		lds r31,(pBuff.2)+1
610
 633 04b6 8091 BB00 		lds r24,187
611
 634 04ba 8083      		st Z,r24
612
 635 04bc 8091 0000 		lds r24,pBuff.2
613
 636 04c0 9091 0000 		lds r25,(pBuff.2)+1
614
 637 04c4 0196      		adiw r24,1
615
 638 04c6 9093 0000 		sts (pBuff.2)+1,r25
616
 639 04ca 8093 0000 		sts pBuff.2,r24
617
 640 04ce 8091 0000 		lds r24,BuffLen.3
618
 641 04d2 8150      		subi r24,lo8(-(-1))
619
 642 04d4 8093 0000 		sts BuffLen.3,r24
620
 643 04d8 8230      		cpi r24,lo8(2)
621
 644 04da 10F0      		brlo .L51
622
 645 04dc 85EC      		ldi r24,lo8(-59)
623
 646 04de 58C0      		rjmp .L79
624
 647               	.L51:
625
 648 04e0 8130      		cpi r24,lo8(1)
626
 649 04e2 11F4      		brne .L53
627
 650 04e4 85E8      		ldi r24,lo8(-123)
628
 651 04e6 54C0      		rjmp .L79
629
 652               	.L53:
630
 653 04e8 8091 0000 		lds r24,BLFlags
631
 654 04ec 81FF      		sbrs r24,1
632
 655 04ee 2DC0      		rjmp .L55
633
 656 04f0 8091 0000 		lds r24,FCFlags
634
 657 04f4 80FD      		sbrc r24,0
635
 658 04f6 1DC0      		rjmp .L56
636
 659 04f8 8091 0000 		lds r24,motor_read
637
 660 04fc E82F      		mov r30,r24
638
 661 04fe FF27      		clr r31
639
 662 0500 23E0      		ldi r18,3
640
 663 0502 EE0F      	1:	lsl r30
641
 664 0504 FF1F      		rol r31
642
 665 0506 2A95      		dec r18
643
 666 0508 E1F7      		brne 1b
644
 667 050a E050      		subi r30,lo8(-(Motor))
645
 668 050c F040      		sbci r31,hi8(-(Motor))
646
 669 050e 8681      		ldd r24,Z+6
647
 670 0510 8A3F      		cpi r24,lo8(-6)
648
 671 0512 79F4      		brne .L56
649
 672 0514 8091 0000 		lds r24,motor_read
650
 673 0518 E82F      		mov r30,r24
651
 674 051a FF27      		clr r31
652
 675 051c 93E0      		ldi r25,3
653
 676 051e EE0F      	1:	lsl r30
654
 677 0520 FF1F      		rol r31
655
 678 0522 9A95      		dec r25
656
 679 0524 E1F7      		brne 1b
657
 680 0526 E050      		subi r30,lo8(-(Motor))
658
 681 0528 F040      		sbci r31,hi8(-(Motor))
659
 682 052a 8081      		ld r24,Z
660
 683 052c 8160      		ori r24,lo8(1)
661
 684 052e 8083      		st Z,r24
662
 685 0530 0CC0      		rjmp .L55
663
 686               	.L56:
664
 687 0532 8091 0000 		lds r24,motor_read
665
 688 0536 E82F      		mov r30,r24
666
 689 0538 FF27      		clr r31
667
 690 053a 83E0      		ldi r24,3
668
 691 053c EE0F      	1:	lsl r30
669
 692 053e FF1F      		rol r31
670
 693 0540 8A95      		dec r24
671
 694 0542 E1F7      		brne 1b
672
 695 0544 E050      		subi r30,lo8(-(Motor))
673
 696 0546 F040      		sbci r31,hi8(-(Motor))
674
 697 0548 1082      		st Z,__zero_reg__
675
 698               	.L55:
676
 699 054a 8091 0000 		lds r24,motor_read
677
 700 054e 8F5F      		subi r24,lo8(-(1))
678
 701 0550 8093 0000 		sts motor_read,r24
679
 702 0554 8091 0000 		lds r24,motor_read
680
 703 0558 8C30      		cpi r24,lo8(12)
681
 704 055a A0F0      		brlo .L58
682
 705 055c 1092 0000 		sts motor_read,__zero_reg__
683
 706 0560 1092 0000 		sts (BLConfig_ReadMask)+1,__zero_reg__
684
 707 0564 1092 0000 		sts BLConfig_ReadMask,__zero_reg__
685
 708 0568 8091 0000 		lds r24,motor_read_temperature.1
686
 709 056c 8F5F      		subi r24,lo8(-(1))
687
 710 056e 8093 0000 		sts motor_read_temperature.1,r24
688
 711 0572 8C30      		cpi r24,lo8(12)
689
 712 0574 38F0      		brlo .L58
690
 713 0576 1092 0000 		sts motor_read_temperature.1,__zero_reg__
691
 714 057a 8091 0000 		lds r24,BLFlags
692
 715 057e 8D7F      		andi r24,lo8(-3)
693
 716 0580 8093 0000 		sts BLFlags,r24
694
 717               	.L58:
695
 718 0584 1092 0000 		sts twi_state,__zero_reg__
696
 719 0588 84E9      		ldi r24,lo8(-108)
697
 720 058a 8093 BC00 		sts 188,r24
698
 721 058e 49C0      		rjmp .L81
699
 722               	.L79:
700
 723 0590 8093 BC00 		sts 188,r24
701
 724 0594 86E0      		ldi r24,lo8(6)
702
 725               	.L82:
703
 726 0596 8093 0000 		sts twi_state,r24
704
 727 059a 5DC0      		rjmp .L9
705
 728               	.L60:
706
 729 059c 88E9      		ldi r24,lo8(-104)
707
 730 059e C4CD      		rjmp .L84
708
 731               	.L61:
709
 732 05a0 8091 0000 		lds r24,dac_channel
710
 733 05a4 880F      		lsl r24
711
 734 05a6 805F      		subi r24,lo8(-(16))
712
 735 05a8 BFCD      		rjmp .L84
713
 736               	.L62:
714
 737 05aa 8091 0000 		lds r24,dac_channel
715
 738 05ae 9927      		clr r25
716
 739 05b0 8130      		cpi r24,1
717
 740 05b2 9105      		cpc r25,__zero_reg__
718
 741 05b4 61F0      		breq .L65
719
 742 05b6 8230      		cpi r24,2
720
 743 05b8 9105      		cpc r25,__zero_reg__
721
 744 05ba 1CF4      		brge .L67
722
 745 05bc 892B      		or r24,r25
723
 746 05be 21F0      		breq .L64
724
 747 05c0 4AC0      		rjmp .L9
725
 748               	.L67:
726
 749 05c2 0297      		sbiw r24,2
727
 750 05c4 39F0      		breq .L66
728
 751 05c6 47C0      		rjmp .L9
729
 752               	.L64:
730
 753 05c8 8091 0000 		lds r24,AnalogOffsetNick
731
 754 05cc ADCD      		rjmp .L84
732
 755               	.L65:
733
 756 05ce 8091 0000 		lds r24,AnalogOffsetRoll
734
 757 05d2 AACD      		rjmp .L84
735
 758               	.L66:
736
 759 05d4 8091 0000 		lds r24,AnalogOffsetGier
737
 760 05d8 A7CD      		rjmp .L84
738
 761               	.L68:
739
 762 05da 80E8      		ldi r24,lo8(-128)
740
 763 05dc A5CD      		rjmp .L84
741
 764               	.L69:
742
 765 05de 1092 0000 		sts twi_state,__zero_reg__
743
 766 05e2 84E9      		ldi r24,lo8(-108)
744
 767 05e4 8093 BC00 		sts 188,r24
745
 768 05e8 8AE0      		ldi r24,lo8(10)
746
 769 05ea 90E0      		ldi r25,hi8(10)
747
 770 05ec 9093 0000 		sts (I2CTimeout)+1,r25
748
 771 05f0 8093 0000 		sts I2CTimeout,r24
749
 772 05f4 8091 0000 		lds r24,dac_channel
750
 773 05f8 8230      		cpi r24,lo8(2)
751
 774 05fa 88F4      		brsh .L70
752
 775 05fc 8091 0000 		lds r24,dac_channel
753
 776 0600 8F5F      		subi r24,lo8(-(1))
754
 777 0602 8093 0000 		sts dac_channel,r24
755
 778 0606 82E1      		ldi r24,lo8(18)
756
 779 0608 8093 0000 		sts twi_state,r24
757
 780               	.L85:
758
 781 060c 8091 0000 		lds r24,BLFlags
759
 782 0610 8E7F      		andi r24,lo8(-2)
760
 783 0612 8093 0000 		sts BLFlags,r24
761
 784 0616 85EA      		ldi r24,lo8(-91)
762
 785               	.L80:
763
 786 0618 8093 BC00 		sts 188,r24
764
 787 061c 1CC0      		rjmp .L9
765
 788               	.L70:
766
 789 061e 1092 0000 		sts dac_channel,__zero_reg__
767
 790               	.L81:
768
 791 0622 8091 0000 		lds r24,BLFlags
769
 792 0626 8160      		ori r24,lo8(1)
770
 793 0628 8093 0000 		sts BLFlags,r24
771
 794 062c 14C0      		rjmp .L9
772
 795               	.L72:
773
 796 062e 1092 0000 		sts twi_state,__zero_reg__
774
 797 0632 84E9      		ldi r24,lo8(-108)
775
 798 0634 8093 BC00 		sts 188,r24
776
 799 0638 8091 0000 		lds r24,BLFlags
777
 800 063c 8160      		ori r24,lo8(1)
778
 801 063e 8093 0000 		sts BLFlags,r24
779
 802 0642 8AE0      		ldi r24,lo8(10)
780
 803 0644 90E0      		ldi r25,hi8(10)
781
 804 0646 9093 0000 		sts (I2CTimeout)+1,r25
782
 805 064a 8093 0000 		sts I2CTimeout,r24
783
 806 064e 1092 0000 		sts motor_write,__zero_reg__
784
 807 0652 1092 0000 		sts motor_read,__zero_reg__
785
 808               	.L9:
786
 809               	/* epilogue: frame size=0 */
787
 810 0656 FF91      		pop r31
788
 811 0658 EF91      		pop r30
789
 812 065a 9F91      		pop r25
790
 813 065c 8F91      		pop r24
791
 814 065e 5F91      		pop r21
792
 815 0660 4F91      		pop r20
793
 816 0662 3F91      		pop r19
794
 817 0664 2F91      		pop r18
795
 818 0666 0F90      		pop __tmp_reg__
796
 819 0668 0FBE      		out __SREG__,__tmp_reg__
797
 820 066a 0F90      		pop __tmp_reg__
798
 821 066c 1F90      		pop __zero_reg__
799
 822 066e 1895      		reti
800
 823               	/* epilogue end (size=13) */
801
 824               	/* function __vector_26 size 779 (753) */
802
 826               	.global	I2C_WriteBLConfig
803
 828               	I2C_WriteBLConfig:
804
 829               	/* prologue: frame size=0 */
805
 830 0670 1F93      		push r17
806
 831 0672 CF93      		push r28
807
 832 0674 DF93      		push r29
808
 833               	/* prologue end (size=3) */
809
 834 0676 182F      		mov r17,r24
810
 835 0678 8091 0000 		lds r24,MotorenEin
811
 836 067c 8823      		tst r24
812
 837 067e 21F4      		brne .L88
813
 838 0680 8091 0000 		lds r24,PC_MotortestActive
814
 839 0684 8823      		tst r24
815
 840 0686 19F0      		breq .L87
816
 841               	.L88:
817
 842 0688 81E0      		ldi r24,lo8(1)
818
 843 068a 90E0      		ldi r25,hi8(1)
819
 844 068c 97C0      		rjmp .L86
820
 845               	.L87:
821
 846 068e 1D30      		cpi r17,lo8(13)
822
 847 0690 08F0      		brlo .+2
823
 848 0692 92C0      		rjmp .L115
824
 849 0694 1123      		tst r17
825
 850 0696 B1F0      		breq .L90
826
 851 0698 E12F      		mov r30,r17
827
 852 069a FF27      		clr r31
828
 853 069c 23E0      		ldi r18,3
829
 854 069e EE0F      	1:	lsl r30
830
 855 06a0 FF1F      		rol r31
831
 856 06a2 2A95      		dec r18
832
 857 06a4 E1F7      		brne 1b
833
 858 06a6 E050      		subi r30,lo8(-(Motor))
834
 859 06a8 F040      		sbci r31,hi8(-(Motor))
835
 860 06aa 3597      		sbiw r30,5
836
 861 06ac 8081      		ld r24,Z
837
 862 06ae 3596      		adiw r30,5
838
 863 06b0 8823      		tst r24
839
 864 06b2 0CF0      		brlt .+2
840
 865 06b4 81C0      		rjmp .L115
841
 866 06b6 3897      		sbiw r30,8
842
 867 06b8 8081      		ld r24,Z
843
 868 06ba 80FD      		sbrc r24,0
844
 869 06bc 03C0      		rjmp .L90
845
 870 06be 83E0      		ldi r24,lo8(3)
846
 871 06c0 90E0      		ldi r25,hi8(3)
847
 872 06c2 7CC0      		rjmp .L86
848
 873               	.L90:
849
 874 06c4 8091 0000 		lds r24,BLConfig
850
 875 06c8 8230      		cpi r24,lo8(2)
851
 876 06ca 19F0      		breq .L93
852
 877 06cc 84E0      		ldi r24,lo8(4)
853
 878 06ce 90E0      		ldi r25,hi8(4)
854
 879 06d0 75C0      		rjmp .L86
855
 880               	.L93:
856
 881 06d2 67E0      		ldi r22,lo8(7)
857
 882 06d4 70E0      		ldi r23,hi8(7)
858
 883 06d6 80E0      		ldi r24,lo8(BLConfig)
859
 884 06d8 90E0      		ldi r25,hi8(BLConfig)
860
 885 06da 0E94 0000 		call RAM_Checksum
861
 886 06de 9091 0000 		lds r25,BLConfig+7
862
 887 06e2 8917      		cp r24,r25
863
 888 06e4 19F0      		breq .L94
864
 889 06e6 85E0      		ldi r24,lo8(5)
865
 890 06e8 90E0      		ldi r25,hi8(5)
866
 891 06ea 68C0      		rjmp .L86
867
 892               	.L94:
868
 893 06ec 80ED      		ldi r24,lo8(2000)
869
 894 06ee 97E0      		ldi r25,hi8(2000)
870
 895 06f0 0E94 0000 		call SetDelay
871
 896 06f4 EC01      		movw r28,r24
872
 897               	.L95:
873
 898 06f6 8091 0000 		lds r24,BLFlags
874
 899 06fa 80FD      		sbrc r24,0
875
 900 06fc 05C0      		rjmp .L96
876
 901 06fe CE01      		movw r24,r28
877
 902 0700 0E94 0000 		call CheckDelay
878
 903 0704 8823      		tst r24
879
 904 0706 B9F3      		breq .L95
880
 905               	.L96:
881
 906 0708 1123      		tst r17
882
 907 070a 19F4      		brne .L98
883
 908 070c 8FEF      		ldi r24,lo8(255)
884
 909 070e 90E0      		ldi r25,hi8(255)
885
 910 0710 0BC0      		rjmp .L114
886
 911               	.L98:
887
 912 0712 212F      		mov r18,r17
888
 913 0714 3327      		clr r19
889
 914 0716 2150      		subi r18,lo8(-(-1))
890
 915 0718 3040      		sbci r19,hi8(-(-1))
891
 916 071a 81E0      		ldi r24,lo8(1)
892
 917 071c 90E0      		ldi r25,hi8(1)
893
 918 071e 02C0      		rjmp 2f
894
 919 0720 880F      	1:	lsl r24
895
 920 0722 991F      		rol r25
896
 921 0724 2A95      	2:	dec r18
897
 922 0726 E2F7      		brpl 1b
898
 923               	.L114:
899
 924 0728 9093 0000 		sts (BLConfig_WriteMask)+1,r25
900
 925 072c 8093 0000 		sts BLConfig_WriteMask,r24
901
 926 0730 A1E0      		ldi r26,lo8(1)
902
 927 0732 B0E0      		ldi r27,hi8(1)
903
 928 0734 E0E0      		ldi r30,lo8(Motor)
904
 929 0736 F0E0      		ldi r31,hi8(Motor)
905
 930 0738 40E0      		ldi r20,lo8(0)
906
 931 073a 50E0      		ldi r21,hi8(0)
907
 932 073c 6BE0      		ldi r22,lo8(11)
908
 933               	.L104:
909
 934 073e CD01      		movw r24,r26
910
 935 0740 042E      		mov r0,r20
911
 936 0742 02C0      		rjmp 2f
912
 937 0744 880F      	1:	lsl r24
913
 938 0746 991F      		rol r25
914
 939 0748 0A94      	2:	dec r0
915
 940 074a E2F7      		brpl 1b
916
 941 074c 2091 0000 		lds r18,BLConfig_WriteMask
917
 942 0750 3091 0000 		lds r19,(BLConfig_WriteMask)+1
918
 943 0754 8223      		and r24,r18
919
 944 0756 9323      		and r25,r19
920
 945 0758 892B      		or r24,r25
921
 946 075a 11F0      		breq .L102
922
 947 075c 1182      		std Z+1,__zero_reg__
923
 948 075e 1282      		std Z+2,__zero_reg__
924
 949               	.L102:
925
 950 0760 6150      		subi r22,lo8(-(-1))
926
 951 0762 4F5F      		subi r20,lo8(-(1))
927
 952 0764 5F4F      		sbci r21,hi8(-(1))
928
 953 0766 3896      		adiw r30,8
929
 954 0768 67FF      		sbrs r22,7
930
 955 076a E9CF      		rjmp .L104
931
 956 076c 1092 0000 		sts motor_write,__zero_reg__
932
 957               	.L105:
933
 958 0770 1092 0000 		sts twi_state,__zero_reg__
934
 959 0774 8091 0000 		lds r24,BLFlags
935
 960 0778 8E7F      		andi r24,lo8(-2)
936
 961 077a 8093 0000 		sts BLFlags,r24
937
 962 077e 85EA      		ldi r24,lo8(-91)
938
 963 0780 8093 BC00 		sts 188,r24
939
 964               	.L108:
940
 965 0784 8091 0000 		lds r24,BLFlags
941
 966 0788 80FD      		sbrc r24,0
942
 967 078a 05C0      		rjmp .L109
943
 968 078c CE01      		movw r24,r28
944
 969 078e 0E94 0000 		call CheckDelay
945
 970 0792 8823      		tst r24
946
 971 0794 B9F3      		breq .L108
947
 972               	.L109:
948
 973 0796 8091 0000 		lds r24,BLConfig_WriteMask
949
 974 079a 9091 0000 		lds r25,(BLConfig_WriteMask)+1
950
 975 079e 892B      		or r24,r25
951
 976 07a0 29F0      		breq .L106
952
 977 07a2 CE01      		movw r24,r28
953
 978 07a4 0E94 0000 		call CheckDelay
954
 979 07a8 8823      		tst r24
955
 980 07aa 11F3      		breq .L105
956
 981               	.L106:
957
 982 07ac 8091 0000 		lds r24,BLConfig_WriteMask
958
 983 07b0 9091 0000 		lds r25,(BLConfig_WriteMask)+1
959
 984 07b4 0097      		sbiw r24,0
960
 985 07b6 11F0      		breq .L86
961
 986               	.L115:
962
 987 07b8 82E0      		ldi r24,lo8(2)
963
 988 07ba 90E0      		ldi r25,hi8(2)
964
 989               	.L86:
965
 990               	/* epilogue: frame size=0 */
966
 991 07bc DF91      		pop r29
967
 992 07be CF91      		pop r28
968
 993 07c0 1F91      		pop r17
969
 994 07c2 0895      		ret
970
 995               	/* epilogue end (size=4) */
971
 996               	/* function I2C_WriteBLConfig size 172 (165) */
972
 998               	.global	I2C_ReadBLConfig
973
 1000               	I2C_ReadBLConfig:
974
 1001               	/* prologue: frame size=0 */
975
 1002 07c4 0F93      		push r16
976
 1003 07c6 1F93      		push r17
977
 1004 07c8 CF93      		push r28
978
 1005 07ca DF93      		push r29
979
 1006               	/* prologue end (size=4) */
980
 1007 07cc 982F      		mov r25,r24
981
 1008 07ce 8091 0000 		lds r24,MotorenEin
982
 1009 07d2 8823      		tst r24
983
 1010 07d4 21F4      		brne .L118
984
 1011 07d6 8091 0000 		lds r24,PC_MotortestActive
985
 1012 07da 8823      		tst r24
986
 1013 07dc 19F0      		breq .L117
987
 1014               	.L118:
988
 1015 07de 81E0      		ldi r24,lo8(1)
989
 1016 07e0 90E0      		ldi r25,hi8(1)
990
 1017 07e2 92C0      		rjmp .L116
991
 1018               	.L117:
992
 1019 07e4 9D30      		cpi r25,lo8(13)
993
 1020 07e6 A0F4      		brsh .L141
994
 1021 07e8 9923      		tst r25
995
 1022 07ea 19F4      		brne .L120
996
 1023 07ec 86E0      		ldi r24,lo8(6)
997
 1024 07ee 90E0      		ldi r25,hi8(6)
998
 1025 07f0 8BC0      		rjmp .L116
999
 1026               	.L120:
1000
 1027 07f2 C92F      		mov r28,r25
1001
 1028 07f4 DD27      		clr r29
1002
 1029 07f6 FE01      		movw r30,r28
1003
 1030 07f8 33E0      		ldi r19,3
1004
 1031 07fa EE0F      	1:	lsl r30
1005
 1032 07fc FF1F      		rol r31
1006
 1033 07fe 3A95      		dec r19
1007
 1034 0800 E1F7      		brne 1b
1008
 1035 0802 E050      		subi r30,lo8(-(Motor))
1009
 1036 0804 F040      		sbci r31,hi8(-(Motor))
1010
 1037 0806 3597      		sbiw r30,5
1011
 1038 0808 8081      		ld r24,Z
1012
 1039 080a 3596      		adiw r30,5
1013
 1040 080c 87FD      		sbrc r24,7
1014
 1041 080e 03C0      		rjmp .L121
1015
 1042               	.L141:
1016
 1043 0810 82E0      		ldi r24,lo8(2)
1017
 1044 0812 90E0      		ldi r25,hi8(2)
1018
 1045 0814 79C0      		rjmp .L116
1019
 1046               	.L121:
1020
 1047 0816 3897      		sbiw r30,8
1021
 1048 0818 8081      		ld r24,Z
1022
 1049 081a 80FD      		sbrc r24,0
1023
 1050 081c 03C0      		rjmp .L122
1024
 1051 081e 83E0      		ldi r24,lo8(3)
1025
 1052 0820 90E0      		ldi r25,hi8(3)
1026
 1053 0822 72C0      		rjmp .L116
1027
 1054               	.L122:
1028
 1055 0824 80ED      		ldi r24,lo8(2000)
1029
 1056 0826 97E0      		ldi r25,hi8(2000)
1030
 1057 0828 0E94 0000 		call SetDelay
1031
 1058 082c 8C01      		movw r16,r24
1032
 1059               	.L123:
1033
 1060 082e 8091 0000 		lds r24,BLFlags
1034
 1061 0832 80FD      		sbrc r24,0
1035
 1062 0834 05C0      		rjmp .L124
1036
 1063 0836 C801      		movw r24,r16
1037
 1064 0838 0E94 0000 		call CheckDelay
1038
 1065 083c 8823      		tst r24
1039
 1066 083e B9F3      		breq .L123
1040
 1067               	.L124:
1041
 1068 0840 2197      		sbiw r28,1
1042
 1069 0842 21E0      		ldi r18,lo8(1)
1043
 1070 0844 30E0      		ldi r19,hi8(1)
1044
 1071 0846 C901      		movw r24,r18
1045
 1072 0848 02C0      		rjmp 2f
1046
 1073 084a 880F      	1:	lsl r24
1047
 1074 084c 991F      		rol r25
1048
 1075 084e CA95      	2:	dec r28
1049
 1076 0850 E2F7      		brpl 1b
1050
 1077 0852 9093 0000 		sts (BLConfig_ReadMask)+1,r25
1051
 1078 0856 8093 0000 		sts BLConfig_ReadMask,r24
1052
 1079 085a D901      		movw r26,r18
1053
 1080 085c E0E0      		ldi r30,lo8(Motor)
1054
 1081 085e F0E0      		ldi r31,hi8(Motor)
1055
 1082 0860 40E0      		ldi r20,lo8(0)
1056
 1083 0862 50E0      		ldi r21,hi8(0)
1057
 1084 0864 6BE0      		ldi r22,lo8(11)
1058
 1085               	.L130:
1059
 1086 0866 CD01      		movw r24,r26
1060
 1087 0868 042E      		mov r0,r20
1061
 1088 086a 02C0      		rjmp 2f
1062
 1089 086c 880F      	1:	lsl r24
1063
 1090 086e 991F      		rol r25
1064
 1091 0870 0A94      	2:	dec r0
1065
 1092 0872 E2F7      		brpl 1b
1066
 1093 0874 2091 0000 		lds r18,BLConfig_ReadMask
1067
 1094 0878 3091 0000 		lds r19,(BLConfig_ReadMask)+1
1068
 1095 087c 8223      		and r24,r18
1069
 1096 087e 9323      		and r25,r19
1070
 1097 0880 892B      		or r24,r25
1071
 1098 0882 11F0      		breq .L128
1072
 1099 0884 1182      		std Z+1,__zero_reg__
1073
 1100 0886 1282      		std Z+2,__zero_reg__
1074
 1101               	.L128:
1075
 1102 0888 6150      		subi r22,lo8(-(-1))
1076
 1103 088a 4F5F      		subi r20,lo8(-(1))
1077
 1104 088c 5F4F      		sbci r21,hi8(-(1))
1078
 1105 088e 3896      		adiw r30,8
1079
 1106 0890 67FF      		sbrs r22,7
1080
 1107 0892 E9CF      		rjmp .L130
1081
 1108 0894 1092 0000 		sts motor_read,__zero_reg__
1082
 1109 0898 1092 0000 		sts BLConfig,__zero_reg__
1083
 1110 089c 1092 0000 		sts BLConfig+7,__zero_reg__
1084
 1111               	.L131:
1085
 1112 08a0 1092 0000 		sts twi_state,__zero_reg__
1086
 1113 08a4 8091 0000 		lds r24,BLFlags
1087
 1114 08a8 8E7F      		andi r24,lo8(-2)
1088
 1115 08aa 8093 0000 		sts BLFlags,r24
1089
 1116 08ae 85EA      		ldi r24,lo8(-91)
1090
 1117 08b0 8093 BC00 		sts 188,r24
1091
 1118               	.L134:
1092
 1119 08b4 8091 0000 		lds r24,BLFlags
1093
 1120 08b8 80FD      		sbrc r24,0
1094
 1121 08ba 05C0      		rjmp .L135
1095
 1122 08bc C801      		movw r24,r16
1096
 1123 08be 0E94 0000 		call CheckDelay
1097
 1124 08c2 8823      		tst r24
1098
 1125 08c4 B9F3      		breq .L134
1099
 1126               	.L135:
1100
 1127 08c6 8091 0000 		lds r24,BLConfig_ReadMask
1101
 1128 08ca 9091 0000 		lds r25,(BLConfig_ReadMask)+1
1102
 1129 08ce 892B      		or r24,r25
1103
 1130 08d0 29F0      		breq .L132
1104
 1131 08d2 C801      		movw r24,r16
1105
 1132 08d4 0E94 0000 		call CheckDelay
1106
 1133 08d8 8823      		tst r24
1107
 1134 08da 11F3      		breq .L131
1108
 1135               	.L132:
1109
 1136 08dc 8091 0000 		lds r24,BLConfig
1110
 1137 08e0 8230      		cpi r24,lo8(2)
1111
 1138 08e2 19F0      		breq .L137
1112
 1139 08e4 84E0      		ldi r24,lo8(4)
1113
 1140 08e6 90E0      		ldi r25,hi8(4)
1114
 1141 08e8 0FC0      		rjmp .L116
1115
 1142               	.L137:
1116
 1143 08ea 67E0      		ldi r22,lo8(7)
1117
 1144 08ec 70E0      		ldi r23,hi8(7)
1118
 1145 08ee 80E0      		ldi r24,lo8(BLConfig)
1119
 1146 08f0 90E0      		ldi r25,hi8(BLConfig)
1120
 1147 08f2 0E94 0000 		call RAM_Checksum
1121
 1148 08f6 9091 0000 		lds r25,BLConfig+7
1122
 1149 08fa 8917      		cp r24,r25
1123
 1150 08fc 19F0      		breq .L138
1124
 1151 08fe 85E0      		ldi r24,lo8(5)
1125
 1152 0900 90E0      		ldi r25,hi8(5)
1126
 1153 0902 02C0      		rjmp .L116
1127
 1154               	.L138:
1128
 1155 0904 80E0      		ldi r24,lo8(0)
1129
 1156 0906 90E0      		ldi r25,hi8(0)
1130
 1157               	.L116:
1131
 1158               	/* epilogue: frame size=0 */
1132
 1159 0908 DF91      		pop r29
1133
 1160 090a CF91      		pop r28
1134
 1161 090c 1F91      		pop r17
1135
 1162 090e 0F91      		pop r16
1136
 1163 0910 0895      		ret
1137
 1164               	/* epilogue end (size=5) */
1138
 1165               	/* function I2C_ReadBLConfig size 168 (159) */
1139
 1167               		.comm Motor,96,1
1140
 1168               		.comm BLConfig,8,1
1141
 1169               	/* File "twimaster.c": code 1193 = 0x04a9 (1149), prologues  20, epilogues  24 */
1142
DEFINED SYMBOLS
1143
                            *ABS*:00000000 twimaster.c
1144
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:3      *ABS*:0000003f __SREG__
1145
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:4      *ABS*:0000003e __SP_H__
1146
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:5      *ABS*:0000003d __SP_L__
1147
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:6      *ABS*:00000000 __tmp_reg__
1148
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:7      *ABS*:00000001 __zero_reg__
1149
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:15     .bss:00000000 BLConfig_ReadMask
1150
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:21     .bss:00000002 BLConfig_WriteMask
1151
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:27     .bss:00000004 BLFlags
1152
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:33     .bss:00000005 MissingMotor
1153
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:39     .data:00000000 I2CTimeout
1154
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:46     .bss:00000006 motor_read
1155
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:52     .bss:00000007 motor_write
1156
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:58     .bss:00000008 dac_channel
1157
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:64     .bss:00000009 twi_state
1158
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:69     .text:00000000 I2C_Init
1159
                            *COM*:00000060 Motor
1160
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:113    .text:0000004c I2C_Reset
1161
                             .bss:0000000a missing_motor.0
1162
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:140    .bss:0000000b motor_read_temperature.1
1163
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:141    .bss:0000000c pBuff.2
1164
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:142    .bss:0000000e BuffLen.3
1165
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:146    .text:00000092 __vector_26
1166
                            *COM*:00000008 BLConfig
1167
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:828    .text:00000670 I2C_WriteBLConfig
1168
C:\Users\Arthur-P\AppData\Local\Temp/cciecaaa.s:1000   .text:000007c4 I2C_ReadBLConfig
1169
 
1170
UNDEFINED SYMBOLS
1171
__do_copy_data
1172
__do_clear_bss
1173
__tablejump2__
1174
Mixer
1175
RequiredMotors
1176
FCFlags
1177
AnalogOffsetNick
1178
AnalogOffsetRoll
1179
AnalogOffsetGier
1180
MotorenEin
1181
PC_MotortestActive
1182
RAM_Checksum
1183
SetDelay
1184
CheckDelay