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_
36 #include "../common/OWConfig.s"
37 #include "../common/OWCRC8.s"
39 #if defined(__AVR_ATtiny25__)
46 .comm block,1 ; Block der augegeben, geschrieben wird (Parameter von READ/WRITE Scratchpad)
52 ; Ab hier Geraeteabhaenging
53 #define OW_READ_SCRATCHPAD_ADR OW_FIRST_COMMAND+0
54 #define OW_READ_SCRATCHPAD OW_FIRST_COMMAND+1
55 #define OW_WRITE_SCRATCHPAD_ADR OW_FIRST_COMMAND+2
56 #define OW_WRITE_SCRATCHPAD OW_FIRST_COMMAND+3
61 rjmp h_readscratchpad_adr
63 rjmp h_writescratchpad_adr
64 rjmp h_writescratchpad
67 #include "../common/OWRomFunctions.s"
68 #include "../common/OWTimerInterrupt.s"
71 ;---------------------------------------------------
72 ; READ COMMAND and start operation
73 ;---------------------------------------------------
79 FLASH_COMMANDS ; muss zu erst sein....
81 cset 0xBE,OW_READ_SCRATCHPAD_ADR
82 cset 0x4E,OW_WRITE_SCRATCHPAD_ADR
83 cjmp 0x44,hrc_set_convertT
84 cjmp 0xB4,hrc_set_convertV
85 #ifdef _CHANGEABLE_ID_
94 lds r_temp,am2302_temp
96 lds r_temp,am2302_temp+1
104 rjmp hrc_set_convertVV
109 rjmp hrc_set_convertend
111 lds r_temp,am2302_hum
113 lds r_temp,am2302_hum+1
116 rjmp handle_end_sleep
120 ;---------------------------------------------------
122 ;---------------------------------------------------
124 h_readscratchpad_adr:
128 #if defined(__AVR_ATtiny25__)
129 andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen
133 ldi r_mode,OW_READ_SCRATCHPAD
137 breq h_readscratchpad_crc
139 breq h_readscratchpad_all
145 h_readscratchpad_crc:
148 h_readscratchpad_all:
149 rjmp handle_end_sleep
154 ;---------------------------------------------------
156 ;---------------------------------------------------
157 h_writescratchpad_adr:
161 #if defined(__AVR_ATtiny25__)
162 andi r_rwbyte,0x01 ;nur Page 0 und 1 und das immer wiederholen
165 ldi r_mode,OW_WRITE_SCRATCHPAD
170 breq h_writescratchpad_all
176 h_writescratchpad_all:
177 rjmp handle_end_sleep
183 #include "../common/OWPinInterrupt.s"