Mercurial > ~darius > hgwebdir.cgi > avr
comparison 1wire-config.h @ 33:0aa6bf4b98ae
- Don't wrap individual debug statements in ifdef, use a conditionally
defined macro instead.
- Add OWProgROM routine, can't remember if I actually tested it tho :)
author | darius |
---|---|
date | Tue, 23 Oct 2007 10:51:35 +0930 |
parents | b0cb873c0206 |
children | 5898fba6593c |
comparison
equal
deleted
inserted
replaced
32:b0cb873c0206 | 33:0aa6bf4b98ae |
---|---|
52 /* Set the 1-wire bus to 1 | 52 /* Set the 1-wire bus to 1 |
53 * Turn the transistor off to let the pullup do its job | 53 * Turn the transistor off to let the pullup do its job |
54 */ | 54 */ |
55 #define OWSETBUSHIGH() PORTD &= ~_BV(4) | 55 #define OWSETBUSHIGH() PORTD &= ~_BV(4) |
56 | 56 |
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) | |
61 | |
57 /* _delay_us can only do a delay of 768/clock_freq */ | 62 /* _delay_us can only do a delay of 768/clock_freq */ |
58 #if F_CPU > 16000000 | 63 #if F_CPU > 16000000 |
59 #error F_CPU > 16MHz, delays need adjusting | 64 #error F_CPU > 16MHz, delays need adjusting |
60 #endif | 65 #endif |
61 | 66 |
68 #define OWDELAY_G /* 0 usec */ | 73 #define OWDELAY_G /* 0 usec */ |
69 #define OWDELAY_H do { _delay_us(48); _delay_us(48); _delay_us(48); \ | 74 #define OWDELAY_H do { _delay_us(48); _delay_us(48); _delay_us(48); \ |
70 _delay_us(48); _delay_us(48); _delay_us(48); _delay_us(48); \ | 75 _delay_us(48); _delay_us(48); _delay_us(48); _delay_us(48); \ |
71 _delay_us(48);_delay_us(48); _delay_us(48); } while (0) /* 480 usec */ | 76 _delay_us(48);_delay_us(48); _delay_us(48); } while (0) /* 480 usec */ |
72 #define OWDELAY_I do { _delay_us(48); _delay_us(22); } while (0) /* 70 usec */ | 77 #define OWDELAY_I do { _delay_us(48); _delay_us(22); } while (0) /* 70 usec */ |
78 | |
79 void uart_putsP(const char *addr); | |
80 void uart_puts(const char *addr); | |
81 void uart_puts_hex(uint8_t a); | |
82 void uart_puts_dec(uint8_t a, uint8_t l); | |
83 #if OW_DEBUG | |
84 void uart_putsP(const char *addr); | |
85 void uart_puts(const char *addr); | |
86 void uart_puts_hex(uint8_t a); | |
87 void uart_puts_dec(uint8_t a, uint8_t l); | |
88 | |
89 #define OWPUTS(x) uart_puts(x) | |
90 #define OWPUTSP(x) uart_putsP(x) | |
91 #else | |
92 #define OWPUTS(x) | |
93 #define OWPUTSP(x) | |
94 #endif | |
95 |