Keep the newer GCC happy.
4 * This is the user servicable stuff - how to do delays and how to
10 * Daniel O'Connor <darius@dons.net.au>. All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * Alter these for your configuration
38 /* Set DDR on the right pins */
39 #define OWBUSINIT() do { \
44 /* Read the 1-wire bus, non-inverting logic */
45 #define OWREADBUS() (PIND & _BV(3) ? 1 : 0)
47 /* Set the 1-wire bus to 0
48 * Turns a transistor on to pull it low
50 #define OWSETBUSLOW() PORTD |= _BV(4)
52 /* Set the 1-wire bus to 1
53 * Turn the transistor off to let the pullup do its job
55 #define OWSETBUSHIGH() PORTD &= ~_BV(4)
57 /* Turn Vpp on (ie put +12V on the bus
58 * This is optional, if it is undefined OWProgROM always fails */
59 #define OWSETVPPON() PORTD |= _BV(5)
60 #define OWSETVPPOFF() PORTD &= ~_BV(5)
62 /* _delay_us can only do a delay of 768/clock_freq */
64 #error F_CPU > 16MHz, delays need adjusting
67 #define OWDELAY_A _delay_us(6) /* 6 usec */
68 #define OWDELAY_B do { _delay_us(48); _delay_us(16); } while (0) /* 64 usec */
69 #define OWDELAY_C do { _delay_us(48); _delay_us(12); } while (0) /* 60 usec */
70 #define OWDELAY_D _delay_us(10) /* 10 usec */
71 #define OWDELAY_E _delay_us(9) /* 9 usec */
72 #define OWDELAY_F do { _delay_us(55); } while (0) /* 55 usec */
73 #define OWDELAY_G /* 0 usec */
74 #define OWDELAY_H do { _delay_us(48); _delay_us(48); _delay_us(48); \
75 _delay_us(48); _delay_us(48); _delay_us(48); _delay_us(48); \
76 _delay_us(48);_delay_us(48); _delay_us(48); } while (0) /* 480 usec */
77 #define OWDELAY_I do { _delay_us(48); _delay_us(22); } while (0) /* 70 usec */
80 #define OWPUTS(x) puts_P(x)
81 #define OWPUTSP(x) puts_P(x)
82 #define OWPRINTFP(fmt, ...) printf_P(fmt, ## __VA_ARGS__)
86 #define OWPRINTFP(fmt, ...)