Mercurial > ~darius > hgwebdir.cgi > tempctrl
diff 1wire.h @ 32:b0cb873c0206
Isolate the bus frobbing parts and the delays into a separate header.
This means the user only has to edit a single file to suit their
situation and allows the code to work with active drive systems as
well as passive pullups (ie 1 vs 2 IO pins)
author | darius |
---|---|
date | Sun, 23 Apr 2006 22:57:16 +0930 |
parents | 2b0ed085b95b |
children | 0aa6bf4b98ae |
line wrap: on
line diff
--- a/1wire.h Mon Apr 10 17:27:48 2006 +0930 +++ b/1wire.h Sun Apr 23 22:57:16 2006 +0930 @@ -1,5 +1,5 @@ /* - * 1 wire header code + * 1 wire header which defines functions and constants * * $Id$ * @@ -28,6 +28,7 @@ * SUCH DAMAGE. */ +void OWInit(void); uint8_t OWTouchReset(void); void OWWriteBit(uint8_t bit); uint8_t OWReadBit(void); @@ -40,13 +41,6 @@ void OWCRC(uint8_t x, uint8_t *crc); void OWSendCmd(uint8_t *ROM, uint8_t cmd); -#define OWIREOUTPORT PORTD -#define OWIREOUTPIN 2 - -#define OWIREINPORT PIND -#define OWIREDDR DDRD -#define OWIREINPIN OWIREOUTPIN - /* Return codes for OWFirst()/OWNext() */ #define OW_BADWIRE -3 #define OW_BADCRC -2 @@ -70,6 +64,13 @@ #define OW_RECALL_CMD 0xb8 #define OW_RD_PSU_CMD 0xb4 +/* DS2502 commands */ +#define OW_READ_MEMORY 0xf0 +#define OW_READ_STATUS 0xaa +#define OW_GEN_CRC 0xc3 +#define OW_WRITE_MEMORY 0x0f +#define OW_WRITE_STATUS 0x55 + /* Family codes */ #define OW_FAMILY_ROM 0x09 #define OW_FAMILY_TEMP 0x10