Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 7cfdb622e6
Fetching contributors…

Cannot retrieve contributors at this time

17772 lines (16946 sloc) 672.349 kB
bin/Debug/WSBFlightComputer: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 000001d8 00800100 00007488 0000753c 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00007488 00000000 00000000 000000b4 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 000001b4 008002d8 008002d8 00007714 2**0
ALLOC
3 .eeprom 00000081 00810000 00810000 00007714 2**0
CONTENTS, ALLOC, LOAD, DATA
4 .stab 00007188 00000000 00000000 00007798 2**2
CONTENTS, READONLY, DEBUGGING
5 .stabstr 0000193a 00000000 00000000 0000e920 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_aranges 00000140 00000000 00000000 0001025a 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_pubnames 00000c4b 00000000 00000000 0001039a 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_info 00004611 00000000 00000000 00010fe5 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_abbrev 00000f64 00000000 00000000 000155f6 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_line 0000390b 00000000 00000000 0001655a 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_frame 000005a0 00000000 00000000 00019e68 2**2
CONTENTS, READONLY, DEBUGGING
12 .debug_str 00001244 00000000 00000000 0001a408 2**0
CONTENTS, READONLY, DEBUGGING
13 .debug_loc 00002294 00000000 00000000 0001b64c 2**0
CONTENTS, READONLY, DEBUGGING
14 .debug_ranges 00000330 00000000 00000000 0001d8e0 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 e1 02 jmp 0x5c2 ; 0x5c2 <__ctors_end>
4: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
8: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
c: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
10: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
14: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
18: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
1c: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
20: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
24: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
28: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
2c: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
30: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
34: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
38: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
3c: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
40: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
44: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
48: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
4c: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
50: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
54: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
58: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
5c: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
60: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
64: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
68: 0c 94 6a 0d jmp 0x1ad4 ; 0x1ad4 <__vector_26>
6c: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
70: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
74: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
78: 0c 94 fe 02 jmp 0x5fc ; 0x5fc <__bad_interrupt>
0000007c <bitmaskTypeOrder>:
7c: 20 10 10 08 21 21 10 08 21 21 08 60 21 60 21 40 ...!!..!!.`!`!@
8c: 10 30 10 30 08 22 22 08 30 21 30 21 21 10 08 10 .0.0."".0!0!!...
9c: 10 10 10 ...
0000009f <__c.1879>:
9f: 4c 42 20 53 3a 20 25 64 20 45 3a 20 25 64 0a 00 LB S: %d E: %d..
000000af <__c.1872>:
af: 4c 42 0a 00 LB..
000000b3 <__c.2419>:
b3: 25 6c 64 2c 25 6c 64 2c 25 6c 64 2c 25 64 2c 25 %ld,%ld,%ld,%d,%
c3: 64 2c 25 64 2c 25 64 2c 25 64 2c 25 64 2c 25 64 d,%d,%d,%d,%d,%d
d3: 2c 25 64 2c 25 64 2c 25 73 2c 25 66 2c 25 73 2c ,%d,%d,%s,%f,%s,
e3: 25 66 2c 25 73 2c 25 64 2c 25 73 2c 25 64 2c 25 %f,%s,%d,%s,%d,%
f3: 73 2c 25 64 2c 25 64 2c 25 64 2c 25 64 2c 25 73 s,%d,%d,%d,%d,%s
103: 2c 25 64 2c 25 73 2c 25 64 2c 25 64 2c 25 64 2c ,%d,%s,%d,%d,%d,
113: 25 64 2c 25 64 2c 25 64 2c 25 64 2c 25 64 2c 00 %d,%d,%d,%d,%d,.
00000123 <__c.2279>:
123: 43 42 4d 31 0a 00 CBM1..
00000129 <__c.2273>:
129: 43 42 4d 31 0a 00 CBM1..
0000012f <__c.2232>:
12f: 65 70 4c 6f 63 3a 20 25 64 0a 00 epLoc: %d..
0000013a <__c.2230>:
13a: 74 65 6c 65 6d 65 74 72 79 53 70 65 65 64 44 69 telemetrySpeedDi
14a: 61 6c 3a 20 25 64 0a 00 al: %d..
00000152 <__c.2228>:
152: 25 6c 78 0a 00 %lx..
00000157 <__c.2226>:
157: 25 6c 78 20 00 %lx .
0000015c <__c.2224>:
15c: 54 65 6c 65 6d 42 69 74 6d 61 70 3a 20 25 6c 78 TelemBitmap: %lx
16c: 20 00 .
0000016e <__c.2222>:
16e: 50 68 61 73 65 3a 20 25 64 0a 00 Phase: %d..
00000179 <__c.2220>:
179: 63 6f 6d 6d 4d 6f 64 75 6c 65 52 65 73 65 74 43 commModuleResetC
189: 6f 75 6e 74 3a 20 25 64 0a 00 ount: %d..
00000193 <__c.2218>:
193: 66 6c 69 67 68 74 43 6f 6d 70 75 74 65 72 52 65 flightComputerRe
1a3: 73 65 74 43 6f 75 6e 74 3a 20 25 64 0a 00 setCount: %d..
000001b1 <__c.2216>:
1b1: 63 6f 6d 6d 45 45 50 52 4f 4d 45 6e 64 3a 20 25 commEEPROMEnd: %
1c1: 64 0a 00 d..
000001c4 <__c.2214>:
1c4: 63 6f 6d 6d 45 45 50 52 4f 4d 53 74 61 72 74 3a commEEPROMStart:
1d4: 20 25 64 0a 00 %d..
000001d9 <__c.2212>:
1d9: 62 61 74 63 68 53 61 6d 70 6c 65 45 6e 64 3a 20 batchSampleEnd:
1e9: 25 64 0a 00 %d..
000001ed <__c.2210>:
1ed: 62 61 74 63 68 53 61 6d 70 6c 65 53 74 61 72 74 batchSampleStart
1fd: 3a 20 25 64 0a 00 : %d..
00000203 <__c.2208>:
203: 63 75 72 42 61 74 63 68 4e 75 6d 62 65 72 3a 20 curBatchNumber:
213: 25 64 0a 00 %d..
00000217 <__c.2206>:
217: 65 70 6f 63 68 4f 66 4c 61 73 74 42 61 74 63 68 epochOfLastBatch
227: 54 58 3a 20 25 6c 64 0a 00 TX: %ld..
00000230 <__c.2204>:
230: 48 46 72 61 70 69 64 58 6d 69 74 49 6e 74 65 72 HFrapidXmitInter
240: 76 61 6c 3a 20 25 64 0a 00 val: %d..
00000249 <__c.2202>:
249: 48 46 64 61 74 61 58 6d 69 74 49 6e 74 65 72 76 HFdataXmitInterv
259: 61 6c 3a 20 25 64 0a 00 al: %d..
00000261 <__c.2200>:
261: 73 68 6f 72 74 54 58 49 6e 74 65 72 76 61 6c 3a shortTXInterval:
271: 20 25 64 0a 00 %d..
00000276 <__c.2198>:
276: 62 61 74 63 68 54 58 49 6e 74 65 72 76 61 6c 3a batchTXInterval:
286: 20 25 64 0a 00 %d..
0000028b <__c.2196>:
28b: 64 61 74 61 53 61 6d 70 6c 65 49 6e 74 65 72 76 dataSampleInterv
29b: 61 6c 3a 20 25 64 0a 00 al: %d..
000002a3 <__c.2194>:
2a3: 62 61 74 74 65 72 79 48 65 61 74 65 72 53 65 74 batteryHeaterSet
2b3: 3a 20 25 64 0a 00 : %d..
000002b9 <__c.2192>:
2b9: 6d 61 78 41 6c 6c 6f 77 65 64 54 58 49 6e 74 65 maxAllowedTXInte
2c9: 72 76 61 6c 3a 20 25 64 0a 00 rval: %d..
000002d3 <__c.2190>:
2d3: 61 75 74 6f 42 61 6c 6c 61 73 74 20 64 73 62 6c autoBallast dsbl
2e3: 65 64 3f 3a 20 25 64 0a 00 ed?: %d..
000002ec <__c.2187>:
2ec: 62 61 6c 6c 61 73 74 53 66 74 79 41 6c 74 3a 20 ballastSftyAlt:
2fc: 25 64 0a 00 %d..
00000300 <__c.2172>:
300: 45 72 72 6f 72 20 52 65 61 64 69 6e 67 20 42 61 Error Reading Ba
310: 74 74 65 72 79 20 54 65 6d 70 0a 00 ttery Temp..
0000031c <__c.2170>:
31c: 42 61 74 74 3a 20 52 61 77 3a 20 25 78 20 43 61 Batt: Raw: %x Ca
32c: 6c 63 3a 20 25 64 0a 00 lc: %d..
00000334 <__c.2168>:
334: 45 72 72 6f 72 20 52 65 61 64 69 6e 67 20 45 78 Error Reading Ex
344: 74 65 72 6e 61 6c 20 54 65 6d 70 0a 00 ternal Temp..
00000351 <__c.2166>:
351: 45 78 74 3a 20 52 61 77 3a 20 25 78 20 43 61 6c Ext: Raw: %x Cal
361: 63 3a 20 25 64 0a 00 c: %d..
00000368 <__c.2164>:
368: 45 72 72 6f 72 20 52 65 61 64 69 6e 67 20 46 43 Error Reading FC
378: 20 54 65 6d 70 0a 00 Temp..
0000037f <__c.2162>:
37f: 46 43 3a 20 52 61 77 3a 20 25 78 20 43 61 6c 63 FC: Raw: %x Calc
38f: 3a 20 25 64 0a 00 : %d..
00000395 <__c.2147>:
395: 42 4d 50 20 50 3a 20 25 6c 64 0a 00 BMP P: %ld..
000003a1 <__c.2145>:
3a1: 42 4d 50 20 54 3a 20 25 6c 64 0a 00 BMP T: %ld..
000003ad <__c.2133>:
3ad: 74 75 72 6e 65 64 20 62 61 6c 6c 61 73 74 20 6f turned ballast o
3bd: 6e 2e 0a 00 n...
000003c1 <__c.2126>:
3c1: 74 65 73 74 69 6e 67 20 62 61 6c 6c 61 73 74 0a testing ballast.
...
000003d2 <__c.2051>:
3d2: 62 70 74 72 20 25 70 0a 00 bptr %p..
000003db <__c.2049>:
3db: 62 64 69 73 0a 00 bdis..
000003e1 <__c.2037>:
3e1: 45 72 72 6f 72 20 53 65 74 74 69 6e 67 20 74 68 Error Setting th
3f1: 65 72 6d 6f 6d 65 74 65 72 0a 00 ermometer..
000003fc <__c.1834>:
3fc: 43 68 65 63 6b 73 75 6d 20 56 61 6c 69 64 0a 00 Checksum Valid..
0000040c <__c.1828>:
40c: 43 53 3a 20 25 78 20 54 43 53 3a 20 25 78 0a 00 CS: %x TCS: %x..
0000041c <__c.1817>:
41c: 43 68 65 63 6b 73 75 6d 20 56 61 6c 69 64 0a 00 Checksum Valid..
0000042c <__c.1811>:
42c: 43 53 3a 20 25 78 20 54 43 53 3a 20 25 78 0a 00 CS: %x TCS: %x..
0000043c <__c.1800>:
43c: 43 68 65 63 6b 73 75 6d 20 56 61 6c 69 64 0a 00 Checksum Valid..
0000044c <__c.1794>:
44c: 43 53 3a 20 25 78 20 54 43 53 3a 20 25 78 0a 00 CS: %x TCS: %x..
0000045c <__c.1780>:
45c: 49 6e 20 55 72 20 47 50 53 20 44 65 62 75 67 0a In Ur GPS Debug.
...
0000046d <__c.1648>:
46d: 45 52 52 0a 00 ERR..
00000472 <__c.1790>:
472: 6e 61 6e 00 nan.
00000476 <__c.1788>:
476: 69 6e 66 00 inf.
0000047a <__c.2085>:
47a: 63 64 69 6e 6f 70 73 75 78 58 5b 65 66 67 45 46 cdinopsuxX[efgEF
48a: 47 00 G.
0000048c <pstr_an>:
48c: 61 6e 00 an.
0000048f <pstr_nfinity>:
48f: 6e 66 69 6e 69 74 79 00 nfinity.
00000497 <pwr_m10>:
497: cd cc cc 3d 0a d7 23 3c 17 b7 d1 38 77 cc 2b 32 ...=..#<...8w.+2
4a7: 95 95 e6 24 1f b1 4f 0a ...$..O.
000004af <pwr_p10>:
4af: 00 00 20 41 00 00 c8 42 00 40 1c 46 20 bc be 4c .. A...B.@.F ..L
4bf: ca 1b 0e 5a ae c5 9d 74 00 40 7a 10 f3 5a 00 a0 ...Z...t.@z..Z..
4cf: 72 4e 18 09 00 10 a5 d4 e8 00 00 e8 76 48 17 00 rN..........vH..
4df: 00 e4 0b 54 02 00 00 ca 9a 3b 00 00 00 e1 f5 05 ...T.....;......
4ef: 00 00 80 96 98 00 00 00 40 42 0f 00 00 00 a0 86 ........@B......
4ff: 01 00 00 00 10 27 00 00 00 00 e8 03 00 00 00 00 .....'..........
50f: 64 00 00 00 00 00 0a 00 00 00 00 00 01 00 00 00 d...............
51f: 00 00 2c 76 d8 88 dc 67 4f 08 23 df c1 df ae 59 ..,v...gO.#....Y
52f: e1 b1 b7 96 e5 e3 e4 53 c6 3a e6 51 99 76 96 e8 .......S.:.Q.v..
53f: e6 c2 84 26 eb 89 8c 9b 62 ed 40 7c 6f fc ef bc ...&....b.@|o...
54f: 9c 9f 40 f2 ba a5 6f a5 f4 90 05 5a 2a f7 5c 93 ..@...o....Z*.\.
55f: 6b 6c f9 67 6d c1 1b fc e0 e4 0d 47 fe f5 20 e6 kl.gm......G.. .
56f: b5 00 d0 ed 90 2e 03 00 94 35 77 05 00 80 84 1e .........5w.....
57f: 08 00 00 20 4e 0a 00 00 00 c8 0c 33 33 33 33 0f ... N......3333.
58f: 98 6e 12 83 11 41 ef 8d 21 14 89 3b e6 55 16 cf .n...A..!..;.U..
59f: fe e6 db 18 d1 84 4b 38 1b f7 7c 1d 90 1d a4 bb ......K8..|.....
5af: e4 24 20 32 84 72 5e 22 81 00 c9 f1 24 ec a1 e5 .$ 2.r^"....$...
5bf: 3d 27 00 ='.
000005c2 <__ctors_end>:
5c2: 11 24 eor r1, r1
5c4: 1f be out 0x3f, r1 ; 63
5c6: cf ef ldi r28, 0xFF ; 255
5c8: d8 e0 ldi r29, 0x08 ; 8
5ca: de bf out 0x3e, r29 ; 62
5cc: cd bf out 0x3d, r28 ; 61
000005ce <__do_copy_data>:
5ce: 12 e0 ldi r17, 0x02 ; 2
5d0: a0 e0 ldi r26, 0x00 ; 0
5d2: b1 e0 ldi r27, 0x01 ; 1
5d4: e8 e8 ldi r30, 0x88 ; 136
5d6: f4 e7 ldi r31, 0x74 ; 116
5d8: 02 c0 rjmp .+4 ; 0x5de <.do_copy_data_start>
000005da <.do_copy_data_loop>:
5da: 05 90 lpm r0, Z+
5dc: 0d 92 st X+, r0
000005de <.do_copy_data_start>:
5de: a8 3d cpi r26, 0xD8 ; 216
5e0: b1 07 cpc r27, r17
5e2: d9 f7 brne .-10 ; 0x5da <.do_copy_data_loop>
000005e4 <__do_clear_bss>:
5e4: 14 e0 ldi r17, 0x04 ; 4
5e6: a8 ed ldi r26, 0xD8 ; 216
5e8: b2 e0 ldi r27, 0x02 ; 2
5ea: 01 c0 rjmp .+2 ; 0x5ee <.do_clear_bss_start>
000005ec <.do_clear_bss_loop>:
5ec: 1d 92 st X+, r1
000005ee <.do_clear_bss_start>:
5ee: ac 38 cpi r26, 0x8C ; 140
5f0: b1 07 cpc r27, r17
5f2: e1 f7 brne .-8 ; 0x5ec <.do_clear_bss_loop>
5f4: 0e 94 a9 23 call 0x4752 ; 0x4752 <main>
5f8: 0c 94 42 3a jmp 0x7484 ; 0x7484 <_exit>
000005fc <__bad_interrupt>:
5fc: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
00000600 <memrcpy>:
eeprom_write_word(&EEcommPromEnd, commPromEnd);
eeprom_write_word(&EEcommPromStart, commPromStart);
}
void memrcpy(void *dst, const void *src, size_t len)
{
600: dc 01 movw r26, r24
602: a4 0f add r26, r20
604: b5 1f adc r27, r21
606: 20 e0 ldi r18, 0x00 ; 0
608: 30 e0 ldi r19, 0x00 ; 0
60a: 07 c0 rjmp .+14 ; 0x61a <memrcpy+0x1a>
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
{
d[len-1-i] = s[i];
60c: fb 01 movw r30, r22
60e: e2 0f add r30, r18
610: f3 1f adc r31, r19
612: 80 81 ld r24, Z
614: 8c 93 st X, r24
{
size_t i;
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
616: 2f 5f subi r18, 0xFF ; 255
618: 3f 4f sbci r19, 0xFF ; 255
61a: 11 97 sbiw r26, 0x01 ; 1
61c: 24 17 cp r18, r20
61e: 35 07 cpc r19, r21
620: a8 f3 brcs .-22 ; 0x60c <memrcpy+0xc>
{
d[len-1-i] = s[i];
}
}
622: 08 95 ret
00000624 <flushSatQueue>:
eeprom_write_word(&EEcommPromEnd, commPromEnd);
}
void flushSatQueue(void)
{
624: cf 93 push r28
626: df 93 push r29
uint16_t commPromEnd = eeprom_read_word(&EEcommPromEnd);
628: 80 e3 ldi r24, 0x30 ; 48
62a: 90 e0 ldi r25, 0x00 ; 0
62c: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
630: bc 01 movw r22, r24
uint16_t commPromStart = eeprom_read_word(&EEcommPromStart);
//Send A message to comm module(CommEEPROMstart, CommEEPROMEnd)
if(COMMPROMSIZE - commPromEnd < 1024)
632: 9c 01 movw r18, r24
634: 40 e0 ldi r20, 0x00 ; 0
636: 50 e0 ldi r21, 0x00 ; 0
638: 80 e0 ldi r24, 0x00 ; 0
63a: 90 e8 ldi r25, 0x80 ; 128
63c: a0 e0 ldi r26, 0x00 ; 0
63e: b0 e0 ldi r27, 0x00 ; 0
640: 82 1b sub r24, r18
642: 93 0b sbc r25, r19
644: a4 0b sbc r26, r20
646: b5 0b sbc r27, r21
648: 80 50 subi r24, 0x00 ; 0
64a: 94 40 sbci r25, 0x04 ; 4
64c: a0 40 sbci r26, 0x00 ; 0
64e: b0 40 sbci r27, 0x00 ; 0
650: 14 f0 brlt .+4 ; 0x656 <flushSatQueue+0x32>
652: eb 01 movw r28, r22
654: 04 c0 rjmp .+8 ; 0x65e <flushSatQueue+0x3a>
656: 60 e0 ldi r22, 0x00 ; 0
658: 70 e0 ldi r23, 0x00 ; 0
65a: c0 e0 ldi r28, 0x00 ; 0
65c: d0 e0 ldi r29, 0x00 ; 0
commPromStart = commPromEnd = 0;
else
commPromStart = commPromEnd;
eeprom_write_word(&EEcommPromEnd, commPromEnd);
65e: 80 e3 ldi r24, 0x30 ; 48
660: 90 e0 ldi r25, 0x00 ; 0
662: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEcommPromStart, commPromStart);
666: 8e e2 ldi r24, 0x2E ; 46
668: 90 e0 ldi r25, 0x00 ; 0
66a: be 01 movw r22, r28
66c: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
}
670: df 91 pop r29
672: cf 91 pop r28
674: 08 95 ret
00000676 <getTxSample>:
extern int lprintf(char *, ...);
extern int lprintf_P(const char *str, ...);
extern uint16_t EEMEM EEcurrentTelemetryVersion;
uint16_t getTxSample(uint8_t *output, uint32_t *bitmask, uint16_t sampleNumber, uint16_t batch)
{
676: 2f 92 push r2
678: 3f 92 push r3
67a: 4f 92 push r4
67c: 5f 92 push r5
67e: 6f 92 push r6
680: 7f 92 push r7
682: 8f 92 push r8
684: 9f 92 push r9
686: af 92 push r10
688: bf 92 push r11
68a: cf 92 push r12
68c: df 92 push r13
68e: ef 92 push r14
690: ff 92 push r15
692: 0f 93 push r16
694: 1f 93 push r17
696: df 93 push r29
698: cf 93 push r28
69a: cd b7 in r28, 0x3d ; 61
69c: de b7 in r29, 0x3e ; 62
69e: c6 50 subi r28, 0x06 ; 6
6a0: d1 40 sbci r29, 0x01 ; 1
6a2: 0f b6 in r0, 0x3f ; 63
6a4: f8 94 cli
6a6: de bf out 0x3e, r29 ; 62
6a8: 0f be out 0x3f, r0 ; 63
6aa: cd bf out 0x3d, r28 ; 61
6ac: 5c 01 movw r10, r24
6ae: 4b 01 movw r8, r22
6b0: 3a 01 movw r6, r20
6b2: 19 01 movw r2, r18
6b4: cc 24 eor r12, r12
6b6: dd 24 eor r13, r13
r <<= 1;
r |= v & 1;
s--;
}
r <<= s; // shift when v's highest bits are zero
reversedBitmask[i] = r;
6b8: 4f e0 ldi r20, 0x0F ; 15
6ba: 44 2e mov r4, r20
6bc: 51 2c mov r5, r1
6be: 4c 0e add r4, r28
6c0: 5d 1e adc r5, r29
//uint32_t v; // input bits to be reversed
//uint32_t r = v; // r will be reversed bits of v; first get LSB of v
for(int i=0; i < 3; i++)
{
uint32_t v = bitmask[i];
6c2: f4 01 movw r30, r8
6c4: ec 0d add r30, r12
6c6: fd 1d adc r31, r13
6c8: 80 81 ld r24, Z
6ca: 91 81 ldd r25, Z+1 ; 0x01
6cc: a2 81 ldd r26, Z+2 ; 0x02
6ce: b3 81 ldd r27, Z+3 ; 0x03
uint32_t r = v;
int s = sizeof(v) * 8 - 1; // extra shift needed at end
for (v >>= 1; v; v >>= 1)
6d0: 7c 01 movw r14, r24
6d2: 8d 01 movw r16, r26
6d4: 16 95 lsr r17
6d6: 07 95 ror r16
6d8: f7 94 ror r15
6da: e7 94 ror r14
6dc: 9c 01 movw r18, r24
6de: ad 01 movw r20, r26
6e0: 6f e1 ldi r22, 0x1F ; 31
6e2: 70 e0 ldi r23, 0x00 ; 0
6e4: 16 c0 rjmp .+44 ; 0x712 <getTxSample+0x9c>
{
r <<= 1;
6e6: da 01 movw r26, r20
6e8: c9 01 movw r24, r18
6ea: 88 0f add r24, r24
6ec: 99 1f adc r25, r25
6ee: aa 1f adc r26, r26
6f0: bb 1f adc r27, r27
r |= v & 1;
6f2: a8 01 movw r20, r16
6f4: 97 01 movw r18, r14
6f6: 21 70 andi r18, 0x01 ; 1
6f8: 30 70 andi r19, 0x00 ; 0
6fa: 40 70 andi r20, 0x00 ; 0
6fc: 50 70 andi r21, 0x00 ; 0
6fe: 28 2b or r18, r24
700: 39 2b or r19, r25
702: 4a 2b or r20, r26
704: 5b 2b or r21, r27
s--;
706: 61 50 subi r22, 0x01 ; 1
708: 70 40 sbci r23, 0x00 ; 0
for(int i=0; i < 3; i++)
{
uint32_t v = bitmask[i];
uint32_t r = v;
int s = sizeof(v) * 8 - 1; // extra shift needed at end
for (v >>= 1; v; v >>= 1)
70a: 16 95 lsr r17
70c: 07 95 ror r16
70e: f7 94 ror r15
710: e7 94 ror r14
712: e1 14 cp r14, r1
714: f1 04 cpc r15, r1
716: 01 05 cpc r16, r1
718: 11 05 cpc r17, r1
71a: 29 f7 brne .-54 ; 0x6e6 <getTxSample+0x70>
r <<= 1;
r |= v & 1;
s--;
}
r <<= s; // shift when v's highest bits are zero
reversedBitmask[i] = r;
71c: f2 01 movw r30, r4
71e: ec 0d add r30, r12
720: fd 1d adc r31, r13
722: 04 c0 rjmp .+8 ; 0x72c <getTxSample+0xb6>
724: 22 0f add r18, r18
726: 33 1f adc r19, r19
728: 44 1f adc r20, r20
72a: 55 1f adc r21, r21
72c: 6a 95 dec r22
72e: d2 f7 brpl .-12 ; 0x724 <getTxSample+0xae>
730: 20 83 st Z, r18
732: 31 83 std Z+1, r19 ; 0x01
734: 42 83 std Z+2, r20 ; 0x02
736: 53 83 std Z+3, r21 ; 0x03
738: 84 e0 ldi r24, 0x04 ; 4
73a: 90 e0 ldi r25, 0x00 ; 0
73c: c8 0e add r12, r24
73e: d9 1e adc r13, r25
uint32_t reversedBitmask[3];
//uint32_t v; // input bits to be reversed
//uint32_t r = v; // r will be reversed bits of v; first get LSB of v
for(int i=0; i < 3; i++)
740: 9c e0 ldi r25, 0x0C ; 12
742: c9 16 cp r12, r25
744: d1 04 cpc r13, r1
746: 09 f0 breq .+2 ; 0x74a <getTxSample+0xd4>
748: bc cf rjmp .-136 ; 0x6c2 <getTxSample+0x4c>
lprintf("%lx ", reversedBitmask[1]);
lprintf("%lx\n", reversedBitmask[2]);*/
char sampleHolder[SAMPLESTRINGSIZEINCHARS+5];
memset(sampleHolder, 0, SAMPLESTRINGSIZEINCHARS+5);
74a: 8e 01 movw r16, r28
74c: 05 5e subi r16, 0xE5 ; 229
74e: 1f 4f sbci r17, 0xFF ; 255
750: 86 ee ldi r24, 0xE6 ; 230
752: d8 01 movw r26, r16
754: 1d 92 st X+, r1
756: 8a 95 dec r24
758: e9 f7 brne .-6 ; 0x754 <getTxSample+0xde>
getDataSample(sampleNumber, sampleHolder);
75a: c3 01 movw r24, r6
75c: b8 01 movw r22, r16
75e: 0e 94 06 10 call 0x200c ; 0x200c <getDataSample>
//Sample Retrieval words
#ifdef opdebug
lprintf("ISAMP: %d\n", sampleNumber);
762: 00 d0 rcall .+0 ; 0x764 <getTxSample+0xee>
764: 00 d0 rcall .+0 ; 0x766 <getTxSample+0xf0>
766: 80 e0 ldi r24, 0x00 ; 0
768: 91 e0 ldi r25, 0x01 ; 1
76a: ed b7 in r30, 0x3d ; 61
76c: fe b7 in r31, 0x3e ; 62
76e: 92 83 std Z+2, r25 ; 0x02
770: 81 83 std Z+1, r24 ; 0x01
772: 74 82 std Z+4, r7 ; 0x04
774: 63 82 std Z+3, r6 ; 0x03
776: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
77a: 0f 90 pop r0
77c: 0f 90 pop r0
77e: 0f 90 pop r0
780: 0f 90 pop r0
for(int i = 0; i < SAMPLESTRINGSIZEINCHARS; i++)
{
lprintf("%c", sampleHolder[i]);
782: 8b e0 ldi r24, 0x0B ; 11
784: c8 2e mov r12, r24
786: 81 e0 ldi r24, 0x01 ; 1
788: d8 2e mov r13, r24
memset(sampleHolder, 0, SAMPLESTRINGSIZEINCHARS+5);
getDataSample(sampleNumber, sampleHolder);
//Sample Retrieval words
#ifdef opdebug
lprintf("ISAMP: %d\n", sampleNumber);
for(int i = 0; i < SAMPLESTRINGSIZEINCHARS; i++)
78a: c8 01 movw r24, r16
78c: 70 2e mov r7, r16
78e: 69 2e mov r6, r25
790: bc ef ldi r27, 0xFC ; 252
792: eb 2e mov r14, r27
794: f1 2c mov r15, r1
796: ec 0e add r14, r28
798: fd 1e adc r15, r29
{
lprintf("%c", sampleHolder[i]);
79a: 00 d0 rcall .+0 ; 0x79c <getTxSample+0x126>
79c: 00 d0 rcall .+0 ; 0x79e <getTxSample+0x128>
79e: ed b7 in r30, 0x3d ; 61
7a0: fe b7 in r31, 0x3e ; 62
7a2: 31 96 adiw r30, 0x01 ; 1
7a4: ad b7 in r26, 0x3d ; 61
7a6: be b7 in r27, 0x3e ; 62
7a8: 12 96 adiw r26, 0x02 ; 2
7aa: dc 92 st X, r13
7ac: ce 92 st -X, r12
7ae: 11 97 sbiw r26, 0x01 ; 1
7b0: d8 01 movw r26, r16
7b2: 8d 91 ld r24, X+
7b4: 8d 01 movw r16, r26
7b6: 82 83 std Z+2, r24 ; 0x02
7b8: 13 82 std Z+3, r1 ; 0x03
7ba: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
memset(sampleHolder, 0, SAMPLESTRINGSIZEINCHARS+5);
getDataSample(sampleNumber, sampleHolder);
//Sample Retrieval words
#ifdef opdebug
lprintf("ISAMP: %d\n", sampleNumber);
for(int i = 0; i < SAMPLESTRINGSIZEINCHARS; i++)
7be: 0f 90 pop r0
7c0: 0f 90 pop r0
7c2: 0f 90 pop r0
7c4: 0f 90 pop r0
7c6: 0e 15 cp r16, r14
7c8: 1f 05 cpc r17, r15
7ca: 39 f7 brne .-50 ; 0x79a <getTxSample+0x124>
{
lprintf("%c", sampleHolder[i]);
}
lprintf("\n");
7cc: 00 d0 rcall .+0 ; 0x7ce <getTxSample+0x158>
7ce: 8e e0 ldi r24, 0x0E ; 14
7d0: 91 e0 ldi r25, 0x01 ; 1
7d2: ed b7 in r30, 0x3d ; 61
7d4: fe b7 in r31, 0x3e ; 62
7d6: 92 83 std Z+2, r25 ; 0x02
7d8: 81 83 std Z+1, r24 ; 0x01
7da: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
#endif
lprintf("done\n");
7de: 80 e1 ldi r24, 0x10 ; 16
7e0: 91 e0 ldi r25, 0x01 ; 1
7e2: ad b7 in r26, 0x3d ; 61
7e4: be b7 in r27, 0x3e ; 62
7e6: 12 96 adiw r26, 0x02 ; 2
7e8: 9c 93 st X, r25
7ea: 8e 93 st -X, r24
7ec: 11 97 sbiw r26, 0x01 ; 1
7ee: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
char *token;
//BEGIN SAMPLE PREAMBLE
//First token is epoch time:
token = strtok(sampleHolder, ",");
7f2: 0f 90 pop r0
7f4: 0f 90 pop r0
7f6: 87 2d mov r24, r7
7f8: 96 2d mov r25, r6
7fa: 66 e1 ldi r22, 0x16 ; 22
7fc: 71 e0 ldi r23, 0x01 ; 1
7fe: 0e 94 fc 37 call 0x6ff8 ; 0x6ff8 <strtok>
802: 8c 01 movw r16, r24
uint32_t epochSample;
sscanf(token, "%ld", &epochSample);
804: 00 d0 rcall .+0 ; 0x806 <getTxSample+0x190>
806: 00 d0 rcall .+0 ; 0x808 <getTxSample+0x192>
808: 00 d0 rcall .+0 ; 0x80a <getTxSample+0x194>
80a: ed b7 in r30, 0x3d ; 61
80c: fe b7 in r31, 0x3e ; 62
80e: 31 96 adiw r30, 0x01 ; 1
810: ad b7 in r26, 0x3d ; 61
812: be b7 in r27, 0x3e ; 62
814: 12 96 adiw r26, 0x02 ; 2
816: 9c 93 st X, r25
818: 8e 93 st -X, r24
81a: 11 97 sbiw r26, 0x01 ; 1
81c: a8 e1 ldi r26, 0x18 ; 24
81e: ea 2e mov r14, r26
820: a1 e0 ldi r26, 0x01 ; 1
822: fa 2e mov r15, r26
824: f3 82 std Z+3, r15 ; 0x03
826: e2 82 std Z+2, r14 ; 0x02
828: ce 01 movw r24, r28
82a: 03 96 adiw r24, 0x03 ; 3
82c: 95 83 std Z+5, r25 ; 0x05
82e: 84 83 std Z+4, r24 ; 0x04
830: 0e 94 10 39 call 0x7220 ; 0x7220 <sscanf>
lprintf("\nep: %s\n", token);
834: 0f 90 pop r0
836: 0f 90 pop r0
838: 8c e1 ldi r24, 0x1C ; 28
83a: 91 e0 ldi r25, 0x01 ; 1
83c: ed b7 in r30, 0x3d ; 61
83e: fe b7 in r31, 0x3e ; 62
840: 92 83 std Z+2, r25 ; 0x02
842: 81 83 std Z+1, r24 ; 0x01
844: 14 83 std Z+4, r17 ; 0x04
846: 03 83 std Z+3, r16 ; 0x03
848: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
output[0] = eeprom_read_word(&EEcurrentTelemetryVersion) >> 8;
84c: 0f 90 pop r0
84e: 0f 90 pop r0
850: 0f 90 pop r0
852: 0f 90 pop r0
854: 81 e4 ldi r24, 0x41 ; 65
856: 90 e0 ldi r25, 0x00 ; 0
858: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
85c: d5 01 movw r26, r10
85e: 9c 93 st X, r25
output[1] = eeprom_read_word(&EEcurrentTelemetryVersion);
860: 81 e4 ldi r24, 0x41 ; 65
862: 90 e0 ldi r25, 0x00 ; 0
864: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
868: f5 01 movw r30, r10
86a: 81 83 std Z+1, r24 ; 0x01
bytesWritten +=2;
output[2] = bitmask[0] >> 24;
86c: f4 01 movw r30, r8
86e: 80 81 ld r24, Z
870: 91 81 ldd r25, Z+1 ; 0x01
872: a2 81 ldd r26, Z+2 ; 0x02
874: b3 81 ldd r27, Z+3 ; 0x03
876: 8b 2f mov r24, r27
878: 99 27 eor r25, r25
87a: aa 27 eor r26, r26
87c: bb 27 eor r27, r27
87e: f5 01 movw r30, r10
880: 82 83 std Z+2, r24 ; 0x02
output[3] = bitmask[0] >> 16;
882: f4 01 movw r30, r8
884: 80 81 ld r24, Z
886: 91 81 ldd r25, Z+1 ; 0x01
888: a2 81 ldd r26, Z+2 ; 0x02
88a: b3 81 ldd r27, Z+3 ; 0x03
88c: cd 01 movw r24, r26
88e: aa 27 eor r26, r26
890: bb 27 eor r27, r27
892: f5 01 movw r30, r10
894: 83 83 std Z+3, r24 ; 0x03
output[4] = bitmask[0] >> 8;
896: f4 01 movw r30, r8
898: 80 81 ld r24, Z
89a: 91 81 ldd r25, Z+1 ; 0x01
89c: a2 81 ldd r26, Z+2 ; 0x02
89e: b3 81 ldd r27, Z+3 ; 0x03
8a0: 89 2f mov r24, r25
8a2: 9a 2f mov r25, r26
8a4: ab 2f mov r26, r27
8a6: bb 27 eor r27, r27
8a8: f5 01 movw r30, r10
8aa: 84 83 std Z+4, r24 ; 0x04
output[5] = bitmask[0];
8ac: d4 01 movw r26, r8
8ae: 8c 91 ld r24, X
8b0: 85 83 std Z+5, r24 ; 0x05
output[6] = bitmask[1] >> 24;
8b2: 14 96 adiw r26, 0x04 ; 4
8b4: 8d 91 ld r24, X+
8b6: 9d 91 ld r25, X+
8b8: 0d 90 ld r0, X+
8ba: bc 91 ld r27, X
8bc: a0 2d mov r26, r0
8be: 8b 2f mov r24, r27
8c0: 99 27 eor r25, r25
8c2: aa 27 eor r26, r26
8c4: bb 27 eor r27, r27
8c6: 86 83 std Z+6, r24 ; 0x06
output[7] = bitmask[1] >> 16;
8c8: f4 01 movw r30, r8
8ca: 84 81 ldd r24, Z+4 ; 0x04
8cc: 95 81 ldd r25, Z+5 ; 0x05
8ce: a6 81 ldd r26, Z+6 ; 0x06
8d0: b7 81 ldd r27, Z+7 ; 0x07
8d2: cd 01 movw r24, r26
8d4: aa 27 eor r26, r26
8d6: bb 27 eor r27, r27
8d8: f5 01 movw r30, r10
8da: 87 83 std Z+7, r24 ; 0x07
output[8] = bitmask[1] >> 8;
8dc: f4 01 movw r30, r8
8de: 84 81 ldd r24, Z+4 ; 0x04
8e0: 95 81 ldd r25, Z+5 ; 0x05
8e2: a6 81 ldd r26, Z+6 ; 0x06
8e4: b7 81 ldd r27, Z+7 ; 0x07
8e6: 89 2f mov r24, r25
8e8: 9a 2f mov r25, r26
8ea: ab 2f mov r26, r27
8ec: bb 27 eor r27, r27
8ee: f5 01 movw r30, r10
8f0: 80 87 std Z+8, r24 ; 0x08
output[9] = bitmask[1];
8f2: d4 01 movw r26, r8
8f4: 14 96 adiw r26, 0x04 ; 4
8f6: 8c 91 ld r24, X
8f8: 14 97 sbiw r26, 0x04 ; 4
8fa: 81 87 std Z+9, r24 ; 0x09
output[10] = bitmask[2] >> 24;
8fc: 18 96 adiw r26, 0x08 ; 8
8fe: 8d 91 ld r24, X+
900: 9d 91 ld r25, X+
902: 0d 90 ld r0, X+
904: bc 91 ld r27, X
906: a0 2d mov r26, r0
908: 8b 2f mov r24, r27
90a: 99 27 eor r25, r25
90c: aa 27 eor r26, r26
90e: bb 27 eor r27, r27
910: 82 87 std Z+10, r24 ; 0x0a
output[11] = bitmask[2] >> 16;
912: f4 01 movw r30, r8
914: 80 85 ldd r24, Z+8 ; 0x08
916: 91 85 ldd r25, Z+9 ; 0x09
918: a2 85 ldd r26, Z+10 ; 0x0a
91a: b3 85 ldd r27, Z+11 ; 0x0b
91c: cd 01 movw r24, r26
91e: aa 27 eor r26, r26
920: bb 27 eor r27, r27
922: f5 01 movw r30, r10
924: 83 87 std Z+11, r24 ; 0x0b
output[12] = bitmask[2] >> 8;
926: f4 01 movw r30, r8
928: 80 85 ldd r24, Z+8 ; 0x08
92a: 91 85 ldd r25, Z+9 ; 0x09
92c: a2 85 ldd r26, Z+10 ; 0x0a
92e: b3 85 ldd r27, Z+11 ; 0x0b
930: 89 2f mov r24, r25
932: 9a 2f mov r25, r26
934: ab 2f mov r26, r27
936: bb 27 eor r27, r27
938: f5 01 movw r30, r10
93a: 84 87 std Z+12, r24 ; 0x0c
output[13] = bitmask[2];
93c: d4 01 movw r26, r8
93e: 18 96 adiw r26, 0x08 ; 8
940: 8c 91 ld r24, X
942: 85 87 std Z+13, r24 ; 0x0d
bytesWritten +=sizeof(uint32_t)*3;
output[bytesWritten] = epochSample >> 24;
944: 8b 81 ldd r24, Y+3 ; 0x03
946: 9c 81 ldd r25, Y+4 ; 0x04
948: ad 81 ldd r26, Y+5 ; 0x05
94a: be 81 ldd r27, Y+6 ; 0x06
94c: 8b 2f mov r24, r27
94e: 99 27 eor r25, r25
950: aa 27 eor r26, r26
952: bb 27 eor r27, r27
954: 86 87 std Z+14, r24 ; 0x0e
lprintf("%x ", output[bytesWritten]);
956: 00 d0 rcall .+0 ; 0x958 <__stack+0x59>
958: 00 d0 rcall .+0 ; 0x95a <__stack+0x5b>
95a: ad b7 in r26, 0x3d ; 61
95c: be b7 in r27, 0x3e ; 62
95e: 11 96 adiw r26, 0x01 ; 1
960: 05 e2 ldi r16, 0x25 ; 37
962: 11 e0 ldi r17, 0x01 ; 1
964: ed b7 in r30, 0x3d ; 61
966: fe b7 in r31, 0x3e ; 62
968: 12 83 std Z+2, r17 ; 0x02
96a: 01 83 std Z+1, r16 ; 0x01
96c: 12 96 adiw r26, 0x02 ; 2
96e: 8c 93 st X, r24
970: 12 97 sbiw r26, 0x02 ; 2
972: 13 96 adiw r26, 0x03 ; 3
974: 1c 92 st X, r1
976: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
bytesWritten++;
output[bytesWritten] = epochSample >> 16;
97a: 8b 81 ldd r24, Y+3 ; 0x03
97c: 9c 81 ldd r25, Y+4 ; 0x04
97e: ad 81 ldd r26, Y+5 ; 0x05
980: be 81 ldd r27, Y+6 ; 0x06
982: cd 01 movw r24, r26
984: aa 27 eor r26, r26
986: bb 27 eor r27, r27
988: f5 01 movw r30, r10
98a: 87 87 std Z+15, r24 ; 0x0f
lprintf("%x ", output[bytesWritten]);
98c: ad b7 in r26, 0x3d ; 61
98e: be b7 in r27, 0x3e ; 62
990: 11 96 adiw r26, 0x01 ; 1
992: ed b7 in r30, 0x3d ; 61
994: fe b7 in r31, 0x3e ; 62
996: 12 83 std Z+2, r17 ; 0x02
998: 01 83 std Z+1, r16 ; 0x01
99a: 12 96 adiw r26, 0x02 ; 2
99c: 8c 93 st X, r24
99e: 12 97 sbiw r26, 0x02 ; 2
9a0: 13 96 adiw r26, 0x03 ; 3
9a2: 1c 92 st X, r1
9a4: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
bytesWritten++;
output[bytesWritten] = epochSample >> 8;
9a8: 8b 81 ldd r24, Y+3 ; 0x03
9aa: 9c 81 ldd r25, Y+4 ; 0x04
9ac: ad 81 ldd r26, Y+5 ; 0x05
9ae: be 81 ldd r27, Y+6 ; 0x06
9b0: 89 2f mov r24, r25
9b2: 9a 2f mov r25, r26
9b4: ab 2f mov r26, r27
9b6: bb 27 eor r27, r27
9b8: f5 01 movw r30, r10
9ba: 80 8b std Z+16, r24 ; 0x10
lprintf("%x ", output[bytesWritten]);
9bc: ad b7 in r26, 0x3d ; 61
9be: be b7 in r27, 0x3e ; 62
9c0: 11 96 adiw r26, 0x01 ; 1
9c2: ed b7 in r30, 0x3d ; 61
9c4: fe b7 in r31, 0x3e ; 62
9c6: 12 83 std Z+2, r17 ; 0x02
9c8: 01 83 std Z+1, r16 ; 0x01
9ca: 12 96 adiw r26, 0x02 ; 2
9cc: 8c 93 st X, r24
9ce: 12 97 sbiw r26, 0x02 ; 2
9d0: 13 96 adiw r26, 0x03 ; 3
9d2: 1c 92 st X, r1
9d4: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
bytesWritten++;
output[bytesWritten] = epochSample;
9d8: 2b 81 ldd r18, Y+3 ; 0x03
9da: d5 01 movw r26, r10
9dc: 51 96 adiw r26, 0x11 ; 17
9de: 2c 93 st X, r18
lprintf("%x\n", output[bytesWritten]);
9e0: ed b7 in r30, 0x3d ; 61
9e2: fe b7 in r31, 0x3e ; 62
9e4: 31 96 adiw r30, 0x01 ; 1
9e6: 89 e2 ldi r24, 0x29 ; 41
9e8: 91 e0 ldi r25, 0x01 ; 1
9ea: ad b7 in r26, 0x3d ; 61
9ec: be b7 in r27, 0x3e ; 62
9ee: 12 96 adiw r26, 0x02 ; 2
9f0: 9c 93 st X, r25
9f2: 8e 93 st -X, r24
9f4: 11 97 sbiw r26, 0x01 ; 1
9f6: 22 83 std Z+2, r18 ; 0x02
9f8: 13 82 std Z+3, r1 ; 0x03
9fa: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
bytesWritten++;
output[bytesWritten] = batch >> 8;
9fe: f5 01 movw r30, r10
a00: 32 8a std Z+18, r3 ; 0x12
bytesWritten++;
output[bytesWritten] = batch;
a02: 23 8a std Z+19, r2 ; 0x13
a04: 00 e0 ldi r16, 0x00 ; 0
a06: 14 e1 ldi r17, 0x14 ; 20
a08: 0f 90 pop r0
a0a: 0f 90 pop r0
a0c: 0f 90 pop r0
a0e: 0f 90 pop r0
//lprintf("L: %d V: %lx\n", currentTelemetryChannel/32, reversedBitmask[currentTelemetryChannel/32] );
//lprintf("P: %lx\n", reversedBitmask[0]);
//lprintf("P: %lx\n", reversedBitmask[1]);
//lprintf("P: %lx\n", reversedBitmask[2]);
if(reversedBitmask[currentTelemetryChannel/32] & 1 == 1)
a10: 3e 01 movw r6, r28
a12: 08 94 sec
a14: 61 1c adc r6, r1
a16: 71 1c adc r7, r1
sscanf(token, "%d", &holder16);
memrcpy(&output[bytesWritten], &holder16, sizeof(uint8_t)*2);
bytesWritten+=2;
break;
case 24:
sscanf(token, "%ld", &holder32);
a18: cf 5f subi r28, 0xFF ; 255
a1a: de 4f sbci r29, 0xFE ; 254
a1c: e8 82 st Y, r14
a1e: c1 50 subi r28, 0x01 ; 1
a20: d1 40 sbci r29, 0x01 ; 1
a22: ce 5f subi r28, 0xFE ; 254
a24: de 4f sbci r29, 0xFE ; 254
a26: f8 82 st Y, r15
a28: c2 50 subi r28, 0x02 ; 2
a2a: d1 40 sbci r29, 0x01 ; 1
a2c: 67 e0 ldi r22, 0x07 ; 7
a2e: 46 2e mov r4, r22
a30: 51 2c mov r5, r1
a32: 4c 0e add r4, r28
a34: 5d 1e adc r5, r29
{
size_t i;
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
a36: ce 01 movw r24, r28
a38: 0a 96 adiw r24, 0x0a ; 10
a3a: cd 5f subi r28, 0xFD ; 253
a3c: de 4f sbci r29, 0xFE ; 254
a3e: 99 83 std Y+1, r25 ; 0x01
a40: 88 83 st Y, r24
a42: c3 50 subi r28, 0x03 ; 3
a44: d1 40 sbci r29, 0x01 ; 1
a46: de 01 movw r26, r28
a48: 1f 96 adiw r26, 0x0f ; 15
a4a: cb 5f subi r28, 0xFB ; 251
a4c: de 4f sbci r29, 0xFE ; 254
a4e: b9 83 std Y+1, r27 ; 0x01
a50: a8 83 st Y, r26
a52: c5 50 subi r28, 0x05 ; 5
a54: d1 40 sbci r29, 0x01 ; 1
{
uint16_t holder16;
uint32_t holder32;
float holderf;
case 8:
sscanf(token, "%d", &output[bytesWritten]);
a56: 5d e2 ldi r21, 0x2D ; 45
a58: 25 2e mov r2, r21
a5a: 51 e0 ldi r21, 0x01 ; 1
a5c: 35 2e mov r3, r21
//END SAMPLE PREAMBLE
do
{
token = strtok(NULL,",");
a5e: 80 e0 ldi r24, 0x00 ; 0
a60: 90 e0 ldi r25, 0x00 ; 0
a62: 66 e1 ldi r22, 0x16 ; 22
a64: 71 e0 ldi r23, 0x01 ; 1
a66: 0e 94 fc 37 call 0x6ff8 ; 0x6ff8 <strtok>
a6a: 9c 01 movw r18, r24
//lprintf("L: %d V: %lx\n", currentTelemetryChannel/32, reversedBitmask[currentTelemetryChannel/32] );
//lprintf("P: %lx\n", reversedBitmask[0]);
//lprintf("P: %lx\n", reversedBitmask[1]);
//lprintf("P: %lx\n", reversedBitmask[2]);
if(reversedBitmask[currentTelemetryChannel/32] & 1 == 1)
a6c: 80 2f mov r24, r16
a6e: 82 95 swap r24
a70: 86 95 lsr r24
a72: 87 70 andi r24, 0x07 ; 7
a74: 88 2e mov r8, r24
a76: 99 24 eor r9, r9
a78: f4 01 movw r30, r8
a7a: ee 0f add r30, r30
a7c: ff 1f adc r31, r31
a7e: ee 0f add r30, r30
a80: ff 1f adc r31, r31
a82: e6 0d add r30, r6
a84: f7 1d adc r31, r7
a86: c6 84 ldd r12, Z+14 ; 0x0e
a88: d7 84 ldd r13, Z+15 ; 0x0f
a8a: e0 88 ldd r14, Z+16 ; 0x10
a8c: f1 88 ldd r15, Z+17 ; 0x11
a8e: c6 01 movw r24, r12
a90: 81 70 andi r24, 0x01 ; 1
a92: 90 70 andi r25, 0x00 ; 0
a94: 89 2b or r24, r25
a96: 09 f4 brne .+2 ; 0xa9a <__stack+0x19b>
a98: f0 c0 rjmp .+480 ; 0xc7a <__stack+0x37b>
{
//lprintf("Tof: %d\n", pgm_read_byte(&bitmaskTypeOrder[currentTelemetryChannel]));
//lprintf("Tok: %s\n", token);
switch(pgm_read_byte(&bitmaskTypeOrder[currentTelemetryChannel]))
a9a: e0 2f mov r30, r16
a9c: f0 e0 ldi r31, 0x00 ; 0
a9e: e4 58 subi r30, 0x84 ; 132
aa0: ff 4f sbci r31, 0xFF ; 255
aa2: 84 91 lpm r24, Z+
aa4: 88 31 cpi r24, 0x18 ; 24
aa6: 09 f4 brne .+2 ; 0xaaa <__stack+0x1ab>
aa8: 4b c0 rjmp .+150 ; 0xb40 <__stack+0x241>
aaa: 89 31 cpi r24, 0x19 ; 25
aac: 30 f4 brcc .+12 ; 0xaba <__stack+0x1bb>
aae: 88 30 cpi r24, 0x08 ; 8
ab0: 59 f0 breq .+22 ; 0xac8 <__stack+0x1c9>
ab2: 80 31 cpi r24, 0x10 ; 16
ab4: 09 f0 breq .+2 ; 0xab8 <__stack+0x1b9>
ab6: e1 c0 rjmp .+450 ; 0xc7a <__stack+0x37b>
ab8: 1e c0 rjmp .+60 ; 0xaf6 <__stack+0x1f7>
aba: 80 32 cpi r24, 0x20 ; 32
abc: 09 f4 brne .+2 ; 0xac0 <__stack+0x1c1>
abe: 76 c0 rjmp .+236 ; 0xbac <__stack+0x2ad>
ac0: 81 32 cpi r24, 0x21 ; 33
ac2: 09 f0 breq .+2 ; 0xac6 <__stack+0x1c7>
ac4: da c0 rjmp .+436 ; 0xc7a <__stack+0x37b>
ac6: a7 c0 rjmp .+334 ; 0xc16 <__stack+0x317>
{
uint16_t holder16;
uint32_t holder32;
float holderf;
case 8:
sscanf(token, "%d", &output[bytesWritten]);
ac8: 00 d0 rcall .+0 ; 0xaca <__stack+0x1cb>
aca: 00 d0 rcall .+0 ; 0xacc <__stack+0x1cd>
acc: 00 d0 rcall .+0 ; 0xace <__stack+0x1cf>
ace: ed b7 in r30, 0x3d ; 61
ad0: fe b7 in r31, 0x3e ; 62
ad2: 31 96 adiw r30, 0x01 ; 1
ad4: ad b7 in r26, 0x3d ; 61
ad6: be b7 in r27, 0x3e ; 62
ad8: 12 96 adiw r26, 0x02 ; 2
ada: 3c 93 st X, r19
adc: 2e 93 st -X, r18
ade: 11 97 sbiw r26, 0x01 ; 1
ae0: 33 82 std Z+3, r3 ; 0x03
ae2: 22 82 std Z+2, r2 ; 0x02
ae4: c5 01 movw r24, r10
ae6: 81 0f add r24, r17
ae8: 91 1d adc r25, r1
aea: 95 83 std Z+5, r25 ; 0x05
aec: 84 83 std Z+4, r24 ; 0x04
aee: 0e 94 10 39 call 0x7220 ; 0x7220 <sscanf>
bytesWritten+=1;
af2: 1f 5f subi r17, 0xFF ; 255
af4: 1c c0 rjmp .+56 ; 0xb2e <__stack+0x22f>
break;
case 16:
sscanf(token, "%d", &holder16);
af6: 00 d0 rcall .+0 ; 0xaf8 <__stack+0x1f9>
af8: 00 d0 rcall .+0 ; 0xafa <__stack+0x1fb>
afa: 00 d0 rcall .+0 ; 0xafc <__stack+0x1fd>
afc: ed b7 in r30, 0x3d ; 61
afe: fe b7 in r31, 0x3e ; 62
b00: 31 96 adiw r30, 0x01 ; 1
b02: ad b7 in r26, 0x3d ; 61
b04: be b7 in r27, 0x3e ; 62
b06: 12 96 adiw r26, 0x02 ; 2
b08: 3c 93 st X, r19
b0a: 2e 93 st -X, r18
b0c: 11 97 sbiw r26, 0x01 ; 1
b0e: 33 82 std Z+3, r3 ; 0x03
b10: 22 82 std Z+2, r2 ; 0x02
b12: 75 82 std Z+5, r7 ; 0x05
b14: 64 82 std Z+4, r6 ; 0x04
b16: 0e 94 10 39 call 0x7220 ; 0x7220 <sscanf>
}
void memrcpy(void *dst, const void *src, size_t len)
{
size_t i;
char* d = (char*)dst;
b1a: f5 01 movw r30, r10
b1c: e1 0f add r30, r17
b1e: f1 1d adc r31, r1
const char* s = (const char*)src;
for(i=0; i<len; ++i)
{
d[len-1-i] = s[i];
b20: d3 01 movw r26, r6
b22: 8c 91 ld r24, X
b24: 81 83 std Z+1, r24 ; 0x01
b26: 11 96 adiw r26, 0x01 ; 1
b28: 8c 91 ld r24, X
b2a: 80 83 st Z, r24
bytesWritten+=1;
break;
case 16:
sscanf(token, "%d", &holder16);
memrcpy(&output[bytesWritten], &holder16, sizeof(uint8_t)*2);
bytesWritten+=2;
b2c: 1e 5f subi r17, 0xFE ; 254
b2e: ed b7 in r30, 0x3d ; 61
b30: fe b7 in r31, 0x3e ; 62
b32: 36 96 adiw r30, 0x06 ; 6
b34: 0f b6 in r0, 0x3f ; 63
b36: f8 94 cli
b38: fe bf out 0x3e, r31 ; 62
b3a: 0f be out 0x3f, r0 ; 63
b3c: ed bf out 0x3d, r30 ; 61
b3e: 9d c0 rjmp .+314 ; 0xc7a <__stack+0x37b>
break;
case 24:
sscanf(token, "%ld", &holder32);
b40: 00 d0 rcall .+0 ; 0xb42 <__stack+0x243>
b42: 00 d0 rcall .+0 ; 0xb44 <__stack+0x245>
b44: 00 d0 rcall .+0 ; 0xb46 <__stack+0x247>
b46: ed b7 in r30, 0x3d ; 61
b48: fe b7 in r31, 0x3e ; 62
b4a: 31 96 adiw r30, 0x01 ; 1
b4c: ad b7 in r26, 0x3d ; 61
b4e: be b7 in r27, 0x3e ; 62
b50: 12 96 adiw r26, 0x02 ; 2
b52: 3c 93 st X, r19
b54: 2e 93 st -X, r18
b56: 11 97 sbiw r26, 0x01 ; 1
b58: cf 5f subi r28, 0xFF ; 255
b5a: de 4f sbci r29, 0xFE ; 254
b5c: b8 81 ld r27, Y
b5e: c1 50 subi r28, 0x01 ; 1
b60: d1 40 sbci r29, 0x01 ; 1
b62: b2 83 std Z+2, r27 ; 0x02
b64: ce 5f subi r28, 0xFE ; 254
b66: de 4f sbci r29, 0xFE ; 254
b68: 88 81 ld r24, Y
b6a: c2 50 subi r28, 0x02 ; 2
b6c: d1 40 sbci r29, 0x01 ; 1
b6e: 83 83 std Z+3, r24 ; 0x03
b70: 55 82 std Z+5, r5 ; 0x05
b72: 44 82 std Z+4, r4 ; 0x04
b74: 0e 94 10 39 call 0x7220 ; 0x7220 <sscanf>
b78: d2 01 movw r26, r4
b7a: f5 01 movw r30, r10
b7c: e1 0f add r30, r17
b7e: f1 1d adc r31, r1
b80: 8d b7 in r24, 0x3d ; 61
b82: 9e b7 in r25, 0x3e ; 62
b84: 06 96 adiw r24, 0x06 ; 6
b86: 0f b6 in r0, 0x3f ; 63
b88: f8 94 cli
b8a: 9e bf out 0x3e, r25 ; 62
b8c: 0f be out 0x3f, r0 ; 63
b8e: 8d bf out 0x3d, r24 ; 61
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
{
d[len-1-i] = s[i];
b90: 8d 91 ld r24, X+
b92: 82 83 std Z+2, r24 ; 0x02
b94: 31 97 sbiw r30, 0x01 ; 1
{
size_t i;
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
b96: cd 5f subi r28, 0xFD ; 253
b98: de 4f sbci r29, 0xFE ; 254
b9a: 88 81 ld r24, Y
b9c: 99 81 ldd r25, Y+1 ; 0x01
b9e: c3 50 subi r28, 0x03 ; 3
ba0: d1 40 sbci r29, 0x01 ; 1
ba2: a8 17 cp r26, r24
ba4: b9 07 cpc r27, r25
ba6: a1 f7 brne .-24 ; 0xb90 <__stack+0x291>
bytesWritten+=2;
break;
case 24:
sscanf(token, "%ld", &holder32);
memrcpy(&output[bytesWritten], &holder32, sizeof(uint8_t)*3);
bytesWritten+=3;
ba8: 1d 5f subi r17, 0xFD ; 253
baa: 67 c0 rjmp .+206 ; 0xc7a <__stack+0x37b>
break;
case 32:
sscanf(token, "%ld", &holder32);
bac: 00 d0 rcall .+0 ; 0xbae <__stack+0x2af>
bae: 00 d0 rcall .+0 ; 0xbb0 <__stack+0x2b1>
bb0: 00 d0 rcall .+0 ; 0xbb2 <__stack+0x2b3>
bb2: ed b7 in r30, 0x3d ; 61
bb4: fe b7 in r31, 0x3e ; 62
bb6: 31 96 adiw r30, 0x01 ; 1
bb8: ad b7 in r26, 0x3d ; 61
bba: be b7 in r27, 0x3e ; 62
bbc: 12 96 adiw r26, 0x02 ; 2
bbe: 3c 93 st X, r19
bc0: 2e 93 st -X, r18
bc2: 11 97 sbiw r26, 0x01 ; 1
bc4: cf 5f subi r28, 0xFF ; 255
bc6: de 4f sbci r29, 0xFE ; 254
bc8: b8 81 ld r27, Y
bca: c1 50 subi r28, 0x01 ; 1
bcc: d1 40 sbci r29, 0x01 ; 1
bce: b2 83 std Z+2, r27 ; 0x02
bd0: ce 5f subi r28, 0xFE ; 254
bd2: de 4f sbci r29, 0xFE ; 254
bd4: 88 81 ld r24, Y
bd6: c2 50 subi r28, 0x02 ; 2
bd8: d1 40 sbci r29, 0x01 ; 1
bda: 83 83 std Z+3, r24 ; 0x03
bdc: 55 82 std Z+5, r5 ; 0x05
bde: 44 82 std Z+4, r4 ; 0x04
be0: 0e 94 10 39 call 0x7220 ; 0x7220 <sscanf>
be4: d2 01 movw r26, r4
be6: f5 01 movw r30, r10
be8: e1 0f add r30, r17
bea: f1 1d adc r31, r1
bec: 8d b7 in r24, 0x3d ; 61
bee: 9e b7 in r25, 0x3e ; 62
bf0: 06 96 adiw r24, 0x06 ; 6
bf2: 0f b6 in r0, 0x3f ; 63
bf4: f8 94 cli
bf6: 9e bf out 0x3e, r25 ; 62
bf8: 0f be out 0x3f, r0 ; 63
bfa: 8d bf out 0x3d, r24 ; 61
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
{
d[len-1-i] = s[i];
bfc: 8d 91 ld r24, X+
bfe: 82 83 std Z+2, r24 ; 0x02
c00: 31 97 sbiw r30, 0x01 ; 1
{
size_t i;
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
c02: cd 5f subi r28, 0xFD ; 253
c04: de 4f sbci r29, 0xFE ; 254
c06: 88 81 ld r24, Y
c08: 99 81 ldd r25, Y+1 ; 0x01
c0a: c3 50 subi r28, 0x03 ; 3
c0c: d1 40 sbci r29, 0x01 ; 1
c0e: a8 17 cp r26, r24
c10: b9 07 cpc r27, r25
c12: a1 f7 brne .-24 ; 0xbfc <__stack+0x2fd>
c14: 31 c0 rjmp .+98 ; 0xc78 <__stack+0x379>
sscanf(token, "%ld", &holder32);
memrcpy(&output[bytesWritten], &holder32, sizeof(uint8_t)*3);
bytesWritten+=4;
break;
case 33: //Float
sscanf(token, "%f", &holderf);
c16: 00 d0 rcall .+0 ; 0xc18 <__stack+0x319>
c18: 00 d0 rcall .+0 ; 0xc1a <__stack+0x31b>
c1a: 00 d0 rcall .+0 ; 0xc1c <__stack+0x31d>
c1c: ed b7 in r30, 0x3d ; 61
c1e: fe b7 in r31, 0x3e ; 62
c20: 31 96 adiw r30, 0x01 ; 1
c22: ad b7 in r26, 0x3d ; 61
c24: be b7 in r27, 0x3e ; 62
c26: 12 96 adiw r26, 0x02 ; 2
c28: 3c 93 st X, r19
c2a: 2e 93 st -X, r18
c2c: 11 97 sbiw r26, 0x01 ; 1
c2e: 80 e3 ldi r24, 0x30 ; 48
c30: 91 e0 ldi r25, 0x01 ; 1
c32: 93 83 std Z+3, r25 ; 0x03
c34: 82 83 std Z+2, r24 ; 0x02
c36: ab e0 ldi r26, 0x0B ; 11
c38: b0 e0 ldi r27, 0x00 ; 0
c3a: ac 0f add r26, r28
c3c: bd 1f adc r27, r29
c3e: b5 83 std Z+5, r27 ; 0x05
c40: a4 83 std Z+4, r26 ; 0x04
c42: 0e 94 10 39 call 0x7220 ; 0x7220 <sscanf>
c46: de 01 movw r26, r28
c48: 1b 96 adiw r26, 0x0b ; 11
c4a: f5 01 movw r30, r10
c4c: e1 0f add r30, r17
c4e: f1 1d adc r31, r1
c50: 8d b7 in r24, 0x3d ; 61
c52: 9e b7 in r25, 0x3e ; 62
c54: 06 96 adiw r24, 0x06 ; 6
c56: 0f b6 in r0, 0x3f ; 63
c58: f8 94 cli
c5a: 9e bf out 0x3e, r25 ; 62
c5c: 0f be out 0x3f, r0 ; 63
c5e: 8d bf out 0x3d, r24 ; 61
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
{
d[len-1-i] = s[i];
c60: 8d 91 ld r24, X+
c62: 83 83 std Z+3, r24 ; 0x03
c64: 31 97 sbiw r30, 0x01 ; 1
{
size_t i;
char* d = (char*)dst;
const char* s = (const char*)src;
for(i=0; i<len; ++i)
c66: cb 5f subi r28, 0xFB ; 251
c68: de 4f sbci r29, 0xFE ; 254
c6a: 88 81 ld r24, Y
c6c: 99 81 ldd r25, Y+1 ; 0x01
c6e: c5 50 subi r28, 0x05 ; 5
c70: d1 40 sbci r29, 0x01 ; 1
c72: a8 17 cp r26, r24
c74: b9 07 cpc r27, r25
c76: a1 f7 brne .-24 ; 0xc60 <__stack+0x361>
bytesWritten+=4;
break;
case 33: //Float
sscanf(token, "%f", &holderf);
memrcpy(&output[bytesWritten], &holderf, sizeof(float));
bytesWritten+=sizeof(float);
c78: 1c 5f subi r17, 0xFC ; 252
default:
break;
}
}
reversedBitmask[currentTelemetryChannel/32] >>= 1;
c7a: 88 0c add r8, r8
c7c: 99 1c adc r9, r9
c7e: 88 0c add r8, r8
c80: 99 1c adc r9, r9
c82: 86 0c add r8, r6
c84: 97 1c adc r9, r7
c86: f6 94 lsr r15
c88: e7 94 ror r14
c8a: d7 94 ror r13
c8c: c7 94 ror r12
c8e: d4 01 movw r26, r8
c90: 1e 96 adiw r26, 0x0e ; 14
c92: cd 92 st X+, r12
c94: dd 92 st X+, r13
c96: ed 92 st X+, r14
c98: fc 92 st X, r15
c9a: 51 97 sbiw r26, 0x11 ; 17
currentTelemetryChannel++;
c9c: 0f 5f subi r16, 0xFF ; 255
} while(reversedBitmask[0] != 0 || reversedBitmask[1] != 0 || reversedBitmask[2] != 0);
c9e: 8f 85 ldd r24, Y+15 ; 0x0f
ca0: 98 89 ldd r25, Y+16 ; 0x10
ca2: a9 89 ldd r26, Y+17 ; 0x11
ca4: ba 89 ldd r27, Y+18 ; 0x12
ca6: 00 97 sbiw r24, 0x00 ; 0
ca8: a1 05 cpc r26, r1
caa: b1 05 cpc r27, r1
cac: 09 f0 breq .+2 ; 0xcb0 <__stack+0x3b1>
cae: d7 ce rjmp .-594 ; 0xa5e <__stack+0x15f>
cb0: 8b 89 ldd r24, Y+19 ; 0x13
cb2: 9c 89 ldd r25, Y+20 ; 0x14
cb4: ad 89 ldd r26, Y+21 ; 0x15
cb6: be 89 ldd r27, Y+22 ; 0x16
cb8: 00 97 sbiw r24, 0x00 ; 0
cba: a1 05 cpc r26, r1
cbc: b1 05 cpc r27, r1
cbe: 09 f0 breq .+2 ; 0xcc2 <__stack+0x3c3>
cc0: ce ce rjmp .-612 ; 0xa5e <__stack+0x15f>
cc2: 8f 89 ldd r24, Y+23 ; 0x17
cc4: 98 8d ldd r25, Y+24 ; 0x18
cc6: a9 8d ldd r26, Y+25 ; 0x19
cc8: ba 8d ldd r27, Y+26 ; 0x1a
cca: 00 97 sbiw r24, 0x00 ; 0
ccc: a1 05 cpc r26, r1
cce: b1 05 cpc r27, r1
cd0: 09 f0 breq .+2 ; 0xcd4 <__stack+0x3d5>
cd2: c5 ce rjmp .-630 ; 0xa5e <__stack+0x15f>
return bytesWritten;
}
cd4: 81 2f mov r24, r17
cd6: 90 e0 ldi r25, 0x00 ; 0
cd8: ca 5f subi r28, 0xFA ; 250
cda: de 4f sbci r29, 0xFE ; 254
cdc: 0f b6 in r0, 0x3f ; 63
cde: f8 94 cli
ce0: de bf out 0x3e, r29 ; 62
ce2: 0f be out 0x3f, r0 ; 63
ce4: cd bf out 0x3d, r28 ; 61
ce6: cf 91 pop r28
ce8: df 91 pop r29
cea: 1f 91 pop r17
cec: 0f 91 pop r16
cee: ff 90 pop r15
cf0: ef 90 pop r14
cf2: df 90 pop r13
cf4: cf 90 pop r12
cf6: bf 90 pop r11
cf8: af 90 pop r10
cfa: 9f 90 pop r9
cfc: 8f 90 pop r8
cfe: 7f 90 pop r7
d00: 6f 90 pop r6
d02: 5f 90 pop r5
d04: 4f 90 pop r4
d06: 3f 90 pop r3
d08: 2f 90 pop r2
d0a: 08 95 ret
00000d0c <loadBatch>:
//Before this function is called, CommPromEnd must be set to CommPromStart, or weird things could hapen.
void loadBatch(void)
{
d0c: 2f 92 push r2
d0e: 3f 92 push r3
d10: 4f 92 push r4
d12: 5f 92 push r5
d14: 6f 92 push r6
d16: 7f 92 push r7
d18: 8f 92 push r8
d1a: 9f 92 push r9
d1c: af 92 push r10
d1e: bf 92 push r11
d20: cf 92 push r12
d22: df 92 push r13
d24: ef 92 push r14
d26: ff 92 push r15
d28: 0f 93 push r16
d2a: 1f 93 push r17
d2c: df 93 push r29
d2e: cf 93 push r28
d30: cd b7 in r28, 0x3d ; 61
d32: de b7 in r29, 0x3e ; 62
d34: c2 5a subi r28, 0xA2 ; 162
d36: d0 40 sbci r29, 0x00 ; 0
d38: 0f b6 in r0, 0x3f ; 63
d3a: f8 94 cli
d3c: de bf out 0x3e, r29 ; 62
d3e: 0f be out 0x3f, r0 ; 63
d40: cd bf out 0x3d, r28 ; 61
lprintf_P(PSTR("LB\n"));
d42: 00 d0 rcall .+0 ; 0xd44 <loadBatch+0x38>
d44: 8f ea ldi r24, 0xAF ; 175
d46: 90 e0 ldi r25, 0x00 ; 0
d48: ad b7 in r26, 0x3d ; 61
d4a: be b7 in r27, 0x3e ; 62
d4c: 12 96 adiw r26, 0x02 ; 2
d4e: 9c 93 st X, r25
d50: 8e 93 st -X, r24
d52: 11 97 sbiw r26, 0x01 ; 1
d54: 0e 94 e5 11 call 0x23ca ; 0x23ca <lprintf_P>
uint16_t batchSampleStart = eeprom_read_word(&EEbatchSampleStart);
d58: 0f 90 pop r0
d5a: 0f 90 pop r0
d5c: 8a e2 ldi r24, 0x2A ; 42
d5e: 90 e0 ldi r25, 0x00 ; 0
d60: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
d64: 18 2f mov r17, r24
d66: 09 2f mov r16, r25
uint16_t batchSampleEnd = eeprom_read_word(&EEbatchSampleEnd);
d68: 8c e2 ldi r24, 0x2C ; 44
d6a: 90 e0 ldi r25, 0x00 ; 0
d6c: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
d70: 4c 01 movw r8, r24
uint16_t batchNumber = eeprom_read_word(&EEcurrentBatchNumber);
d72: 88 e2 ldi r24, 0x28 ; 40
d74: 90 e0 ldi r25, 0x00 ; 0
d76: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
d7a: 3c 01 movw r6, r24
uint32_t currentBitmask[3];
currentBitmask[0] = eeprom_read_dword(&EEcurrentTelemetryBitmap[0]);
d7c: 85 e3 ldi r24, 0x35 ; 53
d7e: 90 e0 ldi r25, 0x00 ; 0
d80: 0e 94 0e 3a call 0x741c ; 0x741c <__eerd_dword_m324p>
d84: 69 83 std Y+1, r22 ; 0x01
d86: 7a 83 std Y+2, r23 ; 0x02
d88: 8b 83 std Y+3, r24 ; 0x03
d8a: 9c 83 std Y+4, r25 ; 0x04
currentBitmask[1] = eeprom_read_dword(&EEcurrentTelemetryBitmap[1]);
d8c: 89 e3 ldi r24, 0x39 ; 57
d8e: 90 e0 ldi r25, 0x00 ; 0
d90: 0e 94 0e 3a call 0x741c ; 0x741c <__eerd_dword_m324p>
d94: 6d 83 std Y+5, r22 ; 0x05
d96: 7e 83 std Y+6, r23 ; 0x06
d98: 8f 83 std Y+7, r24 ; 0x07
d9a: 98 87 std Y+8, r25 ; 0x08
currentBitmask[2] = eeprom_read_dword(&EEcurrentTelemetryBitmap[2]);
d9c: 8d e3 ldi r24, 0x3D ; 61
d9e: 90 e0 ldi r25, 0x00 ; 0
da0: 0e 94 0e 3a call 0x741c ; 0x741c <__eerd_dword_m324p>
da4: 69 87 std Y+9, r22 ; 0x09
da6: 7a 87 std Y+10, r23 ; 0x0a
da8: 8b 87 std Y+11, r24 ; 0x0b
daa: 9c 87 std Y+12, r25 ; 0x0c
uint16_t commPromEnd = eeprom_read_word(&EEcommPromEnd);
dac: 80 e3 ldi r24, 0x30 ; 48
dae: 90 e0 ldi r25, 0x00 ; 0
db0: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
db4: 2c 01 movw r4, r24
#ifdef opdebug
lprintf_P(PSTR("LB S: %d E: %d\n"), batchSampleStart,batchSampleEnd );
db6: 00 d0 rcall .+0 ; 0xdb8 <loadBatch+0xac>
db8: 00 d0 rcall .+0 ; 0xdba <loadBatch+0xae>
dba: 00 d0 rcall .+0 ; 0xdbc <loadBatch+0xb0>
dbc: ed b7 in r30, 0x3d ; 61
dbe: fe b7 in r31, 0x3e ; 62
dc0: 31 96 adiw r30, 0x01 ; 1
dc2: 8f e9 ldi r24, 0x9F ; 159
dc4: 90 e0 ldi r25, 0x00 ; 0
dc6: ad b7 in r26, 0x3d ; 61
dc8: be b7 in r27, 0x3e ; 62
dca: 12 96 adiw r26, 0x02 ; 2
dcc: 9c 93 st X, r25
dce: 8e 93 st -X, r24
dd0: 11 97 sbiw r26, 0x01 ; 1
dd2: 12 83 std Z+2, r17 ; 0x02
dd4: 03 83 std Z+3, r16 ; 0x03
dd6: 95 82 std Z+5, r9 ; 0x05
dd8: 84 82 std Z+4, r8 ; 0x04
dda: 0e 94 e5 11 call 0x23ca ; 0x23ca <lprintf_P>
dde: 21 2f mov r18, r17
de0: 30 2f mov r19, r16
de2: c9 01 movw r24, r18
de4: 6c 01 movw r12, r24
de6: ed b7 in r30, 0x3d ; 61
de8: fe b7 in r31, 0x3e ; 62
dea: 36 96 adiw r30, 0x06 ; 6
dec: 0f b6 in r0, 0x3f ; 63
dee: f8 94 cli
df0: fe bf out 0x3e, r31 ; 62
df2: 0f be out 0x3f, r0 ; 63
df4: ed bf out 0x3d, r30 ; 61
for(uint16_t i=batchSampleStart; i < batchSampleEnd; i++)
{
uint8_t thisSample[MAXTXSAMPLESIZE];
uint8_t sizeOfSample;
lprintf("i: %d\n", i);
sizeOfSample = getTxSample(thisSample, currentBitmask, i, batchNumber);
df6: 5d e0 ldi r21, 0x0D ; 13
df8: 25 2e mov r2, r21
dfa: 31 2c mov r3, r1
dfc: 2c 0e add r2, r28
dfe: 3d 1e adc r3, r29
e00: 5c c0 rjmp .+184 ; 0xeba <loadBatch+0x1ae>
for(uint16_t i=batchSampleStart; i < batchSampleEnd; i++)
{
uint8_t thisSample[MAXTXSAMPLESIZE];
uint8_t sizeOfSample;
lprintf("i: %d\n", i);
e02: 00 d0 rcall .+0 ; 0xe04 <loadBatch+0xf8>
e04: 00 d0 rcall .+0 ; 0xe06 <loadBatch+0xfa>
e06: e3 e3 ldi r30, 0x33 ; 51
e08: f1 e0 ldi r31, 0x01 ; 1
e0a: ad b7 in r26, 0x3d ; 61
e0c: be b7 in r27, 0x3e ; 62
e0e: 12 96 adiw r26, 0x02 ; 2
e10: fc 93 st X, r31
e12: ee 93 st -X, r30
e14: 11 97 sbiw r26, 0x01 ; 1
e16: 14 96 adiw r26, 0x04 ; 4
e18: dc 92 st X, r13
e1a: ce 92 st -X, r12
e1c: 13 97 sbiw r26, 0x03 ; 3
e1e: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
sizeOfSample = getTxSample(thisSample, currentBitmask, i, batchNumber);
e22: 0f 90 pop r0
e24: 0f 90 pop r0
e26: 0f 90 pop r0
e28: 0f 90 pop r0
e2a: c1 01 movw r24, r2
e2c: be 01 movw r22, r28
e2e: 6f 5f subi r22, 0xFF ; 255
e30: 7f 4f sbci r23, 0xFF ; 255
e32: a6 01 movw r20, r12
e34: 93 01 movw r18, r6
e36: 0e 94 3b 03 call 0x676 ; 0x676 <getTxSample>
e3a: 18 2f mov r17, r24
#ifdef opdebug
lprintf("A Sample: ");
e3c: 00 d0 rcall .+0 ; 0xe3e <loadBatch+0x132>
e3e: ea e3 ldi r30, 0x3A ; 58
e40: f1 e0 ldi r31, 0x01 ; 1
e42: ad b7 in r26, 0x3d ; 61
e44: be b7 in r27, 0x3e ; 62
e46: 12 96 adiw r26, 0x02 ; 2
e48: fc 93 st X, r31
e4a: ee 93 st -X, r30
e4c: 11 97 sbiw r26, 0x01 ; 1
e4e: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
e52: 71 01 movw r14, r2
e54: 0f 90 pop r0
e56: 0f 90 pop r0
}
//Before this function is called, CommPromEnd must be set to CommPromStart, or weird things could hapen.
void loadBatch(void)
{
e58: 01 2f mov r16, r17
e5a: 10 e0 ldi r17, 0x00 ; 0
lprintf("i: %d\n", i);
sizeOfSample = getTxSample(thisSample, currentBitmask, i, batchNumber);
#ifdef opdebug
lprintf("A Sample: ");
#endif
for(int j=0; j < sizeOfSample; j++)
e5c: 51 01 movw r10, r2
e5e: a0 0e add r10, r16
e60: b1 1e adc r11, r17
e62: 18 c0 rjmp .+48 ; 0xe94 <loadBatch+0x188>
{
#ifdef opdebug
lprintf("%x ", thisSample[j]);
e64: 00 d0 rcall .+0 ; 0xe66 <loadBatch+0x15a>
e66: 00 d0 rcall .+0 ; 0xe68 <loadBatch+0x15c>
e68: ed b7 in r30, 0x3d ; 61
e6a: fe b7 in r31, 0x3e ; 62
e6c: 31 96 adiw r30, 0x01 ; 1
e6e: 85 e2 ldi r24, 0x25 ; 37
e70: 91 e0 ldi r25, 0x01 ; 1
e72: ad b7 in r26, 0x3d ; 61
e74: be b7 in r27, 0x3e ; 62
e76: 12 96 adiw r26, 0x02 ; 2
e78: 9c 93 st X, r25
e7a: 8e 93 st -X, r24
e7c: 11 97 sbiw r26, 0x01 ; 1
e7e: d7 01 movw r26, r14
e80: 8d 91 ld r24, X+
e82: 7d 01 movw r14, r26
e84: 82 83 std Z+2, r24 ; 0x02
e86: 13 82 std Z+3, r1 ; 0x03
e88: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
e8c: 0f 90 pop r0
e8e: 0f 90 pop r0
e90: 0f 90 pop r0
e92: 0f 90 pop r0
lprintf("i: %d\n", i);
sizeOfSample = getTxSample(thisSample, currentBitmask, i, batchNumber);
#ifdef opdebug
lprintf("A Sample: ");
#endif
for(int j=0; j < sizeOfSample; j++)
e94: ea 14 cp r14, r10
e96: fb 04 cpc r15, r11
e98: 29 f7 brne .-54 ; 0xe64 <loadBatch+0x158>
e9a: 40 0e add r4, r16
e9c: 51 1e adc r5, r17
i2cMasterSendNI(COMPROM, 3, &data);
#endif
commPromEnd++;
}
#ifdef opdebug
lprintf("\n");
e9e: 00 d0 rcall .+0 ; 0xea0 <loadBatch+0x194>
ea0: 8e e0 ldi r24, 0x0E ; 14
ea2: 91 e0 ldi r25, 0x01 ; 1
ea4: ed b7 in r30, 0x3d ; 61
ea6: fe b7 in r31, 0x3e ; 62
ea8: 92 83 std Z+2, r25 ; 0x02
eaa: 81 83 std Z+1, r24 ; 0x01
eac: 0e 94 30 12 call 0x2460 ; 0x2460 <lprintf>
#ifdef opdebug
lprintf_P(PSTR("LB S: %d E: %d\n"), batchSampleStart,batchSampleEnd );
#endif
for(uint16_t i=batchSampleStart; i < batchSampleEnd; i++)
eb0: 08 94 sec
eb2: c1 1c adc r12, r1
eb4: d1 1c adc r13, r1
eb6: 0f 90 pop r0
eb8: 0f 90 pop r0
eba: c8 14 cp r12, r8
ebc: d9 04 cpc r13, r9
ebe: 08 f4 brcc .+2 ; 0xec2 <loadBatch+0x1b6>
ec0: a0 cf rjmp .-192 ; 0xe02 <loadBatch+0xf6>
}
batchNumber++;
batchSampleStart = batchSampleEnd;
eeprom_write_word(&EEbatchSampleStart, batchSampleStart);
ec2: 8a e2 ldi r24, 0x2A ; 42
ec4: 90 e0 ldi r25, 0x00 ; 0
ec6: b4 01 movw r22, r8
ec8: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEbatchSampleEnd, batchSampleEnd);
ecc: 8c e2 ldi r24, 0x2C ; 44
ece: 90 e0 ldi r25, 0x00 ; 0
ed0: b4 01 movw r22, r8
ed2: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEcurrentBatchNumber, batchNumber);
ed6: 08 94 sec
ed8: 61 1c adc r6, r1
eda: 71 1c adc r7, r1
edc: 88 e2 ldi r24, 0x28 ; 40
ede: 90 e0 ldi r25, 0x00 ; 0
ee0: b3 01 movw r22, r6
ee2: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEcommPromEnd, commPromEnd);
ee6: 80 e3 ldi r24, 0x30 ; 48
ee8: 90 e0 ldi r25, 0x00 ; 0
eea: b2 01 movw r22, r4
eec: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
}
ef0: ce 55 subi r28, 0x5E ; 94
ef2: df 4f sbci r29, 0xFF ; 255
ef4: 0f b6 in r0, 0x3f ; 63
ef6: f8 94 cli
ef8: de bf out 0x3e, r29 ; 62
efa: 0f be out 0x3f, r0 ; 63
efc: cd bf out 0x3d, r28 ; 61
efe: cf 91 pop r28
f00: df 91 pop r29
f02: 1f 91 pop r17
f04: 0f 91 pop r16
f06: ff 90 pop r15
f08: ef 90 pop r14
f0a: df 90 pop r13
f0c: cf 90 pop r12
f0e: bf 90 pop r11
f10: af 90 pop r10
f12: 9f 90 pop r9
f14: 8f 90 pop r8
f16: 7f 90 pop r7
f18: 6f 90 pop r6
f1a: 5f 90 pop r5
f1c: 4f 90 pop r4
f1e: 3f 90 pop r3
f20: 2f 90 pop r2
f22: 08 95 ret
00000f24 <bmp085ReadShort>:
eeprom_write_word(&EEBMPmd, bmp085ReadShort(0xBE));
}
short bmp085ReadShort(unsigned char address)
{
f24: df 92 push r13
f26: ef 92 push r14
f28: ff 92 push r15
f2a: 0f 93 push r16
f2c: 1f 93 push r17
f2e: 18 2f mov r17, r24
char msb, lsb;
short data;
i2cDisableInt();
f30: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
f34: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
i2cWaitForComplete();
f38: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(BMP085FC); // write 0xEE
f3c: 8e ee ldi r24, 0xEE ; 238
f3e: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
f42: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(address); // write register address
f46: 81 2f mov r24, r17
f48: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
f4c: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendStart();
f50: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
i2cWaitForComplete();
f54: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(BMP085FC+1); // write 0xEF
f58: 8f ee ldi r24, 0xEF ; 239
f5a: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
f5e: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cReceiveByte(1);
f62: 81 e0 ldi r24, 0x01 ; 1
f64: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
i2cWaitForComplete();
f68: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
msb = i2cGetReceivedByte(); // Get MSB result
f6c: 0e 94 a0 0c call 0x1940 ; 0x1940 <i2cGetReceivedByte>
f70: d8 2e mov r13, r24
i2cWaitForComplete();
f72: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cReceiveByte(0);
f76: 80 e0 ldi r24, 0x00 ; 0
f78: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
i2cWaitForComplete();
f7c: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
lsb = i2cGetReceivedByte(); // Get LSB result
f80: 0e 94 a0 0c call 0x1940 ; 0x1940 <i2cGetReceivedByte>
f84: e8 2e mov r14, r24
i2cWaitForComplete();
f86: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendStop();
f8a: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
data = msb << 8;
f8e: 1d 2d mov r17, r13
f90: 00 e0 ldi r16, 0x00 ; 0
data |= lsb;
i2cEnableInt();
f92: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
f96: ff 24 eor r15, r15
f98: e0 2a or r14, r16
f9a: f1 2a or r15, r17
return data;
}
f9c: c7 01 movw r24, r14
f9e: 1f 91 pop r17
fa0: 0f 91 pop r16
fa2: ff 90 pop r15
fa4: ef 90 pop r14
fa6: df 90 pop r13
fa8: 08 95 ret
00000faa <bmp085ReadPressure>:
return (unsigned long) bmp085ReadShort(0xF6);
}
long bmp085ReadPressure(void)
{
faa: ef 92 push r14
fac: ff 92 push r15
fae: 0f 93 push r16
fb0: 1f 93 push r17
long pressure = 0;
i2cDisableInt();
fb2: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
fb6: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
i2cWaitForComplete();
fba: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(BMP085FC); // write 0xEE
fbe: 8e ee ldi r24, 0xEE ; 238
fc0: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
fc4: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(0xF4); // write register address
fc8: 84 ef ldi r24, 0xF4 ; 244
fca: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
fce: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(0x34); // write register data for pressure
fd2: 84 e3 ldi r24, 0x34 ; 52
fd4: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
fd8: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendStop();
fdc: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
milliseconds can be achieved.
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
fe0: 80 e3 ldi r24, 0x30 ; 48
fe2: 95 e7 ldi r25, 0x75 ; 117
fe4: 01 97 sbiw r24, 0x01 ; 1
fe6: f1 f7 brne .-4 ; 0xfe4 <bmp085ReadPressure+0x3a>
_delay_ms(10); // max time is 4.5ms
pressure = bmp085ReadShort(0xF6);
fe8: 86 ef ldi r24, 0xF6 ; 246
fea: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
fee: 7c 01 movw r14, r24
ff0: 00 27 eor r16, r16
ff2: f7 fc sbrc r15, 7
ff4: 00 95 com r16
ff6: 10 2f mov r17, r16
pressure &= 0x0000FFFF;
i2cEnableInt();
ff8: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
ffc: 8f ef ldi r24, 0xFF ; 255
ffe: 9f ef ldi r25, 0xFF ; 255
1000: a0 e0 ldi r26, 0x00 ; 0
1002: b0 e0 ldi r27, 0x00 ; 0
1004: e8 22 and r14, r24
1006: f9 22 and r15, r25
1008: 0a 23 and r16, r26
100a: 1b 23 and r17, r27
return pressure;
//return (long) bmp085ReadShort(0xF6);
}
100c: b7 01 movw r22, r14
100e: c8 01 movw r24, r16
1010: 1f 91 pop r17
1012: 0f 91 pop r16
1014: ff 90 pop r15
1016: ef 90 pop r14
1018: 08 95 ret
0000101a <bmp085ReadTemp>:
return data;
}
unsigned long bmp085ReadTemp(void)
{
i2cDisableInt();
101a: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
101e: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
i2cWaitForComplete();
1022: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(BMP085FC); // write 0xEE
1026: 8e ee ldi r24, 0xEE ; 238
1028: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
102c: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(0xF4); // write register address
1030: 84 ef ldi r24, 0xF4 ; 244
1032: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
1036: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(0x2E); // write register data for temp
103a: 8e e2 ldi r24, 0x2E ; 46
103c: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
1040: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendStop();
1044: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
1048: 80 e3 ldi r24, 0x30 ; 48
104a: 95 e7 ldi r25, 0x75 ; 117
104c: 01 97 sbiw r24, 0x01 ; 1
104e: f1 f7 brne .-4 ; 0x104c <bmp085ReadTemp+0x32>
_delay_ms(10); // max time is 4.5ms
i2cEnableInt();
1050: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
return (unsigned long) bmp085ReadShort(0xF6);
1054: 86 ef ldi r24, 0xF6 ; 246
1056: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
105a: 9c 01 movw r18, r24
105c: 44 27 eor r20, r20
105e: 37 fd sbrc r19, 7
1060: 40 95 com r20
1062: 54 2f mov r21, r20
}
1064: b9 01 movw r22, r18
1066: ca 01 movw r24, r20
1068: 08 95 ret
0000106a <bmp085Convert>:
//return (long) bmp085ReadShort(0xF6);
}
void bmp085Convert(long* temperature, long* pressure)
{
106a: 2f 92 push r2
106c: 3f 92 push r3
106e: 4f 92 push r4
1070: 5f 92 push r5
1072: 6f 92 push r6
1074: 7f 92 push r7
1076: 8f 92 push r8
1078: 9f 92 push r9
107a: af 92 push r10
107c: bf 92 push r11
107e: cf 92 push r12
1080: df 92 push r13
1082: ef 92 push r14
1084: ff 92 push r15
1086: 0f 93 push r16
1088: 1f 93 push r17
108a: df 93 push r29
108c: cf 93 push r28
108e: cd b7 in r28, 0x3d ; 61
1090: de b7 in r29, 0x3e ; 62
1092: 64 97 sbiw r28, 0x14 ; 20
1094: 0f b6 in r0, 0x3f ; 63
1096: f8 94 cli
1098: de bf out 0x3e, r29 ; 62
109a: 0f be out 0x3f, r0 ; 63
109c: cd bf out 0x3d, r28 ; 61
109e: 98 8b std Y+16, r25 ; 0x10
10a0: 8f 87 std Y+15, r24 ; 0x0f
10a2: 7a 8b std Y+18, r23 ; 0x12
10a4: 69 8b std Y+17, r22 ; 0x11
short mb;
short mc;
short md;
//End Globals
ac1 = eeprom_read_word(&EEBMPac1);
10a6: 8b e6 ldi r24, 0x6B ; 107
10a8: 90 e0 ldi r25, 0x00 ; 0
10aa: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10ae: 9e 87 std Y+14, r25 ; 0x0e
10b0: 8d 87 std Y+13, r24 ; 0x0d
ac2 = eeprom_read_word(&EEBMPac2);
10b2: 8d e6 ldi r24, 0x6D ; 109
10b4: 90 e0 ldi r25, 0x00 ; 0
10b6: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10ba: 9c 87 std Y+12, r25 ; 0x0c
10bc: 8b 87 std Y+11, r24 ; 0x0b
ac3 = eeprom_read_word(&EEBMPac3);
10be: 8f e6 ldi r24, 0x6F ; 111
10c0: 90 e0 ldi r25, 0x00 ; 0
10c2: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10c6: 9a 87 std Y+10, r25 ; 0x0a
10c8: 89 87 std Y+9, r24 ; 0x09
ac4 = eeprom_read_word(&EEBMPac4);
10ca: 81 e7 ldi r24, 0x71 ; 113
10cc: 90 e0 ldi r25, 0x00 ; 0
10ce: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10d2: 9e 83 std Y+6, r25 ; 0x06
10d4: 8d 83 std Y+5, r24 ; 0x05
ac5 = eeprom_read_word(&EEBMPac5);
10d6: 83 e7 ldi r24, 0x73 ; 115
10d8: 90 e0 ldi r25, 0x00 ; 0
10da: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10de: 6c 01 movw r12, r24
ac6 = eeprom_read_word(&EEBMPac6);
10e0: 85 e7 ldi r24, 0x75 ; 117
10e2: 90 e0 ldi r25, 0x00 ; 0
10e4: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10e8: 1c 01 movw r2, r24
b1 = eeprom_read_word(&EEBMPb1);
10ea: 87 e7 ldi r24, 0x77 ; 119
10ec: 90 e0 ldi r25, 0x00 ; 0
10ee: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10f2: 9c 8b std Y+20, r25 ; 0x14
10f4: 8b 8b std Y+19, r24 ; 0x13
b2 = eeprom_read_word(&EEBMPb2);
10f6: 89 e7 ldi r24, 0x79 ; 121
10f8: 90 e0 ldi r25, 0x00 ; 0
10fa: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
10fe: 98 87 std Y+8, r25 ; 0x08
1100: 8f 83 std Y+7, r24 ; 0x07
mb = eeprom_read_word(&EEBMPmb);
mc = eeprom_read_word(&EEBMPmc);
1102: 8d e7 ldi r24, 0x7D ; 125
1104: 90 e0 ldi r25, 0x00 ; 0
1106: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
110a: 3c 01 movw r6, r24
md = eeprom_read_word(&EEBMPmd);
110c: 8f e7 ldi r24, 0x7F ; 127
110e: 90 e0 ldi r25, 0x00 ; 0
1110: 0e 94 14 3a call 0x7428 ; 0x7428 <__eerd_word_m324p>
1114: 5c 01 movw r10, r24
unsigned long ut;
long up;
long x1, x2, b5, b6, x3, b3, p;
unsigned long b4, b7;
ut = bmp085ReadTemp();
1116: 0e 94 0d 08 call 0x101a ; 0x101a <bmp085ReadTemp>
ut = bmp085ReadTemp(); // some bug here, have to read twice to get good data
111a: 0e 94 0d 08 call 0x101a ; 0x101a <bmp085ReadTemp>
111e: 7b 01 movw r14, r22
1120: 8c 01 movw r16, r24
up = bmp085ReadPressure();
1122: 0e 94 d5 07 call 0xfaa ; 0xfaa <bmp085ReadPressure>
up = bmp085ReadPressure();
1126: 0e 94 d5 07 call 0xfaa ; 0xfaa <bmp085ReadPressure>
112a: 69 83 std Y+1, r22 ; 0x01
112c: 7a 83 std Y+2, r23 ; 0x02
112e: 8b 83 std Y+3, r24 ; 0x03
1130: 9c 83 std Y+4, r25 ; 0x04
x1 = (ut - (long)ac6) * (long)ac5 >> 15;
1132: 44 24 eor r4, r4
1134: 55 24 eor r5, r5
1136: e2 18 sub r14, r2
1138: f3 08 sbc r15, r3
113a: 04 09 sbc r16, r4
113c: 15 09 sbc r17, r5
113e: 96 01 movw r18, r12
1140: 40 e0 ldi r20, 0x00 ; 0
1142: 50 e0 ldi r21, 0x00 ; 0
1144: c8 01 movw r24, r16
1146: b7 01 movw r22, r14
1148: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
114c: 7b 01 movw r14, r22
114e: 8c 01 movw r16, r24
1150: 7f e0 ldi r23, 0x0F ; 15
1152: 16 95 lsr r17
1154: 07 95 ror r16
1156: f7 94 ror r15
1158: e7 94 ror r14
115a: 7a 95 dec r23
115c: d1 f7 brne .-12 ; 0x1152 <bmp085Convert+0xe8>
x2 = ((long) mc << 11) / (x1 + (long)md);
b5 = x1 + x2;
115e: 88 24 eor r8, r8
1160: 77 fc sbrc r7, 7
1162: 80 94 com r8
1164: 98 2c mov r9, r8
1166: 6b e0 ldi r22, 0x0B ; 11
1168: 66 0c add r6, r6
116a: 77 1c adc r7, r7
116c: 88 1c adc r8, r8
116e: 99 1c adc r9, r9
1170: 6a 95 dec r22
1172: d1 f7 brne .-12 ; 0x1168 <bmp085Convert+0xfe>
1174: cc 24 eor r12, r12
1176: b7 fc sbrc r11, 7
1178: c0 94 com r12
117a: dc 2c mov r13, r12
117c: ae 0c add r10, r14
117e: bf 1c adc r11, r15
1180: c0 1e adc r12, r16
1182: d1 1e adc r13, r17
1184: c4 01 movw r24, r8
1186: b3 01 movw r22, r6
1188: a6 01 movw r20, r12
118a: 95 01 movw r18, r10
118c: 0e 94 98 36 call 0x6d30 ; 0x6d30 <__divmodsi4>
1190: 59 01 movw r10, r18
1192: 6a 01 movw r12, r20
1194: ae 0c add r10, r14
1196: bf 1c adc r11, r15
1198: c0 1e adc r12, r16
119a: d1 1e adc r13, r17
*temperature = (b5 + 8) >> 4;
119c: 88 e0 ldi r24, 0x08 ; 8
119e: 90 e0 ldi r25, 0x00 ; 0
11a0: a0 e0 ldi r26, 0x00 ; 0
11a2: b0 e0 ldi r27, 0x00 ; 0
11a4: a8 0e add r10, r24
11a6: b9 1e adc r11, r25
11a8: ca 1e adc r12, r26
11aa: db 1e adc r13, r27
11ac: d6 01 movw r26, r12
11ae: c5 01 movw r24, r10
11b0: 54 e0 ldi r21, 0x04 ; 4
11b2: b5 95 asr r27
11b4: a7 95 ror r26
11b6: 97 95 ror r25
11b8: 87 95 ror r24
11ba: 5a 95 dec r21
11bc: d1 f7 brne .-12 ; 0x11b2 <bmp085Convert+0x148>
11be: ef 85 ldd r30, Y+15 ; 0x0f
11c0: f8 89 ldd r31, Y+16 ; 0x10
11c2: 80 83 st Z, r24
11c4: 91 83 std Z+1, r25 ; 0x01
11c6: a2 83 std Z+2, r26 ; 0x02
11c8: b3 83 std Z+3, r27 ; 0x03
b6 = b5 - 4000;
11ca: 88 e5 ldi r24, 0x58 ; 88
11cc: 90 ef ldi r25, 0xF0 ; 240
11ce: af ef ldi r26, 0xFF ; 255
11d0: bf ef ldi r27, 0xFF ; 255
11d2: a8 0e add r10, r24
11d4: b9 1e adc r11, r25
11d6: ca 1e adc r12, r26
11d8: db 1e adc r13, r27
x1 = (b2 * (b6 * b6 >> 12)) >> 11;
11da: c6 01 movw r24, r12
11dc: b5 01 movw r22, r10
11de: a6 01 movw r20, r12
11e0: 95 01 movw r18, r10
11e2: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
11e6: 3b 01 movw r6, r22
11e8: 4c 01 movw r8, r24
11ea: 4c e0 ldi r20, 0x0C ; 12
11ec: 95 94 asr r9
11ee: 87 94 ror r8
11f0: 77 94 ror r7
11f2: 67 94 ror r6
11f4: 4a 95 dec r20
11f6: d1 f7 brne .-12 ; 0x11ec <bmp085Convert+0x182>
x3 = x1 + x2;
b3 = (((int32_t) ac1 * 4 + x3) + 2)/4;
x1 = ac3 * b6 >> 13;
x2 = (b1 * (b6 * b6 >> 12)) >> 16;
x3 = ((x1 + x2) + 2) >> 2;
b4 = (ac4 * (unsigned long) (x3 + 32768)) >> 15;
11f8: a9 85 ldd r26, Y+9 ; 0x09
11fa: ba 85 ldd r27, Y+10 ; 0x0a
11fc: 9d 01 movw r18, r26
11fe: 44 27 eor r20, r20
1200: 37 fd sbrc r19, 7
1202: 40 95 com r20
1204: 54 2f mov r21, r20
1206: c6 01 movw r24, r12
1208: b5 01 movw r22, r10
120a: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
120e: 7b 01 movw r14, r22
1210: 8c 01 movw r16, r24
1212: 3d e0 ldi r19, 0x0D ; 13
1214: 15 95 asr r17
1216: 07 95 ror r16
1218: f7 94 ror r15
121a: e7 94 ror r14
121c: 3a 95 dec r19
121e: d1 f7 brne .-12 ; 0x1214 <bmp085Convert+0x1aa>
1220: 82 e0 ldi r24, 0x02 ; 2
1222: 90 e0 ldi r25, 0x00 ; 0
1224: a0 e0 ldi r26, 0x00 ; 0
1226: b0 e0 ldi r27, 0x00 ; 0
1228: e8 0e add r14, r24
122a: f9 1e adc r15, r25
122c: 0a 1f adc r16, r26
122e: 1b 1f adc r17, r27
1230: ab 89 ldd r26, Y+19 ; 0x13
1232: bc 89 ldd r27, Y+20 ; 0x14
1234: 9d 01 movw r18, r26
1236: 44 27 eor r20, r20
1238: 37 fd sbrc r19, 7
123a: 40 95 com r20
123c: 54 2f mov r21, r20
123e: c4 01 movw r24, r8
1240: b3 01 movw r22, r6
1242: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
1246: bc 01 movw r22, r24
1248: 99 27 eor r25, r25
124a: 77 fd sbrc r23, 7
124c: 90 95 com r25
124e: 89 2f mov r24, r25
1250: e6 0e add r14, r22
1252: f7 1e adc r15, r23
1254: 08 1f adc r16, r24
1256: 19 1f adc r17, r25
1258: 82 e0 ldi r24, 0x02 ; 2
125a: 15 95 asr r17
125c: 07 95 ror r16
125e: f7 94 ror r15
1260: e7 94 ror r14
1262: 8a 95 dec r24
1264: d1 f7 brne .-12 ; 0x125a <bmp085Convert+0x1f0>
1266: 80 e0 ldi r24, 0x00 ; 0
1268: 90 e8 ldi r25, 0x80 ; 128
126a: a0 e0 ldi r26, 0x00 ; 0
126c: b0 e0 ldi r27, 0x00 ; 0
126e: e8 0e add r14, r24
1270: f9 1e adc r15, r25
1272: 0a 1f adc r16, r26
1274: 1b 1f adc r17, r27
1276: ad 81 ldd r26, Y+5 ; 0x05
1278: be 81 ldd r27, Y+6 ; 0x06
127a: 9d 01 movw r18, r26
127c: 40 e0 ldi r20, 0x00 ; 0
127e: 50 e0 ldi r21, 0x00 ; 0
1280: c8 01 movw r24, r16
1282: b7 01 movw r22, r14
1284: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
1288: 1b 01 movw r2, r22
128a: 2c 01 movw r4, r24
128c: 1f e0 ldi r17, 0x0F ; 15
128e: 56 94 lsr r5
1290: 47 94 ror r4
1292: 37 94 ror r3
1294: 27 94 ror r2
1296: 1a 95 dec r17
1298: d1 f7 brne .-12 ; 0x128e <bmp085Convert+0x224>
b7 = ((unsigned long) up - b3) * (50000 >> OSS);
129a: ed 85 ldd r30, Y+13 ; 0x0d
129c: fe 85 ldd r31, Y+14 ; 0x0e
129e: 7f 01 movw r14, r30
12a0: 00 27 eor r16, r16
12a2: f7 fc sbrc r15, 7
12a4: 00 95 com r16
12a6: 10 2f mov r17, r16
12a8: b2 e0 ldi r27, 0x02 ; 2
12aa: ee 0c add r14, r14
12ac: ff 1c adc r15, r15
12ae: 00 1f adc r16, r16
12b0: 11 1f adc r17, r17
12b2: ba 95 dec r27
12b4: d1 f7 brne .-12 ; 0x12aa <bmp085Convert+0x240>
12b6: 82 e0 ldi r24, 0x02 ; 2
12b8: 90 e0 ldi r25, 0x00 ; 0
12ba: a0 e0 ldi r26, 0x00 ; 0
12bc: b0 e0 ldi r27, 0x00 ; 0
12be: e8 0e add r14, r24
12c0: f9 1e adc r15, r25
12c2: 0a 1f adc r16, r26
12c4: 1b 1f adc r17, r27
12c6: ab 85 ldd r26, Y+11 ; 0x0b
12c8: bc 85 ldd r27, Y+12 ; 0x0c
12ca: 9d 01 movw r18, r26
12cc: 44 27 eor r20, r20
12ce: 37 fd sbrc r19, 7
12d0: 40 95 com r20
12d2: 54 2f mov r21, r20
12d4: c6 01 movw r24, r12
12d6: b5 01 movw r22, r10
12d8: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
12dc: ab e0 ldi r26, 0x0B ; 11
12de: 95 95 asr r25
12e0: 87 95 ror r24
12e2: 77 95 ror r23
12e4: 67 95 ror r22
12e6: aa 95 dec r26
12e8: d1 f7 brne .-12 ; 0x12de <bmp085Convert+0x274>
12ea: e6 0e add r14, r22
12ec: f7 1e adc r15, r23
12ee: 08 1f adc r16, r24
12f0: 19 1f adc r17, r25
12f2: ef 81 ldd r30, Y+7 ; 0x07
12f4: f8 85 ldd r31, Y+8 ; 0x08
12f6: 9f 01 movw r18, r30
12f8: 44 27 eor r20, r20
12fa: 37 fd sbrc r19, 7
12fc: 40 95 com r20
12fe: 54 2f mov r21, r20
1300: c4 01 movw r24, r8
1302: b3 01 movw r22, r6
1304: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
1308: fb e0 ldi r31, 0x0B ; 11
130a: 95 95 asr r25
130c: 87 95 ror r24
130e: 77 95 ror r23
1310: 67 95 ror r22
1312: fa 95 dec r31
1314: d1 f7 brne .-12 ; 0x130a <bmp085Convert+0x2a0>
1316: e6 0e add r14, r22
1318: f7 1e adc r15, r23
131a: 08 1f adc r16, r24
131c: 19 1f adc r17, r25
131e: c8 01 movw r24, r16
1320: b7 01 movw r22, r14
1322: 24 e0 ldi r18, 0x04 ; 4
1324: 30 e0 ldi r19, 0x00 ; 0
1326: 40 e0 ldi r20, 0x00 ; 0
1328: 50 e0 ldi r21, 0x00 ; 0
132a: 0e 94 98 36 call 0x6d30 ; 0x6d30 <__divmodsi4>
132e: 89 81 ldd r24, Y+1 ; 0x01
1330: 9a 81 ldd r25, Y+2 ; 0x02
1332: ab 81 ldd r26, Y+3 ; 0x03
1334: bc 81 ldd r27, Y+4 ; 0x04
1336: 82 1b sub r24, r18
1338: 93 0b sbc r25, r19
133a: a4 0b sbc r26, r20
133c: b5 0b sbc r27, r21
133e: 89 83 std Y+1, r24 ; 0x01
1340: 9a 83 std Y+2, r25 ; 0x02
1342: ab 83 std Y+3, r26 ; 0x03
1344: bc 83 std Y+4, r27 ; 0x04
1346: bc 01 movw r22, r24
1348: cd 01 movw r24, r26
134a: 20 e5 ldi r18, 0x50 ; 80
134c: 33 ec ldi r19, 0xC3 ; 195
134e: 40 e0 ldi r20, 0x00 ; 0
1350: 50 e0 ldi r21, 0x00 ; 0
1352: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
p = b7 < 0x80000000 ? (b7 * 2) / b4 : (b7 / b4) * 2;
1356: 97 fd sbrc r25, 7
1358: 0d c0 rjmp .+26 ; 0x1374 <bmp085Convert+0x30a>
135a: 66 0f add r22, r22
135c: 77 1f adc r23, r23
135e: 88 1f adc r24, r24
1360: 99 1f adc r25, r25
1362: a2 01 movw r20, r4
1364: 91 01 movw r18, r2
1366: 0e 94 76 36 call 0x6cec ; 0x6cec <__udivmodsi4>
136a: c9 01 movw r24, r18
136c: da 01 movw r26, r20
136e: 5c 01 movw r10, r24
1370: 6d 01 movw r12, r26
1372: 0a c0 rjmp .+20 ; 0x1388 <bmp085Convert+0x31e>
1374: a2 01 movw r20, r4
1376: 91 01 movw r18, r2
1378: 0e 94 76 36 call 0x6cec ; 0x6cec <__udivmodsi4>
137c: 59 01 movw r10, r18
137e: 6a 01 movw r12, r20
1380: aa 0c add r10, r10
1382: bb 1c adc r11, r11
1384: cc 1c adc r12, r12
1386: dd 1c adc r13, r13
x1 = (p >> 8) * (p >> 8);
1388: 55 27 eor r21, r21
138a: d7 fc sbrc r13, 7
138c: 5a 95 dec r21
138e: 4d 2d mov r20, r13
1390: 3c 2d mov r19, r12
1392: 2b 2d mov r18, r11
x1 = (x1 * 3038) >> 16;
1394: ca 01 movw r24, r20
1396: b9 01 movw r22, r18
1398: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
139c: 2e ed ldi r18, 0xDE ; 222
139e: 3b e0 ldi r19, 0x0B ; 11
13a0: 40 e0 ldi r20, 0x00 ; 0
13a2: 50 e0 ldi r21, 0x00 ; 0
13a4: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
13a8: 7b 01 movw r14, r22
13aa: 8c 01 movw r16, r24
x2 = (-7357 * p) >> 16;
*pressure = p + ((x1 + x2 + 3791) >> 4);
13ac: c6 01 movw r24, r12
13ae: b5 01 movw r22, r10
13b0: 23 e4 ldi r18, 0x43 ; 67
13b2: 33 ee ldi r19, 0xE3 ; 227
13b4: 4f ef ldi r20, 0xFF ; 255
13b6: 5f ef ldi r21, 0xFF ; 255
13b8: 0e 94 38 36 call 0x6c70 ; 0x6c70 <__mulsi3>
13bc: bc 01 movw r22, r24
13be: 99 27 eor r25, r25
13c0: 77 fd sbrc r23, 7
13c2: 90 95 com r25
13c4: 89 2f mov r24, r25
13c6: 61 53 subi r22, 0x31 ; 49
13c8: 71 4f sbci r23, 0xF1 ; 241
13ca: 8f 4f sbci r24, 0xFF ; 255
13cc: 9f 4f sbci r25, 0xFF ; 255
13ce: 78 01 movw r14, r16
13d0: 11 27 eor r17, r17
13d2: f7 fc sbrc r15, 7
13d4: 10 95 com r17
13d6: 01 2f mov r16, r17
13d8: 6e 0d add r22, r14
13da: 7f 1d adc r23, r15
13dc: 80 1f adc r24, r16
13de: 91 1f adc r25, r17
13e0: 24 e0 ldi r18, 0x04 ; 4
13e2: 95 95 asr r25
13e4: 87 95 ror r24
13e6: 77 95 ror r23
13e8: 67 95 ror r22
13ea: 2a 95 dec r18
13ec: d1 f7 brne .-12 ; 0x13e2 <bmp085Convert+0x378>
13ee: 6a 0d add r22, r10
13f0: 7b 1d adc r23, r11
13f2: 8c 1d adc r24, r12
13f4: 9d 1d adc r25, r13
13f6: a9 89 ldd r26, Y+17 ; 0x11
13f8: ba 89 ldd r27, Y+18 ; 0x12
13fa: 6d 93 st X+, r22
13fc: 7d 93 st X+, r23
13fe: 8d 93 st X+, r24
1400: 9c 93 st X, r25
1402: 13 97 sbiw r26, 0x03 ; 3
}
1404: 64 96 adiw r28, 0x14 ; 20
1406: 0f b6 in r0, 0x3f ; 63
1408: f8 94 cli
140a: de bf out 0x3e, r29 ; 62
140c: 0f be out 0x3f, r0 ; 63
140e: cd bf out 0x3d, r28 ; 61
1410: cf 91 pop r28
1412: df 91 pop r29
1414: 1f 91 pop r17
1416: 0f 91 pop r16
1418: ff 90 pop r15
141a: ef 90 pop r14
141c: df 90 pop r13
141e: cf 90 pop r12
1420: bf 90 pop r11
1422: af 90 pop r10
1424: 9f 90 pop r9
1426: 8f 90 pop r8
1428: 7f 90 pop r7
142a: 6f 90 pop r6
142c: 5f 90 pop r5
142e: 4f 90 pop r4
1430: 3f 90 pop r3
1432: 2f 90 pop r2
1434: 08 95 ret
00001436 <BMP085_Calibration>:
extern short EEMEM EEBMPmd;
void BMP085_Calibration(void)
{
eeprom_write_word(&EEBMPac1, bmp085ReadShort(0xAA));
1436: 8a ea ldi r24, 0xAA ; 170
1438: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
143c: bc 01 movw r22, r24
143e: 8b e6 ldi r24, 0x6B ; 107
1440: 90 e0 ldi r25, 0x00 ; 0
1442: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPac2, bmp085ReadShort(0xAC));
1446: 8c ea ldi r24, 0xAC ; 172
1448: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
144c: bc 01 movw r22, r24
144e: 8d e6 ldi r24, 0x6D ; 109
1450: 90 e0 ldi r25, 0x00 ; 0
1452: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPac3, bmp085ReadShort(0xAE));
1456: 8e ea ldi r24, 0xAE ; 174
1458: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
145c: bc 01 movw r22, r24
145e: 8f e6 ldi r24, 0x6F ; 111
1460: 90 e0 ldi r25, 0x00 ; 0
1462: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPac4, bmp085ReadShort(0xB0));
1466: 80 eb ldi r24, 0xB0 ; 176
1468: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
146c: bc 01 movw r22, r24
146e: 81 e7 ldi r24, 0x71 ; 113
1470: 90 e0 ldi r25, 0x00 ; 0
1472: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPac5, bmp085ReadShort(0xB2));
1476: 82 eb ldi r24, 0xB2 ; 178
1478: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
147c: bc 01 movw r22, r24
147e: 83 e7 ldi r24, 0x73 ; 115
1480: 90 e0 ldi r25, 0x00 ; 0
1482: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPac6, bmp085ReadShort(0xB4));
1486: 84 eb ldi r24, 0xB4 ; 180
1488: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
148c: bc 01 movw r22, r24
148e: 85 e7 ldi r24, 0x75 ; 117
1490: 90 e0 ldi r25, 0x00 ; 0
1492: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPb1, bmp085ReadShort(0xB6));
1496: 86 eb ldi r24, 0xB6 ; 182
1498: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
149c: bc 01 movw r22, r24
149e: 87 e7 ldi r24, 0x77 ; 119
14a0: 90 e0 ldi r25, 0x00 ; 0
14a2: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPb2, bmp085ReadShort(0xB8));
14a6: 88 eb ldi r24, 0xB8 ; 184
14a8: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
14ac: bc 01 movw r22, r24
14ae: 89 e7 ldi r24, 0x79 ; 121
14b0: 90 e0 ldi r25, 0x00 ; 0
14b2: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPmb, bmp085ReadShort(0xBA));
14b6: 8a eb ldi r24, 0xBA ; 186
14b8: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
14bc: bc 01 movw r22, r24
14be: 8b e7 ldi r24, 0x7B ; 123
14c0: 90 e0 ldi r25, 0x00 ; 0
14c2: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPmc, bmp085ReadShort(0xBC));
14c6: 8c eb ldi r24, 0xBC ; 188
14c8: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
14cc: bc 01 movw r22, r24
14ce: 8d e7 ldi r24, 0x7D ; 125
14d0: 90 e0 ldi r25, 0x00 ; 0
14d2: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
eeprom_write_word(&EEBMPmd, bmp085ReadShort(0xBE));
14d6: 8e eb ldi r24, 0xBE ; 190
14d8: 0e 94 92 07 call 0xf24 ; 0xf24 <bmp085ReadShort>
14dc: bc 01 movw r22, r24
14de: 8f e7 ldi r24, 0x7F ; 127
14e0: 90 e0 ldi r25, 0x00 ; 0
14e2: 0e 94 3a 3a call 0x7474 ; 0x7474 <__eewr_word_m324p>
}
14e6: 08 95 ret
000014e8 <ds3231read>:
i2cEnableInt();
}
uint8_t ds3231read(uint8_t address)
{
14e8: 1f 93 push r17
14ea: 18 2f mov r17, r24
uint8_t data;
i2cDisableInt();
14ec: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
14f0: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
i2cWaitForComplete();
14f4: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(DS3231FC); // write 0xEE
14f8: 80 ed ldi r24, 0xD0 ; 208
14fa: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
14fe: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(address); // write register address
1502: 81 2f mov r24, r17
1504: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
1508: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendStart();
150c: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
i2cWaitForComplete();
1510: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(DS3231FC+1); // rep start
1514: 81 ed ldi r24, 0xD1 ; 209
1516: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
151a: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cReceiveByte(0);
151e: 80 e0 ldi r24, 0x00 ; 0
1520: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
i2cWaitForComplete();
1524: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
data = i2cGetReceivedByte(); // Get result
1528: 0e 94 a0 0c call 0x1940 ; 0x1940 <i2cGetReceivedByte>
152c: 18 2f mov r17, r24
i2cWaitForComplete();
152e: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendStop();
1532: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
i2cEnableInt();
1536: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
return data;
}
153a: 81 2f mov r24, r17
153c: 1f 91 pop r17
153e: 08 95 ret
00001540 <getDays>:
}
inline uint8_t getDays(void)
{
uint8_t temp = ds3231read(0x03);
1540: 83 e0 ldi r24, 0x03 ; 3
1542: 0e 94 74 0a call 0x14e8 ; 0x14e8 <ds3231read>
1546: 28 2f mov r18, r24
1548: 22 95 swap r18
154a: 2f 70 andi r18, 0x0F ; 15
154c: 30 e0 ldi r19, 0x00 ; 0
154e: a9 01 movw r20, r18
1550: 63 e0 ldi r22, 0x03 ; 3
1552: 44 0f add r20, r20
1554: 55 1f adc r21, r21
1556: 6a 95 dec r22
1558: e1 f7 brne .-8 ; 0x1552 <getDays+0x12>
155a: 22 0f add r18, r18
155c: 33 1f adc r19, r19
155e: 42 0f add r20, r18
1560: 53 1f adc r21, r19
1562: 8f 70 andi r24, 0x0F ; 15
return (temp & 0x0F) + ((temp & 0xF0) >> 4)*10;
}
1564: 84 0f add r24, r20
1566: 08 95 ret
00001568 <getHours>:
}
inline uint8_t getHours(void)
{
uint8_t temp = ds3231read(0x02);
1568: 82 e0 ldi r24, 0x02 ; 2
156a: 0e 94 74 0a call 0x14e8 ; 0x14e8 <ds3231read>
156e: 28 2f mov r18, r24
1570: 30 e0 ldi r19, 0x00 ; 0
1572: 20 73 andi r18, 0x30 ; 48
1574: 30 70 andi r19, 0x00 ; 0
1576: f4 e0 ldi r31, 0x04 ; 4
1578: 35 95 asr r19
157a: 27 95 ror r18
157c: fa 95 dec r31
157e: e1 f7 brne .-8 ; 0x1578 <getHours+0x10>
1580: a9 01 movw r20, r18
1582: e3 e0 ldi r30, 0x03 ; 3
1584: 44 0f add r20, r20
1586: 55 1f adc r21, r21
1588: ea 95 dec r30
158a: e1 f7 brne .-8 ; 0x1584 <getHours+0x1c>
158c: 22 0f add r18, r18
158e: 33 1f adc r19, r19
1590: 42 0f add r20, r18
1592: 53 1f adc r21, r19
1594: 8f 70 andi r24, 0x0F ; 15
return (temp & 0x0F) + ((temp & 0b00110000) >> 4)*10;
}
1596: 84 0f add r24, r20
1598: 08 95 ret
0000159a <getMinutes>:
}
inline uint8_t getMinutes(void)
{
uint8_t temp = ds3231read(0x01);
159a: 81 e0 ldi r24, 0x01 ; 1
159c: 0e 94 74 0a call 0x14e8 ; 0x14e8 <ds3231read>
15a0: 28 2f mov r18, r24
15a2: 22 95 swap r18
15a4: 2f 70 andi r18, 0x0F ; 15
15a6: 30 e0 ldi r19, 0x00 ; 0
15a8: a9 01 movw r20, r18
15aa: b3 e0 ldi r27, 0x03 ; 3
15ac: 44 0f add r20, r20
15ae: 55 1f adc r21, r21
15b0: ba 95 dec r27
15b2: e1 f7 brne .-8 ; 0x15ac <getMinutes+0x12>
15b4: 22 0f add r18, r18
15b6: 33 1f adc r19, r19
15b8: 42 0f add r20, r18
15ba: 53 1f adc r21, r19
15bc: 8f 70 andi r24, 0x0F ; 15
return (temp & 0x0F) + ((temp & 0xF0) >> 4)*10;
}
15be: 84 0f add r24, r20
15c0: 08 95 ret
000015c2 <getSeconds>:
}
inline uint8_t getSeconds(void)
{
uint8_t temp = ds3231read(0x00);
15c2: 80 e0 ldi r24, 0x00 ; 0
15c4: 0e 94 74 0a call 0x14e8 ; 0x14e8 <ds3231read>
15c8: 28 2f mov r18, r24
15ca: 22 95 swap r18
15cc: 2f 70 andi r18, 0x0F ; 15
15ce: 30 e0 ldi r19, 0x00 ; 0
15d0: a9 01 movw r20, r18
15d2: 63 e0 ldi r22, 0x03 ; 3
15d4: 44 0f add r20, r20
15d6: 55 1f adc r21, r21
15d8: 6a 95 dec r22
15da: e1 f7 brne .-8 ; 0x15d4 <getSeconds+0x12>
15dc: 22 0f add r18, r18
15de: 33 1f adc r19, r19
15e0: 42 0f add r20, r18
15e2: 53 1f adc r21, r19
15e4: 8f 70 andi r24, 0x0F ; 15
return (temp & 0x0F) + ((temp & 0xF0) >> 4)*10;
}
15e6: 84 0f add r24, r20
15e8: 08 95 ret
000015ea <ds3231write>:
}
void ds3231write(uint8_t address, uint8_t data)
{
15ea: 0f 93 push r16
15ec: 1f 93 push r17
15ee: 18 2f mov r17, r24
15f0: 06 2f mov r16, r22
i2cDisableInt();
15f2: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
15f6: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
i2cWaitForComplete();
15fa: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(DS3231FC); // write 0xEE
15fe: 80 ed ldi r24, 0xD0 ; 208
1600: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
1604: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(address); // write register address
1608: 81 2f mov r24, r17
160a: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
160e: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendByte(data); // write data address
1612: 80 2f mov r24, r16
1614: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
i2cWaitForComplete();
1618: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
i2cSendStop();
161c: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
i2cEnableInt();
1620: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
}
1624: 1f 91 pop r17
1626: 0f 91 pop r16
1628: 08 95 ret
0000162a <getTime>:
#define STATUS_LED1 3
#define STATUS_LED2 4
#define red_on() ( PORTB |= (1 << STATUS_LED2) )
uint8_t getTime(uint8_t *seconds, uint8_t *minutes, uint8_t *hours, uint8_t *days)
{
162a: 2f 92 push r2
162c: 3f 92 push r3
162e: 4f 92 push r4
1630: 5f 92 push r5
1632: 6f 92 push r6
1634: 7f 92 push r7
1636: 8f 92 push r8
1638: 9f 92 push r9
163a: af 92 push r10
163c: bf 92 push r11
163e: cf 92 push r12
1640: df 92 push r13
1642: ef 92 push r14
1644: ff 92 push r15
1646: 0f 93 push r16
1648: 1f 93 push r17
164a: df 93 push r29
164c: cf 93 push r28
164e: 00 d0 rcall .+0 ; 0x1650 <getTime+0x26>
1650: 00 d0 rcall .+0 ; 0x1652 <getTime+0x28>
1652: 0f 92 push r0
1654: cd b7 in r28, 0x3d ; 61
1656: de b7 in r29, 0x3e ; 62
1658: 7c 01 movw r14, r24
165a: 6b 01 movw r12, r22
165c: 5a 01 movw r10, r20
165e: 49 01 movw r8, r18
uint8_t error;
i2cDisableInt();
1660: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
1664: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
error |= i2cWaitForComplete();
1668: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
166c: 18 2f mov r17, r24
i2cSendByte(DS3231FC); // write 0xEE
166e: 80 ed ldi r24, 0xD0 ; 208
1670: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1674: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1678: 8d 83 std Y+5, r24 ; 0x05
i2cSendByte(0x00); // write register address
167a: 80 e0 ldi r24, 0x00 ; 0
167c: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1680: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1684: 8c 83 std Y+4, r24 ; 0x04
i2cSendStart();
1686: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
error |= i2cWaitForComplete();
168a: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
168e: 8b 83 std Y+3, r24 ; 0x03
i2cSendByte(DS3231FC+1); // rep start
1690: 81 ed ldi r24, 0xD1 ; 209
1692: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1696: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
169a: 8a 83 std Y+2, r24 ; 0x02
i2cReceiveByte(1);
169c: 81 e0 ldi r24, 0x01 ; 1
169e: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
error |= i2cWaitForComplete();
16a2: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
16a6: 28 2e mov r2, r24
*seconds = i2cGetReceivedByte(); // Get seconds
16a8: 0e 94 a0 0c call 0x1940 ; 0x1940 <i2cGetReceivedByte>
16ac: f7 01 movw r30, r14
16ae: 80 83 st Z, r24
error |= i2cWaitForComplete();
16b0: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
16b4: 38 2e mov r3, r24
i2cReceiveByte(1);
16b6: 81 e0 ldi r24, 0x01 ; 1
16b8: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
error |= i2cWaitForComplete();
16bc: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
16c0: 48 2e mov r4, r24
*minutes = i2cGetReceivedByte(); // Get minutes
16c2: 0e 94 a0 0c call 0x1940 ; 0x1940 <i2cGetReceivedByte>
16c6: f6 01 movw r30, r12
16c8: 80 83 st Z, r24
error |= i2cWaitForComplete();
16ca: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
16ce: 58 2e mov r5, r24
i2cReceiveByte(1);
16d0: 81 e0 ldi r24, 0x01 ; 1
16d2: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
error |= i2cWaitForComplete();
16d6: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
16da: 68 2e mov r6, r24
*hours = i2cGetReceivedByte(); // Get hours
16dc: 0e 94 a0 0c call 0x1940 ; 0x1940 <i2cGetReceivedByte>
16e0: f5 01 movw r30, r10
16e2: 80 83 st Z, r24
error |= i2cWaitForComplete();
16e4: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
16e8: 78 2e mov r7, r24
i2cReceiveByte(0);
16ea: 80 e0 ldi r24, 0x00 ; 0
16ec: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
error |= i2cWaitForComplete();
16f0: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
16f4: 08 2f mov r16, r24
*days = i2cGetReceivedByte(); // Get days
16f6: 0e 94 a0 0c call 0x1940 ; 0x1940 <i2cGetReceivedByte>
16fa: f4 01 movw r30, r8
16fc: 80 83 st Z, r24
error |= i2cWaitForComplete();
16fe: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1702: 89 83 std Y+1, r24 ; 0x01
i2cSendStart();
error |= i2cWaitForComplete();
i2cSendByte(DS3231FC); // write 0xEE
error |= i2cWaitForComplete();
1704: fd 81 ldd r31, Y+5 ; 0x05
1706: 1f 2b or r17, r31
i2cSendByte(0x00); // write register address
error |= i2cWaitForComplete();
1708: 8c 81 ldd r24, Y+4 ; 0x04
170a: 18 2b or r17, r24
i2cSendStart();
error |= i2cWaitForComplete();
170c: eb 81 ldd r30, Y+3 ; 0x03
170e: 1e 2b or r17, r30
i2cSendByte(DS3231FC+1); // rep start
error |= i2cWaitForComplete();
1710: fa 81 ldd r31, Y+2 ; 0x02
1712: 1f 2b or r17, r31
i2cReceiveByte(1);
error |= i2cWaitForComplete();
1714: 12 29 or r17, r2
*seconds = i2cGetReceivedByte(); // Get seconds
error |= i2cWaitForComplete();
1716: 13 29 or r17, r3
i2cReceiveByte(1);
error |= i2cWaitForComplete();
1718: 14 29 or r17, r4
*minutes = i2cGetReceivedByte(); // Get minutes
error |= i2cWaitForComplete();
171a: 15 29 or r17, r5
i2cReceiveByte(1);
error |= i2cWaitForComplete();
171c: 16 29 or r17, r6
*hours = i2cGetReceivedByte(); // Get hours
error |= i2cWaitForComplete();
171e: 17 29 or r17, r7
i2cReceiveByte(0);
error |= i2cWaitForComplete();
1720: 10 2b or r17, r16
*days = i2cGetReceivedByte(); // Get days
error |= i2cWaitForComplete();
i2cSendStop();
1722: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
i2cEnableInt();
1726: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
*seconds = (*seconds & 0x0F) + ((*seconds & 0xF0) >> 4)*10;
172a: f7 01 movw r30, r14
172c: 40 81 ld r20, Z
172e: 84 2f mov r24, r20
1730: 82 95 swap r24
1732: 8f 70 andi r24, 0x0F ; 15
1734: 90 e0 ldi r25, 0x00 ; 0
1736: 9c 01 movw r18, r24
1738: a3 e0 ldi r26, 0x03 ; 3
173a: 22 0f add r18, r18
173c: 33 1f adc r19, r19
173e: aa 95 dec r26
1740: e1 f7 brne .-8 ; 0x173a <getTime+0x110>
1742: 88 0f add r24, r24
1744: 99 1f adc r25, r25
1746: 28 0f add r18, r24
1748: 39 1f adc r19, r25
174a: 4f 70 andi r20, 0x0F ; 15
174c: 42 0f add r20, r18
174e: 40 83 st Z, r20
*minutes = (*minutes & 0x0F) + ((*minutes & 0xF0) >> 4)*10;
1750: f6 01 movw r30, r12
1752: 40 81 ld r20, Z
1754: 84 2f mov r24, r20
1756: 82 95 swap r24
1758: 8f 70 andi r24, 0x0F ; 15
175a: 90 e0 ldi r25, 0x00 ; 0
175c: 9c 01 movw r18, r24
175e: 63 e0 ldi r22, 0x03 ; 3
1760: 22 0f add r18, r18
1762: 33 1f adc r19, r19
1764: 6a 95 dec r22
1766: e1 f7 brne .-8 ; 0x1760 <getTime+0x136>
1768: 88 0f add r24, r24
176a: 99 1f adc r25, r25
176c: 28 0f add r18, r24
176e: 39 1f adc r19, r25
1770: 4f 70 andi r20, 0x0F ; 15
1772: 42 0f add r20, r18
1774: 40 83 st Z, r20
*hours = (*hours & 0x0F) + ((*hours & 0b00110000) >> 4)*10;
1776: f5 01 movw r30, r10
1778: 40 81 ld r20, Z
177a: 84 2f mov r24, r20
177c: 90 e0 ldi r25, 0x00 ; 0
177e: 80 73 andi r24, 0x30 ; 48
1780: 90 70 andi r25, 0x00 ; 0
1782: 24 e0 ldi r18, 0x04 ; 4
1784: 95 95 asr r25
1786: 87 95 ror r24
1788: 2a 95 dec r18
178a: e1 f7 brne .-8 ; 0x1784 <getTime+0x15a>
178c: 9c 01 movw r18, r24
178e: 03 e0 ldi r16, 0x03 ; 3
1790: 22 0f add r18, r18
1792: 33 1f adc r19, r19
1794: 0a 95 dec r16
1796: e1 f7 brne .-8 ; 0x1790 <getTime+0x166>
1798: 88 0f add r24, r24
179a: 99 1f adc r25, r25
179c: 28 0f add r18, r24
179e: 39 1f adc r19, r25
17a0: 4f 70 andi r20, 0x0F ; 15
17a2: 42 0f add r20, r18
17a4: 40 83 st Z, r20
*days = (*days & 0x0F) + ((*days & 0xF0) >> 4)*10;
17a6: f4 01 movw r30, r8
17a8: 40 81 ld r20, Z
17aa: 84 2f mov r24, r20
17ac: 82 95 swap r24
17ae: 8f 70 andi r24, 0x0F ; 15
17b0: 90 e0 ldi r25, 0x00 ; 0
17b2: 9c 01 movw r18, r24
17b4: a3 e0 ldi r26, 0x03 ; 3
17b6: 22 0f add r18, r18
17b8: 33 1f adc r19, r19
17ba: aa 95 dec r26
17bc: e1 f7 brne .-8 ; 0x17b6 <getTime+0x18c>
17be: 88 0f add r24, r24
17c0: 99 1f adc r25, r25
17c2: 28 0f add r18, r24
17c4: 39 1f adc r19, r25
17c6: 4f 70 andi r20, 0x0F ; 15
17c8: 42 0f add r20, r18
17ca: 40 83 st Z, r20
return error;
}
17cc: 89 81 ldd r24, Y+1 ; 0x01
17ce: 81 2b or r24, r17
17d0: 0f 90 pop r0
17d2: 0f 90 pop r0
17d4: 0f 90 pop r0
17d6: 0f 90 pop r0
17d8: 0f 90 pop r0
17da: cf 91 pop r28
17dc: df 91 pop r29
17de: 1f 91 pop r17
17e0: 0f 91 pop r16
17e2: ff 90 pop r15
17e4: ef 90 pop r14
17e6: df 90 pop r13
17e8: cf 90 pop r12
17ea: bf 90 pop r11
17ec: af 90 pop r10
17ee: 9f 90 pop r9
17f0: 8f 90 pop r8
17f2: 7f 90 pop r7
17f4: 6f 90 pop r6
17f6: 5f 90 pop r5
17f8: 4f 90 pop r4
17fa: 3f 90 pop r3
17fc: 2f 90 pop r2
17fe: 08 95 ret
00001800 <i2cSetTheDamnTWBRMyself>:
//For some reason, the TWBR calculation doesn't work out properly, so we're
//going to set it ourself, damnit
void i2cSetTheDamnTWBRMyself(uint8_t myOwnTWBR)
{
TWBR = myOwnTWBR;
1800: 80 93 b8 00 sts 0x00B8, r24
}
1804: 08 95 ret
00001806 <i2cSetBitrate>:
// SCL freq = F_CPU/(16+2*TWBR))
#ifdef TWPS0
// for processors with additional bitrate division (mega12)
// SCL freq = F_CPU/(16+2*TWBR*4^TWPS)
// set TWPS to zero
TWSR &= ~(_BV(TWPS0) | _BV(TWPS1));
1806: 20 91 b9 00 lds r18, 0x00B9
180a: 2c 7f andi r18, 0xFC ; 252
180c: 20 93 b9 00 sts 0x00B9, r18
#endif
// calculate bitrate division
//printf("1: %d\n", (uint16_t)(799./100.));
bitrate_div = (uint8_t)(((float)F_CPU/(float)10001))/(float)bitrateKHz;
1810: a0 e0 ldi r26, 0x00 ; 0
1812: b0 e0 ldi r27, 0x00 ; 0
1814: bc 01 movw r22, r24
1816: cd 01 movw r24, r26
1818: 0e 94 23 35 call 0x6a46 ; 0x6a46 <__floatunsisf>
181c: 9b 01 movw r18, r22
181e: ac 01 movw r20, r24
1820: 60 e0 ldi r22, 0x00 ; 0
1822: 70 e0 ldi r23, 0x00 ; 0
1824: 8f e7 ldi r24, 0x7F ; 127
1826: 93 e4 ldi r25, 0x43 ; 67
1828: 0e 94 8a 34 call 0x6914 ; 0x6914 <__divsf3>
182c: 0e 94 f7 34 call 0x69ee ; 0x69ee <__fixunssfsi>
if(bitrate_div >= 16)
1830: 60 31 cpi r22, 0x10 ; 16
1832: 30 f0 brcs .+12 ; 0x1840 <i2cSetBitrate+0x3a>
bitrate_div = (bitrate_div-16)/2;
1834: 86 2f mov r24, r22
1836: 90 e0 ldi r25, 0x00 ; 0
1838: 40 97 sbiw r24, 0x10 ; 16
183a: 95 95 asr r25
183c: 87 95 ror r24
183e: 68 2f mov r22, r24
//printf("bitrate: %d\n", bitrate_div);
//printf("k: %d\n", bitrateKHz);
TWBR = bitrate_div;
1840: 60 93 b8 00 sts 0x00B8, r22
//TWSR |= _BV(TWPS0) | _BV(TWPS1);
//TWBR = 97;
}
1844: 08 95 ret
00001846 <i2cInit>:
sbi(PORTC, 1); // i2c SDA on ATmega163,323,16,32,etc
sbi(PORTD, 0); // i2c SCL on ATmega128,64
sbi(PORTD, 1); // i2c SDA on ATmega128,64*/
// clear SlaveReceive and SlaveTransmit handler to null
i2cSlaveReceive = 0;
1846: 10 92 21 03 sts 0x0321, r1
184a: 10 92 20 03 sts 0x0320, r1
i2cSlaveTransmit = 0;
184e: 10 92 25 03 sts 0x0325, r1
1852: 10 92 24 03 sts 0x0324, r1
// set i2c bit rate to 100KHz
i2cSetBitrate(100);
1856: 84 e6 ldi r24, 0x64 ; 100
1858: 90 e0 ldi r25, 0x00 ; 0
185a: 0e 94 03 0c call 0x1806 ; 0x1806 <i2cSetBitrate>
// enable TWI (two-wire interface)
TWCR |= _BV(TWEN);
185e: ec eb ldi r30, 0xBC ; 188
1860: f0 e0 ldi r31, 0x00 ; 0
1862: 80 81 ld r24, Z
1864: 84 60 ori r24, 0x04 ; 4
1866: 80 83 st Z, r24
// set state
I2cState = I2C_IDLE;
1868: 10 92 d8 02 sts 0x02D8, r1
// enable TWI interrupt and slave address ACK
TWCR |= _BV(TWIE) | _BV(TWEA);
186c: 80 81 ld r24, Z
186e: 81 64 ori r24, 0x41 ; 65
1870: 80 83 st Z, r24
//outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
// enable interrupts
sei();
1872: 78 94 sei
}
1874: 08 95 ret
00001876 <i2cSetLocalDeviceAddr>:
}
//Mask is right-adjusted
void i2cSetLocalDeviceAddr(uint8_t deviceAddr, uint8_t maskAddr, uint8_t genCallEn, uint8_t wsGenCallEn, uint8_t wsGenCallAddr)
{
1876: 0f 93 push r16
// set local device address (used in slave mode only)
TWAR = ((deviceAddr&0xFE) | (genCallEn?1:0));
1878: 90 e0 ldi r25, 0x00 ; 0
187a: 41 11 cpse r20, r1
187c: 91 e0 ldi r25, 0x01 ; 1
187e: 8e 7f andi r24, 0xFE ; 254
1880: 98 2b or r25, r24
1882: 90 93 ba 00 sts 0x00BA, r25
TWAMR = maskAddr << 1;
1886: 66 0f add r22, r22
1888: 60 93 bd 00 sts 0x00BD, r22
I2cWhiteStarGeneralEn = wsGenCallEn;
188c: 20 93 db 02 sts 0x02DB, r18
I2cWhiteStarGeneralAddr = wsGenCallAddr;
1890: 00 93 da 02 sts 0x02DA, r16
}
1894: 0f 91 pop r16
1896: 08 95 ret
00001898 <i2cSetSlaveReceiveHandler>:
void i2cSetSlaveReceiveHandler(void (*i2cSlaveRx_func)(uint8_t receiveDataLength, uint8_t* recieveData))
{
i2cSlaveReceive = i2cSlaveRx_func;
1898: 90 93 21 03 sts 0x0321, r25
189c: 80 93 20 03 sts 0x0320, r24
}
18a0: 08 95 ret
000018a2 <i2cSetSlaveTransmitHandler>:
void i2cSetSlaveTransmitHandler(uint8_t (*i2cSlaveTx_func)(uint8_t transmitDataLengthMax, uint8_t* transmitData))
{
i2cSlaveTransmit = i2cSlaveTx_func;
18a2: 90 93 25 03 sts 0x0325, r25
18a6: 80 93 24 03 sts 0x0324, r24
}
18aa: 08 95 ret
000018ac <i2cSendStart>:
inline void i2cSendStart(void)
{
WRITE_sda();
18ac: 3c 9a sbi 0x07, 4 ; 7
// send start condition
TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);
18ae: 84 ea ldi r24, 0xA4 ; 164
18b0: 80 93 bc 00 sts 0x00BC, r24
}
18b4: 08 95 ret
000018b6 <i2cSendStop>:
inline void i2cSendStop(void)
{
// transmit stop condition,
// leave with TWEA on for slave receiving
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWSTO) | _BV(TWEN);
18b6: 84 ed ldi r24, 0xD4 ; 212
18b8: 80 93 bc 00 sts 0x00BC, r24
}
18bc: 08 95 ret
000018be <i2cDisableInt>:
inline void i2cDisableInt(void)
{
// disable TWI interrupt
TWCR &= ~_BV(TWIE);
18be: ec eb ldi r30, 0xBC ; 188
18c0: f0 e0 ldi r31, 0x00 ; 0
18c2: 80 81 ld r24, Z
18c4: 8e 7f andi r24, 0xFE ; 254
18c6: 80 83 st Z, r24
}
18c8: 08 95 ret
000018ca <i2cEnableInt>:
inline void i2cEnableInt(void)
{
TWCR |= _BV(TWIE);
18ca: ec eb ldi r30, 0xBC ; 188
18cc: f0 e0 ldi r31, 0x00 ; 0
18ce: 80 81 ld r24, Z
18d0: 81 60 ori r24, 0x01 ; 1
18d2: 80 83 st Z, r24
}
18d4: 08 95 ret
000018d6 <i2cWaitForComplete>:
uint8_t i2cWaitForComplete(void)
{
18d6: df 93 push r29
18d8: cf 93 push r28
18da: 0f 92 push r0
18dc: cd b7 in r28, 0x3d ; 61
18de: de b7 in r29, 0x3e ; 62
// wait for i2c interface to complete operation
volatile uint8_t i = 0;
18e0: 19 82 std Y+1, r1 ; 0x01
18e2: 28 eb ldi r18, 0xB8 ; 184
18e4: 3b e0 ldi r19, 0x0B ; 11
18e6: 06 c0 rjmp .+12 ; 0x18f4 <i2cWaitForComplete+0x1e>
while( !(TWCR & _BV(TWINT) ) && i < 100 )
{
i++;
18e8: 89 81 ldd r24, Y+1 ; 0x01
18ea: 8f 5f subi r24, 0xFF ; 255
18ec: 89 83 std Y+1, r24 ; 0x01
18ee: c9 01 movw r24, r18
18f0: 01 97 sbiw r24, 0x01 ; 1
18f2: f1 f7 brne .-4 ; 0x18f0 <i2cWaitForComplete+0x1a>
uint8_t i2cWaitForComplete(void)
{
// wait for i2c interface to complete operation
volatile uint8_t i = 0;
while( !(TWCR & _BV(TWINT) ) && i < 100 )
18f4: 80 91 bc 00 lds r24, 0x00BC
18f8: 87 fd sbrc r24, 7
18fa: 03 c0 rjmp .+6 ; 0x1902 <i2cWaitForComplete+0x2c>
18fc: 89 81 ldd r24, Y+1 ; 0x01
18fe: 84 36 cpi r24, 0x64 ; 100
1900: 98 f3 brcs .-26 ; 0x18e8 <i2cWaitForComplete+0x12>
{
i++;
_delay_ms(1);
}
if(i >= 99)
1902: 89 81 ldd r24, Y+1 ; 0x01
1904: 90 e0 ldi r25, 0x00 ; 0
1906: 83 36 cpi r24, 0x63 ; 99
1908: 08 f0 brcs .+2 ; 0x190c <i2cWaitForComplete+0x36>
190a: 91 e0 ldi r25, 0x01 ; 1
{
return 1;
}
return 0;
}
190c: 89 2f mov r24, r25
190e: 0f 90 pop r0
1910: cf 91 pop r28
1912: df 91 pop r29
1914: 08 95 ret
00001916 <i2cSendByte>:
inline void i2cSendByte(uint8_t data)
{
WRITE_sda();
1916: 3c 9a sbi 0x07, 4 ; 7
// save data to the TWDR
TWDR = data;
1918: 80 93 bb 00 sts 0x00BB, r24
// begin send
TWCR = _BV(TWINT)|_BV(TWEN);
191c: 84 e8 ldi r24, 0x84 ; 132
191e: 80 93 bc 00 sts 0x00BC, r24
}
1922: 08 95 ret
00001924 <i2cReceiveByte>:
inline void i2cReceiveByte(uint8_t ackFlag)
{
// begin receive over i2c
if( ackFlag )
1924: 88 23 and r24, r24
1926: 29 f0 breq .+10 ; 0x1932 <i2cReceiveByte+0xe>
{
// ackFlag = TRUE: ACK the recevied data
TWCR = (TWCR & TWCR_CMD_MASK) | _BV(TWINT) | _BV(TWEA);
1928: 80 91 bc 00 lds r24, 0x00BC
192c: 8f 70 andi r24, 0x0F ; 15
192e: 80 6c ori r24, 0xC0 ; 192
1930: 04 c0 rjmp .+8 ; 0x193a <i2cReceiveByte+0x16>
}
else
{
// ackFlag = FALSE: NACK the recevied data
TWCR = (TWCR & TWCR_CMD_MASK) | _BV(TWINT);
1932: 80 91 bc 00 lds r24, 0x00BC
1936: 8f 70 andi r24, 0x0F ; 15
1938: 80 68 ori r24, 0x80 ; 128
193a: 80 93 bc 00 sts 0x00BC, r24
193e: 08 95 ret
00001940 <i2cGetReceivedByte>:
}
inline uint8_t i2cGetReceivedByte(void)
{
// retieve received data byte from i2c TWDR
return( TWDR );
1940: 80 91 bb 00 lds r24, 0x00BB
}
1944: 08 95 ret
00001946 <i2cGetStatus>:
inline uint8_t i2cGetStatus(void)
{
// retieve current i2c status from i2c TWSR
return( TWSR );
1946: 80 91 b9 00 lds r24, 0x00B9
}
194a: 08 95 ret
0000194c <i2cMasterSend>:
void i2cMasterSend(uint8_t deviceAddr, uint8_t length, uint8_t* data)
{
194c: 98 2f mov r25, r24
uint8_t i;
// wait for interface to be ready
while(I2cState);
194e: 80 91 d8 02 lds r24, 0x02D8
1952: 88 23 and r24, r24
1954: e1 f7 brne .-8 ; 0x194e <i2cMasterSend+0x2>
// set state
I2cState = I2C_MASTER_TX;
1956: 82 e0 ldi r24, 0x02 ; 2
1958: 80 93 d8 02 sts 0x02D8, r24
// save data
I2cDeviceAddrRW = (deviceAddr & 0xFE); // RW cleared: write operation
195c: 9e 7f andi r25, 0xFE ; 254
195e: 90 93 d9 02 sts 0x02D9, r25
1962: ac ed ldi r26, 0xDC ; 220
1964: b2 e0 ldi r27, 0x02 ; 2
1966: fa 01 movw r30, r20
1968: 02 c0 rjmp .+4 ; 0x196e <i2cMasterSend+0x22>
for(i=0; i<length; i++)
I2cSendData[i] = *data++;
196a: 81 91 ld r24, Z+
196c: 8d 93 st X+, r24
while(I2cState);
// set state
I2cState = I2C_MASTER_TX;
// save data
I2cDeviceAddrRW = (deviceAddr & 0xFE); // RW cleared: write operation
for(i=0; i<length; i++)
196e: 8e 2f mov r24, r30
1970: 84 1b sub r24, r20
1972: 86 17 cp r24, r22
1974: d0 f3 brcs .-12 ; 0x196a <i2cMasterSend+0x1e>
I2cSendData[i] = *data++;
I2cSendDataIndex = 0;
1976: 10 92 fc 02 sts 0x02FC, r1
I2cSendDataLength = length;
197a: 60 93 fd 02 sts 0x02FD, r22
i2cSlaveTransmit = i2cSlaveTx_func;
}
inline void i2cSendStart(void)
{
WRITE_sda();
197e: 3c 9a sbi 0x07, 4 ; 7
// send start condition
TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);
1980: 84 ea ldi r24, 0xA4 ; 164
1982: 80 93 bc 00 sts 0x00BC, r24
I2cSendData[i] = *data++;
I2cSendDataIndex = 0;
I2cSendDataLength = length;
// send start condition
i2cSendStart();
}
1986: 08 95 ret
00001988 <i2cMasterReceive>:
void i2cMasterReceive(uint8_t deviceAddr, uint8_t length, uint8_t* data)
{
1988: 98 2f mov r25, r24
uint8_t i;
// wait for interface to be ready
while(I2cState);
198a: 80 91 d8 02 lds r24, 0x02D8
198e: 88 23 and r24, r24
1990: e1 f7 brne .-8 ; 0x198a <i2cMasterReceive+0x2>
// set state
I2cState = I2C_MASTER_RX;
1992: 83 e0 ldi r24, 0x03 ; 3
1994: 80 93 d8 02 sts 0x02D8, r24
// save data
I2cDeviceAddrRW = (deviceAddr|0x01); // RW set: read operation
1998: 91 60 ori r25, 0x01 ; 1
199a: 90 93 d9 02 sts 0x02D9, r25
I2cReceiveDataIndex = 0;
199e: 10 92 1e 03 sts 0x031E, r1
I2cReceiveDataLength = length;
19a2: 60 93 1f 03 sts 0x031F, r22
i2cSlaveTransmit = i2cSlaveTx_func;
}
inline void i2cSendStart(void)
{
WRITE_sda();
19a6: 3c 9a sbi 0x07, 4 ; 7
// send start condition
TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);
19a8: 84 ea ldi r24, 0xA4 ; 164
19aa: 80 93 bc 00 sts 0x00BC, r24
I2cReceiveDataIndex = 0;
I2cReceiveDataLength = length;
// send start condition
i2cSendStart();
// wait for data
while(I2cState);
19ae: 80 91 d8 02 lds r24, 0x02D8
19b2: 88 23 and r24, r24
19b4: e1 f7 brne .-8 ; 0x19ae <i2cMasterReceive+0x26>
19b6: ae ef ldi r26, 0xFE ; 254
19b8: b2 e0 ldi r27, 0x02 ; 2
19ba: fa 01 movw r30, r20
19bc: 02 c0 rjmp .+4 ; 0x19c2 <i2cMasterReceive+0x3a>
// return data
for(i=0; i<length; i++)
*data++ = I2cReceiveData[i];
19be: 8d 91 ld r24, X+
19c0: 81 93 st Z+, r24
// send start condition
i2cSendStart();
// wait for data
while(I2cState);
// return data
for(i=0; i<length; i++)
19c2: 8e 2f mov r24, r30
19c4: 84 1b sub r24, r20
19c6: 86 17 cp r24, r22
19c8: d0 f3 brcs .-12 ; 0x19be <i2cMasterReceive+0x36>
*data++ = I2cReceiveData[i];
}
19ca: 08 95 ret
000019cc <i2cMasterSendNI>:
uint8_t i2cMasterSendNI(uint8_t deviceAddr, uint8_t length, uint8_t* data)
{
19cc: 0f 93 push r16
19ce: 1f 93 push r17
19d0: cf 93 push r28
19d2: df 93 push r29
19d4: 18 2f mov r17, r24
19d6: 06 2f mov r16, r22
19d8: ea 01 movw r28, r20
uint8_t retval = I2C_OK;
// disable TWI interrupt
TWCR &= ~_BV(TWIE);
19da: 80 91 bc 00 lds r24, 0x00BC
19de: 8e 7f andi r24, 0xFE ; 254
19e0: 80 93 bc 00 sts 0x00BC, r24
i2cSlaveTransmit = i2cSlaveTx_func;
}
inline void i2cSendStart(void)
{
WRITE_sda();
19e4: 3c 9a sbi 0x07, 4 ; 7
// send start condition
TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);
19e6: 84 ea ldi r24, 0xA4 ; 164
19e8: 80 93 bc 00 sts 0x00BC, r24
// disable TWI interrupt
TWCR &= ~_BV(TWIE);
// send start condition
i2cSendStart();
i2cWaitForComplete();
19ec: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
// send device address with write
i2cSendByte( deviceAddr & 0xFE );
19f0: 1e 7f andi r17, 0xFE ; 254
return 0;
}
inline void i2cSendByte(uint8_t data)
{
WRITE_sda();
19f2: 3c 9a sbi 0x07, 4 ; 7
// save data to the TWDR
TWDR = data;
19f4: 10 93 bb 00 sts 0x00BB, r17
// begin send
TWCR = _BV(TWINT)|_BV(TWEN);
19f8: 84 e8 ldi r24, 0x84 ; 132
19fa: 80 93 bc 00 sts 0x00BC, r24
i2cSendStart();
i2cWaitForComplete();
// send device address with write
i2cSendByte( deviceAddr & 0xFE );
i2cWaitForComplete();
19fe: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
// check if device is present and live
if( TWSR == TW_MT_SLA_ACK )
1a02: 80 91 b9 00 lds r24, 0x00B9
1a06: 88 31 cpi r24, 0x18 ; 24
1a08: 61 f0 breq .+24 ; 0x1a22 <i2cMasterSendNI+0x56>
1a0a: 91 e0 ldi r25, 0x01 ; 1
1a0c: 0e c0 rjmp .+28 ; 0x1a2a <i2cMasterSendNI+0x5e>
{
// send data
while(length)
{
i2cSendByte( *data++ );
1a0e: 89 91 ld r24, Y+
return 0;
}
inline void i2cSendByte(uint8_t data)
{
WRITE_sda();
1a10: 3c 9a sbi 0x07, 4 ; 7
// save data to the TWDR
TWDR = data;
1a12: 80 93 bb 00 sts 0x00BB, r24
// begin send
TWCR = _BV(TWINT)|_BV(TWEN);
1a16: 10 93 bc 00 sts 0x00BC, r17
{
// send data
while(length)
{
i2cSendByte( *data++ );
i2cWaitForComplete();
1a1a: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
length--;
1a1e: 01 50 subi r16, 0x01 ; 1
1a20: 01 c0 rjmp .+2 ; 0x1a24 <i2cMasterSendNI+0x58>
{
WRITE_sda();
// save data to the TWDR
TWDR = data;
// begin send
TWCR = _BV(TWINT)|_BV(TWEN);
1a22: 14 e8 ldi r17, 0x84 ; 132
// check if device is present and live
if( TWSR == TW_MT_SLA_ACK )
{
// send data
while(length)
1a24: 00 23 and r16, r16
1a26: 99 f7 brne .-26 ; 0x1a0e <i2cMasterSendNI+0x42>
1a28: 90 e0 ldi r25, 0x00 ; 0
inline void i2cSendStop(void)
{
// transmit stop condition,
// leave with TWEA on for slave receiving
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWSTO) | _BV(TWEN);
1a2a: 84 ed ldi r24, 0xD4 ; 212
1a2c: 80 93 bc 00 sts 0x00BC, r24
}
// transmit stop condition
// leave with TWEA on for slave receiving
i2cSendStop();
while( !(TWCR & _BV(TWSTO)) );
1a30: 80 91 bc 00 lds r24, 0x00BC
1a34: 84 ff sbrs r24, 4
1a36: fc cf rjmp .-8 ; 0x1a30 <i2cMasterSendNI+0x64>
// enable TWI interrupt
TWCR |= _BV(TWIE);
1a38: 80 91 bc 00 lds r24, 0x00BC
1a3c: 81 60 ori r24, 0x01 ; 1
1a3e: 80 93 bc 00 sts 0x00BC, r24
return retval;
}
1a42: 89 2f mov r24, r25
1a44: df 91 pop r29
1a46: cf 91 pop r28
1a48: 1f 91 pop r17
1a4a: 0f 91 pop r16
1a4c: 08 95 ret
00001a4e <i2cMasterReceiveNI>:
uint8_t i2cMasterReceiveNI(uint8_t deviceAddr, uint8_t length, uint8_t *data)
{
1a4e: 0f 93 push r16
1a50: 1f 93 push r17
1a52: cf 93 push r28
1a54: df 93 push r29
1a56: 18 2f mov r17, r24
1a58: 06 2f mov r16, r22
1a5a: ea 01 movw r28, r20
uint8_t retval = I2C_OK;
// disable TWI interrupt
TWCR &= ~_BV(TWIE);
1a5c: 80 91 bc 00 lds r24, 0x00BC
1a60: 8e 7f andi r24, 0xFE ; 254
1a62: 80 93 bc 00 sts 0x00BC, r24
i2cSlaveTransmit = i2cSlaveTx_func;
}
inline void i2cSendStart(void)
{
WRITE_sda();
1a66: 3c 9a sbi 0x07, 4 ; 7
// send start condition
TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);
1a68: 84 ea ldi r24, 0xA4 ; 164
1a6a: 80 93 bc 00 sts 0x00BC, r24
// disable TWI interrupt
TWCR &= ~_BV(TWIE);
// send start condition
i2cSendStart();
i2cWaitForComplete();
1a6e: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
// send device address with read
i2cSendByte( deviceAddr | 0x01 );
1a72: 11 60 ori r17, 0x01 ; 1
return 0;
}
inline void i2cSendByte(uint8_t data)
{
WRITE_sda();
1a74: 3c 9a sbi 0x07, 4 ; 7
// save data to the TWDR
TWDR = data;
1a76: 10 93 bb 00 sts 0x00BB, r17
// begin send
TWCR = _BV(TWINT)|_BV(TWEN);
1a7a: 84 e8 ldi r24, 0x84 ; 132
1a7c: 80 93 bc 00 sts 0x00BC, r24
i2cSendStart();
i2cWaitForComplete();
// send device address with read
i2cSendByte( deviceAddr | 0x01 );
i2cWaitForComplete();
1a80: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
// check if device is present and live
if( TWSR == TW_MR_SLA_ACK)
1a84: 80 91 b9 00 lds r24, 0x00B9
1a88: 80 34 cpi r24, 0x40 ; 64
1a8a: 59 f0 breq .+22 ; 0x1aa2 <i2cMasterReceiveNI+0x54>
1a8c: 91 e0 ldi r25, 0x01 ; 1
1a8e: 14 c0 rjmp .+40 ; 0x1ab8 <i2cMasterReceiveNI+0x6a>
{
// accept receive data and ack it
while(length > 1)
{
i2cReceiveByte(TRUE);
1a90: 81 e0 ldi r24, 0x01 ; 1
1a92: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
i2cWaitForComplete();
1a96: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
}
inline uint8_t i2cGetReceivedByte(void)
{
// retieve received data byte from i2c TWDR
return( TWDR );
1a9a: 80 91 bb 00 lds r24, 0x00BB
// accept receive data and ack it
while(length > 1)
{
i2cReceiveByte(TRUE);
i2cWaitForComplete();
*data++ = i2cGetReceivedByte();
1a9e: 89 93 st Y+, r24
// decrement length
length--;
1aa0: 01 50 subi r16, 0x01 ; 1
// check if device is present and live
if( TWSR == TW_MR_SLA_ACK)
{
// accept receive data and ack it
while(length > 1)
1aa2: 02 30 cpi r16, 0x02 ; 2
1aa4: a8 f7 brcc .-22 ; 0x1a90 <i2cMasterReceiveNI+0x42>
// decrement length
length--;
}
// accept receive data and nack it (last-byte signal)
i2cReceiveByte(FALSE);
1aa6: 80 e0 ldi r24, 0x00 ; 0
1aa8: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
i2cWaitForComplete();
1aac: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
}
inline uint8_t i2cGetReceivedByte(void)
{
// retieve received data byte from i2c TWDR
return( TWDR );
1ab0: 80 91 bb 00 lds r24, 0x00BB
}
// accept receive data and nack it (last-byte signal)
i2cReceiveByte(FALSE);
i2cWaitForComplete();
*data++ = i2cGetReceivedByte();
1ab4: 88 83 st Y, r24
1ab6: 90 e0 ldi r25, 0x00 ; 0
inline void i2cSendStop(void)
{
// transmit stop condition,
// leave with TWEA on for slave receiving
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWSTO) | _BV(TWEN);
1ab8: 84 ed ldi r24, 0xD4 ; 212
1aba: 80 93 bc 00 sts 0x00BC, r24
// transmit stop condition
// leave with TWEA on for slave receiving
i2cSendStop();
// enable TWI interrupt
TWCR |= _BV(TWIE);
1abe: 80 91 bc 00 lds r24, 0x00BC
1ac2: 81 60 ori r24, 0x01 ; 1
1ac4: 80 93 bc 00 sts 0x00BC, r24
return retval;
}
1ac8: 89 2f mov r24, r25
1aca: df 91 pop r29
1acc: cf 91 pop r28
1ace: 1f 91 pop r17
1ad0: 0f 91 pop r16
1ad2: 08 95 ret
00001ad4 <__vector_26>:
}
*/
//! I2C (TWI) interrupt service routine
ISR(TWI_vect)
{
1ad4: 1f 92 push r1
1ad6: 0f 92 push r0
1ad8: 0f b6 in r0, 0x3f ; 63
1ada: 0f 92 push r0
1adc: 11 24 eor r1, r1
1ade: 2f 93 push r18
1ae0: 3f 93 push r19
1ae2: 4f 93 push r20
1ae4: 5f 93 push r21
1ae6: 6f 93 push r22
1ae8: 7f 93 push r23
1aea: 8f 93 push r24
1aec: 9f 93 push r25
1aee: af 93 push r26
1af0: bf 93 push r27
1af2: ef 93 push r30
1af4: ff 93 push r31
//lprintf("In I2C int.\n");
// read status bits
uint8_t status = TWSR & TW_STATUS_MASK;
1af6: 80 91 b9 00 lds r24, 0x00B9
switch(status)
1afa: 88 7f andi r24, 0xF8 ; 248
1afc: 80 36 cpi r24, 0x60 ; 96
1afe: 09 f4 brne .+2 ; 0x1b02 <__vector_26+0x2e>
1b00: a0 c0 rjmp .+320 ; 0x1c42 <__vector_26+0x16e>
1b02: 81 36 cpi r24, 0x61 ; 97
1b04: 70 f5 brcc .+92 ; 0x1b62 <__vector_26+0x8e>
1b06: 88 32 cpi r24, 0x28 ; 40
1b08: 09 f4 brne .+2 ; 0x1b0c <__vector_26+0x38>
1b0a: 5f c0 rjmp .+190 ; 0x1bca <__vector_26+0xf6>
1b0c: 89 32 cpi r24, 0x29 ; 41
1b0e: 98 f4 brcc .+38 ; 0x1b36 <__vector_26+0x62>
1b10: 80 31 cpi r24, 0x10 ; 16
1b12: 09 f4 brne .+2 ; 0x1b16 <__vector_26+0x42>
1b14: 57 c0 rjmp .+174 ; 0x1bc4 <__vector_26+0xf0>
1b16: 81 31 cpi r24, 0x11 ; 17
1b18: 38 f4 brcc .+14 ; 0x1b28 <__vector_26+0x54>
1b1a: 88 23 and r24, r24
1b1c: 09 f4 brne .+2 ; 0x1b20 <__vector_26+0x4c>
1b1e: 16 c1 rjmp .+556 ; 0x1d4c <__vector_26+0x278>
1b20: 88 30 cpi r24, 0x08 ; 8
1b22: 09 f0 breq .+2 ; 0x1b26 <__vector_26+0x52>
1b24: 1a c1 rjmp .+564 ; 0x1d5a <__vector_26+0x286>
1b26: 4e c0 rjmp .+156 ; 0x1bc4 <__vector_26+0xf0>
1b28: 88 31 cpi r24, 0x18 ; 24
1b2a: 09 f4 brne .+2 ; 0x1b2e <__vector_26+0x5a>
1b2c: 4e c0 rjmp .+156 ; 0x1bca <__vector_26+0xf6>
1b2e: 80 32 cpi r24, 0x20 ; 32
1b30: 09 f0 breq .+2 ; 0x1b34 <__vector_26+0x60>
1b32: 13 c1 rjmp .+550 ; 0x1d5a <__vector_26+0x286>
1b34: 69 c0 rjmp .+210 ; 0x1c08 <__vector_26+0x134>
1b36: 80 34 cpi r24, 0x40 ; 64
1b38: 09 f4 brne .+2 ; 0x1b3c <__vector_26+0x68>
1b3a: 78 c0 rjmp .+240 ; 0x1c2c <__vector_26+0x158>
1b3c: 81 34 cpi r24, 0x41 ; 65
1b3e: 38 f4 brcc .+14 ; 0x1b4e <__vector_26+0x7a>
1b40: 80 33 cpi r24, 0x30 ; 48
1b42: 09 f4 brne .+2 ; 0x1b46 <__vector_26+0x72>
1b44: 61 c0 rjmp .+194 ; 0x1c08 <__vector_26+0x134>
1b46: 88 33 cpi r24, 0x38 ; 56
1b48: 09 f0 breq .+2 ; 0x1b4c <__vector_26+0x78>
1b4a: 07 c1 rjmp .+526 ; 0x1d5a <__vector_26+0x286>
1b4c: 5f c0 rjmp .+190 ; 0x1c0c <__vector_26+0x138>
1b4e: 80 35 cpi r24, 0x50 ; 80
1b50: 09 f4 brne .+2 ; 0x1b54 <__vector_26+0x80>
1b52: 60 c0 rjmp .+192 ; 0x1c14 <__vector_26+0x140>
1b54: 88 35 cpi r24, 0x58 ; 88
1b56: 09 f4 brne .+2 ; 0x1b5a <__vector_26+0x86>
1b58: 4b c0 rjmp .+150 ; 0x1bf0 <__vector_26+0x11c>
1b5a: 88 34 cpi r24, 0x48 ; 72
1b5c: 09 f0 breq .+2 ; 0x1b60 <__vector_26+0x8c>
1b5e: fd c0 rjmp .+506 ; 0x1d5a <__vector_26+0x286>
1b60: 53 c0 rjmp .+166 ; 0x1c08 <__vector_26+0x134>
1b62: 88 39 cpi r24, 0x98 ; 152
1b64: 09 f4 brne .+2 ; 0x1b68 <__vector_26+0x94>
1b66: 9d c0 rjmp .+314 ; 0x1ca2 <__vector_26+0x1ce>
1b68: 89 39 cpi r24, 0x99 ; 153
1b6a: b0 f4 brcc .+44 ; 0x1b98 <__vector_26+0xc4>
1b6c: 88 37 cpi r24, 0x78 ; 120
1b6e: 09 f4 brne .+2 ; 0x1b72 <__vector_26+0x9e>
1b70: 68 c0 rjmp .+208 ; 0x1c42 <__vector_26+0x16e>
1b72: 89 37 cpi r24, 0x79 ; 121
1b74: 38 f4 brcc .+14 ; 0x1b84 <__vector_26+0xb0>
1b76: 88 36 cpi r24, 0x68 ; 104
1b78: 09 f4 brne .+2 ; 0x1b7c <__vector_26+0xa8>
1b7a: 63 c0 rjmp .+198 ; 0x1c42 <__vector_26+0x16e>
1b7c: 80 37 cpi r24, 0x70 ; 112
1b7e: 09 f0 breq .+2 ; 0x1b82 <__vector_26+0xae>
1b80: ec c0 rjmp .+472 ; 0x1d5a <__vector_26+0x286>
1b82: 5f c0 rjmp .+190 ; 0x1c42 <__vector_26+0x16e>
1b84: 88 38 cpi r24, 0x88 ; 136
1b86: 09 f4 brne .+2 ; 0x1b8a <__vector_26+0xb6>
1b88: 8c c0 rjmp .+280 ; 0x1ca2 <__vector_26+0x1ce>
1b8a: 80 39 cpi r24, 0x90 ; 144
1b8c: 09 f4 brne .+2 ; 0x1b90 <__vector_26+0xbc>
1b8e: 79 c0 rjmp .+242 ; 0x1c82 <__vector_26+0x1ae>
1b90: 80 38 cpi r24, 0x80 ; 128
1b92: 09 f0 breq .+2 ; 0x1b96 <__vector_26+0xc2>
1b94: e2 c0 rjmp .+452 ; 0x1d5a <__vector_26+0x286>
1b96: 75 c0 rjmp .+234 ; 0x1c82 <__vector_26+0x1ae>
1b98: 80 3b cpi r24, 0xB0 ; 176
1b9a: 09 f4 brne .+2 ; 0x1b9e <__vector_26+0xca>
1b9c: a1 c0 rjmp .+322 ; 0x1ce0 <__vector_26+0x20c>
1b9e: 81 3b cpi r24, 0xB1 ; 177
1ba0: 38 f4 brcc .+14 ; 0x1bb0 <__vector_26+0xdc>
1ba2: 80 3a cpi r24, 0xA0 ; 160
1ba4: 09 f4 brne .+2 ; 0x1ba8 <__vector_26+0xd4>
1ba6: 81 c0 rjmp .+258 ; 0x1caa <__vector_26+0x1d6>
1ba8: 88 3a cpi r24, 0xA8 ; 168
1baa: 09 f0 breq .+2 ; 0x1bae <__vector_26+0xda>
1bac: d6 c0 rjmp .+428 ; 0x1d5a <__vector_26+0x286>
1bae: 98 c0 rjmp .+304 ; 0x1ce0 <__vector_26+0x20c>
1bb0: 80 3c cpi r24, 0xC0 ; 192
1bb2: 09 f4 brne .+2 ; 0x1bb6 <__vector_26+0xe2>
1bb4: c7 c0 rjmp .+398 ; 0x1d44 <__vector_26+0x270>
1bb6: 88 3c cpi r24, 0xC8 ; 200
1bb8: 09 f4 brne .+2 ; 0x1bbc <__vector_26+0xe8>
1bba: c4 c0 rjmp .+392 ; 0x1d44 <__vector_26+0x270>
1bbc: 88 3b cpi r24, 0xB8 ; 184
1bbe: 09 f0 breq .+2 ; 0x1bc2 <__vector_26+0xee>
1bc0: cc c0 rjmp .+408 ; 0x1d5a <__vector_26+0x286>
1bc2: a6 c0 rjmp .+332 ; 0x1d10 <__vector_26+0x23c>
case TW_REP_START: // 0x10: Sent repeated start condition
#ifdef I2C_DEBUG
printf("I2C: M->START\r\n");
#endif
// send device address
i2cSendByte(I2cDeviceAddrRW);
1bc4: 80 91 d9 02 lds r24, 0x02D9
1bc8: 0e c0 rjmp .+28 ; 0x1be6 <__vector_26+0x112>
case TW_MT_SLA_ACK: // 0x18: Slave address acknowledged
case TW_MT_DATA_ACK: // 0x28: Data acknowledged
#ifdef I2C_DEBUG
printf("I2C: MT->SLA_ACK or DATA_ACK\r\n");
#endif
if(I2cSendDataIndex < I2cSendDataLength)
1bca: 90 91 fc 02 lds r25, 0x02FC
1bce: 80 91 fd 02 lds r24, 0x02FD
1bd2: 98 17 cp r25, r24
1bd4: c8 f4 brcc .+50 ; 0x1c08 <__vector_26+0x134>
{
// send data
i2cSendByte( I2cSendData[I2cSendDataIndex++] );
1bd6: e9 2f mov r30, r25
1bd8: f0 e0 ldi r31, 0x00 ; 0
1bda: e4 52 subi r30, 0x24 ; 36
1bdc: fd 4f sbci r31, 0xFD ; 253
1bde: 80 81 ld r24, Z
1be0: 9f 5f subi r25, 0xFF ; 255
1be2: 90 93 fc 02 sts 0x02FC, r25
return 0;
}
inline void i2cSendByte(uint8_t data)
{
WRITE_sda();
1be6: 3c 9a sbi 0x07, 4 ; 7
// save data to the TWDR
TWDR = data;
1be8: 80 93 bb 00 sts 0x00BB, r24
// begin send
TWCR = _BV(TWINT)|_BV(TWEN);
1bec: 84 e8 ldi r24, 0x84 ; 132
1bee: a7 c0 rjmp .+334 ; 0x1d3e <__vector_26+0x26a>
case TW_MR_DATA_NACK: // 0x58: Data received, NACK reply issued
#ifdef I2C_DEBUG
printf("I2C: MR->DATA_NACK\r\n");
#endif
// store final received data byte
I2cReceiveData[I2cReceiveDataIndex++] = TWDR;
1bf0: 80 91 1e 03 lds r24, 0x031E
1bf4: 90 91 bb 00 lds r25, 0x00BB
1bf8: e8 2f mov r30, r24
1bfa: f0 e0 ldi r31, 0x00 ; 0
1bfc: e2 50 subi r30, 0x02 ; 2
1bfe: fd 4f sbci r31, 0xFD ; 253
1c00: 90 83 st Z, r25
1c02: 8f 5f subi r24, 0xFF ; 255
1c04: 80 93 1e 03 sts 0x031E, r24
inline void i2cSendStop(void)
{
// transmit stop condition,
// leave with TWEA on for slave receiving
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWSTO) | _BV(TWEN);
1c08: 84 ed ldi r24, 0xD4 ; 212
1c0a: a3 c0 rjmp .+326 ; 0x1d52 <__vector_26+0x27e>
//case TW_MR_ARB_LOST: // 0x38: Bus arbitration lost
#ifdef I2C_DEBUG
printf("I2C: MT->ARB_LOST\r\n");
#endif
// release bus
TWCR |= _BV(TWINT);
1c0c: 80 91 bc 00 lds r24, 0x00BC
1c10: 80 68 ori r24, 0x80 ; 128
1c12: 9f c0 rjmp .+318 ; 0x1d52 <__vector_26+0x27e>
case TW_MR_DATA_ACK: // 0x50: Data acknowledged
#ifdef I2C_DEBUG
printf("I2C: MR->DATA_ACK\r\n");
#endif
// store received data byte
I2cReceiveData[I2cReceiveDataIndex++] = TWDR;
1c14: 80 91 1e 03 lds r24, 0x031E
1c18: 90 91 bb 00 lds r25, 0x00BB
1c1c: e8 2f mov r30, r24
1c1e: f0 e0 ldi r31, 0x00 ; 0
1c20: e2 50 subi r30, 0x02 ; 2
1c22: fd 4f sbci r31, 0xFD ; 253
1c24: 90 83 st Z, r25
1c26: 8f 5f subi r24, 0xFF ; 255
1c28: 80 93 1e 03 sts 0x031E, r24
// fall-through to see if more bytes will be received
case TW_MR_SLA_ACK: // 0x40: Slave address acknowledged
#ifdef I2C_DEBUG
printf("I2C: MR->SLA_ACK\r\n");
#endif
if(I2cReceiveDataIndex < (I2cReceiveDataLength-1))
1c2c: 20 91 1e 03 lds r18, 0x031E
1c30: 30 e0 ldi r19, 0x00 ; 0
1c32: 80 91 1f 03 lds r24, 0x031F
1c36: 90 e0 ldi r25, 0x00 ; 0
1c38: 01 97 sbiw r24, 0x01 ; 1
1c3a: 28 17 cp r18, r24
1c3c: 39 07 cpc r19, r25
1c3e: 8c f5 brge .+98 ; 0x1ca2 <__vector_26+0x1ce>
1c40: 2e c0 rjmp .+92 ; 0x1c9e <__vector_26+0x1ca>
#ifdef I2C_DEBUG
printf("I2C: SR->SLA_ACK\r\n");
#endif
//If the address sent is the same as the address in our TWAR register, do stuff.
//Otherwise, maintain the old state.
if( (TWDR & 0xFE) == (TWAR & 0xFE) )
1c42: 90 91 bb 00 lds r25, 0x00BB
1c46: 80 91 ba 00 lds r24, 0x00BA
1c4a: 89 27 eor r24, r25
1c4c: 8e 7f andi r24, 0xFE ; 254
1c4e: 11 f4 brne .+4 ; 0x1c54 <__vector_26+0x180>
#ifdef I2C_DEBUG
printf("I2C: Slave Address Directly\r\n");
#endif
// we are being addressed as slave for writing (data will be received from master)
// set state
I2cState = I2C_SLAVE_RX;
1c50: 85 e0 ldi r24, 0x05 ; 5
1c52: 12 c0 rjmp .+36 ; 0x1c78 <__vector_26+0x1a4>
// prepare buffer
I2cReceiveDataIndex = 0;
// receive data byte and return ACK
TWCR |= _BV(TWINT) | _BV(TWEA);
} else if ( ((TWDR & 0xFE) == I2cWhiteStarGeneralAddr) && I2cWhiteStarGeneralEn)
1c54: 20 91 bb 00 lds r18, 0x00BB
1c58: 30 e0 ldi r19, 0x00 ; 0
1c5a: 2e 7f andi r18, 0xFE ; 254
1c5c: 30 70 andi r19, 0x00 ; 0
1c5e: 80 91 da 02 lds r24, 0x02DA
1c62: 90 e0 ldi r25, 0x00 ; 0
1c64: 28 17 cp r18, r24
1c66: 39 07 cpc r19, r25
1c68: 09 f0 breq .+2 ; 0x1c6c <__vector_26+0x198>
1c6a: 77 c0 rjmp .+238 ; 0x1d5a <__vector_26+0x286>
1c6c: 80 91 db 02 lds r24, 0x02DB
1c70: 88 23 and r24, r24
1c72: 09 f4 brne .+2 ; 0x1c76 <__vector_26+0x1a2>
1c74: 72 c0 rjmp .+228 ; 0x1d5a <__vector_26+0x286>
{
#ifdef I2C_DEBUG
printf("I2C: WSB General Call\r\n");
#endif
//White Star Balloon General Call Mode, GO!
I2cState = I2C_WSB_GENERAL;
1c76: 86 e0 ldi r24, 0x06 ; 6
1c78: 80 93 d8 02 sts 0x02D8, r24
//Prepare Buffer
I2cReceiveDataIndex = 0;
1c7c: 10 92 1e 03 sts 0x031E, r1
1c80: 57 c0 rjmp .+174 ; 0x1d30 <__vector_26+0x25c>
case TW_SR_GCALL_DATA_ACK: // 0x90: data byte has been received, ACK has been returned
#ifdef I2C_DEBUG
printf("I2C: SR->DATA_ACK\r\n");
#endif
// get previously received data byte
I2cReceiveData[I2cReceiveDataIndex++] = TWDR;
1c82: 80 91 1e 03 lds r24, 0x031E
1c86: 90 91 bb 00 lds r25, 0x00BB
1c8a: e8 2f mov r30, r24
1c8c: f0 e0 ldi r31, 0x00 ; 0
1c8e: e2 50 subi r30, 0x02 ; 2
1c90: fd 4f sbci r31, 0xFD ; 253
1c92: 90 83 st Z, r25
1c94: 8f 5f subi r24, 0xFF ; 255
1c96: 80 93 1e 03 sts 0x031E, r24
// check receive buffer status
if(I2cReceiveDataIndex < I2C_RECEIVE_DATA_BUFFER_SIZE)
1c9a: 80 32 cpi r24, 0x20 ; 32
1c9c: 10 f4 brcc .+4 ; 0x1ca2 <__vector_26+0x1ce>
{
// receive data byte and return ACK
i2cReceiveByte(TRUE);
1c9e: 81 e0 ldi r24, 0x01 ; 1
1ca0: 01 c0 rjmp .+2 ; 0x1ca4 <__vector_26+0x1d0>
case TW_SR_GCALL_DATA_NACK: // 0x98: data byte has been received, NACK has been returned
#ifdef I2C_DEBUG
printf("I2C: SR->DATA_NACK\r\n");
#endif
// receive data byte and return NACK
i2cReceiveByte(FALSE);
1ca2: 80 e0 ldi r24, 0x00 ; 0
1ca4: 0e 94 92 0c call 0x1924 ; 0x1924 <i2cReceiveByte>
1ca8: 58 c0 rjmp .+176 ; 0x1d5a <__vector_26+0x286>
case TW_SR_STOP: // 0xA0: STOP or REPEATED START has been received while addressed as slave
#ifdef I2C_DEBUG
printf("I2C: SR->SR_STOP\r\n");
#endif
// switch to SR mode with SLA ACK
TWCR |= _BV(TWINT) | _BV(TWEA);
1caa: 80 91 bc 00 lds r24, 0x00BC
1cae: 80 6c ori r24, 0xC0 ; 192
1cb0: 80 93 bc 00 sts 0x00BC, r24
if(I2cState == I2C_WSB_GENERAL)
1cb4: 80 91 d8 02 lds r24, 0x02D8
1cb8: 86 30 cpi r24, 0x06 ; 6
1cba: 29 f4 brne .+10 ; 0x1cc6 <__vector_26+0x1f2>
{
if(i2cWSBReceive) i2cWSBReceive(I2cReceiveDataIndex, I2cReceiveData);
1cbc: e0 91 22 03 lds r30, 0x0322
1cc0: f0 91 23 03 lds r31, 0x0323
1cc4: 04 c0 rjmp .+8 ; 0x1cce <__vector_26+0x1fa>
} else {
// i2c receive is complete, call i2cSlaveReceive
if(i2cSlaveReceive) i2cSlaveReceive(I2cReceiveDataIndex, I2cReceiveData);
1cc6: e0 91 20 03 lds r30, 0x0320
1cca: f0 91 21 03 lds r31, 0x0321
1cce: 30 97 sbiw r30, 0x00 ; 0
1cd0: 09 f4 brne .+2 ; 0x1cd4 <__vector_26+0x200>
1cd2: 41 c0 rjmp .+130 ; 0x1d56 <__vector_26+0x282>
1cd4: 80 91 1e 03 lds r24, 0x031E
1cd8: 6e ef ldi r22, 0xFE ; 254
1cda: 72 e0 ldi r23, 0x02 ; 2
1cdc: 09 95 icall
1cde: 3b c0 rjmp .+118 ; 0x1d56 <__vector_26+0x282>
#ifdef I2C_DEBUG
printf("I2C: ST->SLA_ACK\r\n");
#endif
//If the address sent is the same as the address in our TWAR register, do stuff.
//Otherwise, maintain the old state.
if( (TWDR & 0xFE) == (TWAR & 0xFE) )
1ce0: 90 91 bb 00 lds r25, 0x00BB
1ce4: 80 91 ba 00 lds r24, 0x00BA
1ce8: 89 27 eor r24, r25
1cea: 8e 7f andi r24, 0xFE ; 254
1cec: b1 f5 brne .+108 ; 0x1d5a <__vector_26+0x286>
{
// we are being addressed as slave for reading (data must be transmitted back to master)
// set state
I2cState = I2C_SLAVE_TX;
1cee: 84 e0 ldi r24, 0x04 ; 4
1cf0: 80 93 d8 02 sts 0x02D8, r24
// request data from application
if(i2cSlaveTransmit) I2cSendDataLength = i2cSlaveTransmit(I2C_SEND_DATA_BUFFER_SIZE, I2cSendData);
1cf4: e0 91 24 03 lds r30, 0x0324
1cf8: f0 91 25 03 lds r31, 0x0325
1cfc: 30 97 sbiw r30, 0x00 ; 0
1cfe: 31 f0 breq .+12 ; 0x1d0c <__vector_26+0x238>
1d00: 80 e2 ldi r24, 0x20 ; 32
1d02: 6c ed ldi r22, 0xDC ; 220
1d04: 72 e0 ldi r23, 0x02 ; 2
1d06: 09 95 icall
1d08: 80 93 fd 02 sts 0x02FD, r24
// reset data index
I2cSendDataIndex = 0;
1d0c: 10 92 fc 02 sts 0x02FC, r1
case TW_ST_DATA_ACK: // 0xB8: data byte has been transmitted, ACK has been received
#ifdef I2C_DEBUG
printf("I2C: ST->DATA_ACK\r\n");
#endif
// transmit data byte
TWDR = I2cSendData[I2cSendDataIndex++];
1d10: 90 91 fc 02 lds r25, 0x02FC
1d14: e9 2f mov r30, r25
1d16: f0 e0 ldi r31, 0x00 ; 0
1d18: e4 52 subi r30, 0x24 ; 36
1d1a: fd 4f sbci r31, 0xFD ; 253
1d1c: 80 81 ld r24, Z
1d1e: 80 93 bb 00 sts 0x00BB, r24
1d22: 9f 5f subi r25, 0xFF ; 255
1d24: 90 93 fc 02 sts 0x02FC, r25
if(I2cSendDataIndex < I2cSendDataLength)
1d28: 80 91 fd 02 lds r24, 0x02FD
1d2c: 98 17 cp r25, r24
1d2e: 20 f4 brcc .+8 ; 0x1d38 <__vector_26+0x264>
// expect ACK to data byte
TWCR |= _BV(TWINT) | _BV(TWEA);
1d30: 80 91 bc 00 lds r24, 0x00BC
1d34: 80 6c ori r24, 0xC0 ; 192
1d36: 03 c0 rjmp .+6 ; 0x1d3e <__vector_26+0x26a>
else
// expect NACK to data byte
TWCR |= _BV(TWINT);
1d38: 80 91 bc 00 lds r24, 0x00BC
1d3c: 80 68 ori r24, 0x80 ; 128
1d3e: 80 93 bc 00 sts 0x00BC, r24
1d42: 0b c0 rjmp .+22 ; 0x1d5a <__vector_26+0x286>
#ifdef I2C_DEBUG
printf("I2C: ST->DATA_NACK or LAST_DATA\r\n");
#endif
// all done
// switch to open slave
TWCR |= _BV(TWINT) | _BV(TWEA);
1d44: 80 91 bc 00 lds r24, 0x00BC
1d48: 80 6c ori r24, 0xC0 ; 192
1d4a: 03 c0 rjmp .+6 ; 0x1d52 <__vector_26+0x27e>
case TW_BUS_ERROR: // 0x00: Bus error due to illegal start or stop condition
#ifdef I2C_DEBUG
printf("I2C: BUS_ERROR\r\n");
#endif
// reset internal hardware and release bus
TWCR |= _BV(TWINT) | _BV(TWSTO) | _BV(TWEA);
1d4c: 80 91 bc 00 lds r24, 0x00BC
1d50: 80 6d ori r24, 0xD0 ; 208
1d52: 80 93 bc 00 sts 0x00BC, r24
// set state
I2cState = I2C_IDLE;
1d56: 10 92 d8 02 sts 0x02D8, r1
break;
}
}
1d5a: ff 91 pop r31
1d5c: ef 91 pop r30
1d5e: bf 91 pop r27
1d60: af 91 pop r26
1d62: 9f 91 pop r25
1d64: 8f 91 pop r24
1d66: 7f 91 pop r23
1d68: 6f 91 pop r22
1d6a: 5f 91 pop r21
1d6c: 4f 91 pop r20
1d6e: 3f 91 pop r19
1d70: 2f 91 pop r18
1d72: 0f 90 pop r0
1d74: 0f be out 0x3f, r0 ; 63
1d76: 0f 90 pop r0
1d78: 1f 90 pop r1
1d7a: 18 95 reti
00001d7c <i2cGetState>:
eI2cStateType i2cGetState(void)
{
return I2cState;
1d7c: 80 91 d8 02 lds r24, 0x02D8
}
1d80: 08 95 ret
00001d82 <get12bit2scomp>:
}
//THIS DOESN'T BELONG HERE, REMOVE IT
int16_t get12bit2scomp(uint16_t value)
{
if(value > 0x7FF)
1d82: 28 e0 ldi r18, 0x08 ; 8
1d84: 80 30 cpi r24, 0x00 ; 0
1d86: 92 07 cpc r25, r18
1d88: 28 f0 brcs .+10 ; 0x1d94 <get12bit2scomp+0x12>
{
return (value&0x7FF) - 2048;
1d8a: 9c 01 movw r18, r24
1d8c: 37 70 andi r19, 0x07 ; 7
1d8e: 20 50 subi r18, 0x00 ; 0
1d90: 38 40 sbci r19, 0x08 ; 8
1d92: 01 c0 rjmp .+2 ; 0x1d96 <get12bit2scomp+0x14>
} else {
return (int16_t)value;
1d94: 9c 01 movw r18, r24
}
}
1d96: c9 01 movw r24, r18
1d98: 08 95 ret
00001d9a <set12bit2scomp>:
uint16_t set12bit2scomp(int16_t value)
{
if(value < 0)
1d9a: 97 ff sbrs r25, 7
1d9c: 04 c0 rjmp .+8 ; 0x1da6 <set12bit2scomp+0xc>
{
return (value + 2048) + 0x800;
1d9e: 9c 01 movw r18, r24
1da0: 20 50 subi r18, 0x00 ; 0
1da2: 30 4f sbci r19, 0xF0 ; 240
1da4: 01 c0 rjmp .+2 ; 0x1da8 <set12bit2scomp+0xe>
} else
{
return (uint16_t)value;
1da6: 9c 01 movw r18, r24
}
}
1da8: c9 01 movw r24, r18
1daa: 08 95 ret
00001dac <setTMP101Thermo>:
return error;
}
uint8_t setTMP101Thermo(uint8_t address, uint8_t data, uint8_t tHigh)
{
1dac: df 92 push r13
1dae: ef 92 push r14
1db0: ff 92 push r15
1db2: 0f 93 push r16
1db4: 1f 93 push r17
1db6: 08 2f mov r16, r24
1db8: d6 2e mov r13, r22
1dba: f4 2e mov r15, r20
uint8_t error;
i2cDisableInt();
1dbc: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
1dc0: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
error |= i2cWaitForComplete();
1dc4: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1dc8: 18 2f mov r17, r24
i2cSendByte(address);
1dca: 80 2f mov r24, r16
1dcc: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1dd0: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1dd4: e8 2e mov r14, r24
i2cSendByte(0b00000010 + tHigh);
1dd6: 8f 2d mov r24, r15
1dd8: 8e 5f subi r24, 0xFE ; 254
1dda: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1dde: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1de2: f8 2e mov r15, r24
i2cSendByte(data);
1de4: 8d 2d mov r24, r13
1de6: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1dea: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1dee: 08 2f mov r16, r24
i2cDisableInt();
i2cSendStart();
error |= i2cWaitForComplete();
i2cSendByte(address);
error |= i2cWaitForComplete();
1df0: 1e 29 or r17, r14
i2cSendByte(0b00000010 + tHigh);
error |= i2cWaitForComplete();
1df2: 1f 29 or r17, r15
i2cSendByte(data);
error |= i2cWaitForComplete();
i2cSendStop();
1df4: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
i2cEnableInt();
1df8: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
return error;
}
1dfc: 81 2f mov r24, r17
1dfe: 80 2b or r24, r16
1e00: 1f 91 pop r17
1e02: 0f 91 pop r16
1e04: ff 90 pop r15
1e06: ef 90 pop r14
1e08: df 90 pop r13
1e0a: 08 95 ret
00001e0c <setTMP100config>:
return data1;
}
uint8_t setTMP100config(uint8_t address, uint8_t data)
{
1e0c: df 92 push r13
1e0e: ef 92 push r14
1e10: ff 92 push r15
1e12: 0f 93 push r16
1e14: 1f 93 push r17
1e16: 08 2f mov r16, r24
1e18: d6 2e mov r13, r22
uint8_t error;
i2cDisableInt();
1e1a: 0e 94 5f 0c call 0x18be ; 0x18be <i2cDisableInt>
i2cSendStart();
1e1e: 0e 94 56 0c call 0x18ac ; 0x18ac <i2cSendStart>
error |= i2cWaitForComplete();
1e22: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1e26: 18 2f mov r17, r24
i2cSendByte(address);
1e28: 80 2f mov r24, r16
1e2a: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1e2e: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1e32: e8 2e mov r14, r24
i2cSendByte(0b00000001);
1e34: 81 e0 ldi r24, 0x01 ; 1
1e36: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1e3a: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1e3e: f8 2e mov r15, r24
i2cSendByte(data);
1e40: 8d 2d mov r24, r13
1e42: 0e 94 8b 0c call 0x1916 ; 0x1916 <i2cSendByte>
error |= i2cWaitForComplete();
1e46: 0e 94 6b 0c call 0x18d6 ; 0x18d6 <i2cWaitForComplete>
1e4a: 08 2f mov r16, r24
i2cDisableInt();
i2cSendStart();
error |= i2cWaitForComplete();
i2cSendByte(address);
error |= i2cWaitForComplete();
1e4c: 1e 29 or r17, r14
i2cSendByte(0b00000001);
error |= i2cWaitForComplete();
1e4e: 1f 29 or r17, r15
i2cSendByte(data);
error |= i2cWaitForComplete();
i2cSendStop();
1e50: 0e 94 5b 0c call 0x18b6 ; 0x18b6 <i2cSendStop>
i2cEnableInt();
1e54: 0e 94 65 0c call 0x18ca ; 0x18ca <i2cEnableInt>
return error;
}
1e58: 81 2f mov r24, r17
1e5a: 80 2b or r24, r16
1e5c: 1f 91 pop r17
1e5e: 0f 91 pop r16
1e60: ff 90 pop r15
1e62: ef 90 pop r14
1e64: df 90 pop r13