comparison 1wire.h @ 0:ffeab3c04e83

Initial revision
author darius
date Sun, 11 Jul 2004 00:45:50 +0930
parents
children f9a085a0ba93
comparison
equal deleted inserted replaced
-1:000000000000 0:ffeab3c04e83
1 /* Copyright (c) 2004
2 * Daniel O'Connor <darius@dons.net.au>. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26 int OWTouchReset(void);
27 void OWWriteBit(int bit);
28 int OWReadBit(void);
29 void OWWriteByte(uint8_t data);
30 int OWReadByte(void);
31 int OWTouchByte(uint8_t data);
32 void OWBlock(uint8_t *data, int len);
33 int OWFirst(uint8_t *ROM, uint8_t do_reset, uint8_t alarm_only);
34 int OWNext(uint8_t *ROM, uint8_t do_reset, uint8_t alarm_only);
35 void OWCRC(uint8_t x, uint8_t *crc);
36 void OWSendCmd(uint8_t *ROM, uint8_t cmd);
37
38 #define OWIREOUTPORT PORTC
39 #define OWIREOUTPIN 0
40
41 #define OWIREINPORT PINC
42 #define OWIREDDR DDRC
43 #define OWIREINPIN OWIREOUTPIN
44
45 /* General 1 wire commands */
46 #define OW_OVRDRV_SKIP_CMD 0x3c
47 #define OW_SEARCH_ALRM_CMD 0xec
48 #define OW_SEARCH_ROM_CMD 0xf0
49 #define OW_READ_ROM_CMD 0x33
50 #define OW_MATCH_ROM_CMD 0x55
51 #define OW_SKIP_ROM_CMD 0xcc
52
53 /* DS1820 commands */
54 #define OW_CONVERTT_CMD 0x44
55 #define OW_RD_SCR_CMD 0xbe
56 #define OW_WR_SCR_CMD 0x4e
57 #define OW_CPY_SCR_CMD 0x48
58 #define OW_RECALL_CMD 0xb8
59 #define OW_RD_PSU_CMD 0xb4
60
61 /* Family codes */
62 #define OW_FAMILY_ROM 0x09
63 #define OW_FAMILY_TEMP 0x10