view 1wire-delay.h @ 23:845934a4e7fe

Add code to talk to a Phillips PDIUSBB12.
author darius
date Mon, 12 Dec 2005 23:32:59 +1030
parents 8dc98a293e43
children
line wrap: on
line source

/*
 * Delay routines for the 1 wire bus
 * Search routine is copied from the Dallas owpd library with mods.
 *
 * $Id$
 *
 * Copyright (c) 2004
 *      Daniel O'Connor <darius@dons.net.au>.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#define DELAY_A _delay_us(6)						/* 6 usec */
#define DELAY_B _delay_us(30); _delay_us(30); _delay_us(4)		/* 64 usec */
#define DELAY_C _delay_us(30); _delay_us(30)				/* 60 usec */
#define DELAY_D _delay_us(10)						/* 10 usec */
#define DELAY_E _delay_us(9)						/* 9 usec */
#define DELAY_F _delay_us(25); _delay_us(30);				/* 55 usec */
#define DELAY_G								/* 0 usec */
#define DELAY_H _delay_us(30); _delay_us(30);  _delay_us(30);  _delay_us(30); \
     _delay_us(30);  _delay_us(30);  _delay_us(30);  _delay_us(30); \
     _delay_us(30);  _delay_us(30);  _delay_us(30);  _delay_us(30); \
    _delay_us(30);  _delay_us(30);  _delay_us(30);  _delay_us(30)	/* 480 usec */
#define DELAY_I _delay_us(30); _delay_us(30);_delay_us(10)		/* 70 usec */