Mercurial > ~darius > hgwebdir.cgi > avr
annotate 1wire-delay.h @ 24:2b0ed085b95b
- Change to 38400 baud.
- Change to ATMega32
- Use interrupt driven serial comms (for rx anyway)
- Reformat.
author | darius |
---|---|
date | Mon, 12 Dec 2005 23:37:16 +1030 |
parents | 8dc98a293e43 |
children |
rev | line source |
---|---|
8
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
1 /* |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
2 * Delay routines for the 1 wire bus |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
3 * Search routine is copied from the Dallas owpd library with mods. |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
4 * |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
5 * $Id$ |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
6 * |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
7 * Copyright (c) 2004 |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
8 * Daniel O'Connor <darius@dons.net.au>. All rights reserved. |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
9 * |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
10 * Redistribution and use in source and binary forms, with or without |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
11 * modification, are permitted provided that the following conditions |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
12 * are met: |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
13 * 1. Redistributions of source code must retain the above copyright |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
14 * notice, this list of conditions and the following disclaimer. |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
15 * 2. Redistributions in binary form must reproduce the above copyright |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
16 * notice, this list of conditions and the following disclaimer in the |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
17 * documentation and/or other materials provided with the distribution. |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
18 * |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
19 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
22 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
29 * SUCH DAMAGE. |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
30 */ |
f9a085a0ba93
Change the 1 wire routines to mostly C with assembly delay routines
darius
parents:
diff
changeset
|
31 |
19
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
32 #define DELAY_A _delay_us(6) /* 6 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
33 #define DELAY_B _delay_us(30); _delay_us(30); _delay_us(4) /* 64 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
34 #define DELAY_C _delay_us(30); _delay_us(30) /* 60 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
35 #define DELAY_D _delay_us(10) /* 10 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
36 #define DELAY_E _delay_us(9) /* 9 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
37 #define DELAY_F _delay_us(25); _delay_us(30); /* 55 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
38 #define DELAY_G /* 0 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
39 #define DELAY_H _delay_us(30); _delay_us(30); _delay_us(30); _delay_us(30); \ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
40 _delay_us(30); _delay_us(30); _delay_us(30); _delay_us(30); \ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
41 _delay_us(30); _delay_us(30); _delay_us(30); _delay_us(30); \ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
42 _delay_us(30); _delay_us(30); _delay_us(30); _delay_us(30) /* 480 usec */ |
8dc98a293e43
Scrap our handle rolled loops and use AVR libc's macros instead.
darius
parents:
10
diff
changeset
|
43 #define DELAY_I _delay_us(30); _delay_us(30);_delay_us(10) /* 70 usec */ |