1 // Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the
14 // * All advertising materials mentioning features or use of this
15 // software must display the following acknowledgement: This product
16 // includes software developed by tm3d.de and its contributors.
17 // * Neither the name of tm3d.de nor the names of its contributors may
18 // be used to endorse or promote products derived from this software
19 // without specific prior written permission.
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #define _CHANGEABLE_ID_
35 #define _ZERO_POLLING_
38 #include "../common/OWConfig.s"
39 #include "../common/OWCRC8.s"
41 #if defined(__AVR_ATtiny25__)
48 .comm block,1 ; Block der augegeben, geschrieben wird (Parameter von READ/WRITE Scratchpad)
54 ; Ab hier Geraeteabhaenging
55 #define OW_READ_SCRATCHPAD_ADR OW_FIRST_COMMAND+0
56 #define OW_READ_SCRATCHPAD OW_FIRST_COMMAND+1
57 #define OW_WRITE_SCRATCHPAD_ADR OW_FIRST_COMMAND+2
58 #define OW_WRITE_SCRATCHPAD OW_FIRST_COMMAND+3
63 rjmp h_readscratchpad_adr
65 rjmp h_writescratchpad_adr
66 rjmp h_writescratchpad
69 #include "../common/OWRomFunctions.s"
70 #include "../common/OWTimerInterrupt.s"
73 ;---------------------------------------------------
74 ; READ COMMAND and start operation
75 ;---------------------------------------------------
81 FLASH_COMMANDS ; muss zu erst sein....
83 cset 0xBE,OW_READ_SCRATCHPAD_ADR
84 cset 0x4E,OW_WRITE_SCRATCHPAD_ADR
85 cjmp 0x44,hrc_set_convertT
86 cjmp 0xB4,hrc_set_convertV
88 #ifdef _CHANGEABLE_ID_
97 lds r_temp,am2302_temp
99 lds r_temp,am2302_temp+1
101 rjmp handle_end_sleep
107 rjmp hrc_set_convertVV
112 rjmp hrc_set_convertend
114 lds r_temp,am2302_hum
116 lds r_temp,am2302_hum+1
119 rjmp handle_end_sleep
123 ;---------------------------------------------------
125 ;---------------------------------------------------
127 h_readscratchpad_adr:
131 #if defined(__AVR_ATtiny25__)
132 andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen
136 ldi r_mode,OW_READ_SCRATCHPAD
140 breq h_readscratchpad_crc
142 breq h_readscratchpad_all
148 h_readscratchpad_crc:
151 h_readscratchpad_all:
152 rjmp handle_end_sleep
157 ;---------------------------------------------------
159 ;---------------------------------------------------
160 h_writescratchpad_adr:
164 #if defined(__AVR_ATtiny25__)
165 andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen
168 ldi r_mode,OW_WRITE_SCRATCHPAD
173 breq h_writescratchpad_all
179 h_writescratchpad_all:
180 rjmp handle_end_sleep
186 #include "../common/OWPinInterrupt.s"