summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/HAL/avr/atmega1281/common/include/halW1.h
blob: 46c66fd7ca0ad3e1d9b44cb5c49a53346aa4ceb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/***************************************************************************//**
  \file  halW1.h

  \brief Declarations of 1-wire hardware-dependent module.

  \author
      Atmel Corporation: http://www.atmel.com \n
      Support email: avr@atmel.com

    Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
    Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
    History:
      10/12/07 A. Khromykh - Created
 ******************************************************************************/
/******************************************************************************
 *   WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK.  *
 *   EXPERT USERS SHOULD PROCEED WITH CAUTION.                                *
 ******************************************************************************/

#ifndef _HALW1_H
#define _HALW1_H

/******************************************************************************
                   Includes section
******************************************************************************/
#include <inttypes.h>

/******************************************************************************
                   Types section
******************************************************************************/
/** \brief i2c 1-wire status */
typedef enum
{
  /** \brief There is no device on the bus */
  W1_NO_DEVICE_STATUS,
  /** \brief At least one device is on the bus */
  W1_SUCCESS_STATUS,
  /** \brief Invalid CRC was read during the device search operation */
  W1_INVALID_CRC
} W1Status_t;

/***************************************************************************//**
\brief Reads byte from the bus.

\return
  byte read from the bus.
*******************************************************************************/
uint8_t halReadW1(void);

/***************************************************************************//**
\brief Reads bit from the bus.

\return
  Read bit is placed to position of last significant bit.
*******************************************************************************/
uint8_t halReadW1Bit(void);

/***************************************************************************//**
\brief Writes bit to the bus.

\param[in]
  value - to write. The bit is placed to position of last significant bit.
*******************************************************************************/
void halWriteW1bit(uint8_t value);

/***************************************************************************//**
\brief Writes byte to the bus

\param[in]
    value - byte to write.
*******************************************************************************/
void halWriteW1(uint8_t value);

/***************************************************************************//**
\brief Resets all devices connected to the bus.

\return
  0 - there are some devices at the bus. \n
  1 - there are not any devices at the bus.
*******************************************************************************/
uint8_t halResetW1(void);

/**************************************************************************//**
\brief Performs delay in microseconds

\param[in]
  delay - number of microseconds to be delay
******************************************************************************/
void __delay_us(uint8_t delay);

#endif /* _HALW1_H */