summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/HAL/include/w1.h
blob: 7f26d39c8e4ddfdc183cae31df0c4e50757970fa (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/**************************************************************************//**
  \file  w1.h

  \brief The header file describes the 1-Wire interface.

  \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 _W1_H
#define _W1_H

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

/******************************************************************************
                   Define(s) section
******************************************************************************/
#define W1_ANY_FAMILY 0x00
#define DS2411 0x01

/******************************************************************************
                   Prototypes section
******************************************************************************/
/*************************************************************************//**
\brief 1-Wire search procedure with search ROM command only
\param[in]
   family   - 8-bit family code.
\param[in]
   data     - pointer of SRAM where the 8-bytes ROM codes returned by the
              devices are stored. \n
              Attention! Memory size must be equal to (Number of devices) * 8 bytes
\param[in]
   count    - number of devices we wish to find.
\param[in]
   actCount - number of devices actually found.
\return
   W1_SUCCESS_STATUS   - if at least one device has been found. \n
   W1_NO_DEVICE_STATUS - if there are no any devices presented
                         on the bus with specified family code. \n
   W1_INVALID_CRC      - if an invalid CRC has been read during the search and
                         no devices with specified family code was found.
******************************************************************************/
W1Status_t HAL_SearchW1Device(uint8_t family,
                              uint8_t *data,
                              uint8_t count,
                              uint8_t *actCount);

/**************************************************************************//**
\brief 1-Wire search procedure with alarm search command only
\param[in]
   family   - 8-bit family code.
\param[in]
   data     - pointer of SRAM where the 8-bytes ROM codes returned by the
              devices are stored. \n
\param[in]
   count    - number of devices we wish to find.
\param[in]
   actCount - number of devices actually found.
\return
   W1_SUCCESS_STATUS   - if at least one device has been found. \n
   W1_NO_DEVICE_STATUS - if there are no any devices presented
                         on the bus with specified family code. \n
   W1_INVALID_CRC      - if an invalid CRC has been read during the search and
                         no devices with specified family code was found.
******************************************************************************/
W1Status_t HAL_AlarmSearchW1Device(uint8_t family,
                                   uint8_t *data,
                                   uint8_t count,
                                   uint8_t *actCount);

/***************************************************************************//**
\brief Resets all devices connected to the bus.
\return
  0 - there are some devices at the bus. \n
  1 - there are no devices at the bus.
*******************************************************************************/
uint8_t HAL_ResetW1(void);

/***************************************************************************//**
\brief Writes a single byte to the bus
\param[in]
    value - byte to write.
*******************************************************************************/
void HAL_WriteW1(uint8_t value);

/***************************************************************************//**
\brief Reads a single byte from the bus.
\return
  byte read from the bus.
*******************************************************************************/
uint8_t HAL_ReadW1(void);

#endif /* _W1_H */
// eof w1.h