BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
onewire.h
Go to the documentation of this file.
1 /* Copyright 2012-2014, Peter A. Bigot
2  *
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * * Neither the name of the software nor the names of its contributors may be
16  * used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
44 #ifndef BSP430_UTILITY_ONEWIRE_H
45 #define BSP430_UTILITY_ONEWIRE_H
46 
47 #include <bsp430/periph/port.h>
48 
50 typedef struct sBSP430onewireBus {
54  unsigned char bit;
56 
60  uint8_t id[6];
62 
63 enum {
66 
69 
73 
76 
79 
90 };
91 
104 int iBSP430onewireReset_ni (const sBSP430onewireBus * bus);
105 
116 
124  int byte);
125 
132 
142 
153 int iBSP430onewireComputeCRC (const unsigned char * data, int len);
154 
165 
174 
193 
202 static BSP430_CORE_INLINE
203 int
205 {
206  return iBSP430onewireReadBit_ni(bus);
207 }
208 
226  int * temp_xCel);
227 
234 #define BSP430_ONEWIRE_xCel_TO_ddegF(xcel_) (320 + ((9 * (xcel_)) / 8))
235 
247 #define BSP430_ONEWIRE_xCel_TO_dK(xcel_) ((21852U + 5U * (xcel_)) / 8U)
248 
249 #endif /* BSP430_UTILITY_ONEWIRE_H */
Definition: onewire.h:58
unsigned char bit
Definition: onewire.h:54
hBSP430halPORT port
Definition: onewire.h:52
Definition: onewire.h:50
int iBSP430onewireReadBit_ni(const sBSP430onewireBus *bus)
struct sBSP430onewireSerialNumber sBSP430onewireSerialNumber
Definition: onewire.h:72
Definition: onewire.h:68
Definition: onewire.h:78
struct sBSP430onewireBus sBSP430onewireBus
int iBSP430onewireReadByte_ni(const sBSP430onewireBus *bus)
int iBSP430onewireReadTemperature_ni(const sBSP430onewireBus *bus, int *temp_xCel)
#define BSP430_CORE_INLINE
Definition: core.h:439
Definition: port.h:838
void vBSP430onewireWriteByte_ni(const sBSP430onewireBus *bus, int byte)
int iBSP430onewireComputeCRC(const unsigned char *data, int len)
Definition: onewire.h:75
int iBSP430onewireReadPowerSupply(const sBSP430onewireBus *bus)
Hardware presentation/abstraction for Digital I/O Port (PORT#/PORT#_R)
Definition: onewire.h:65
int iBSP430onewireReadSerialNumber(const sBSP430onewireBus *bus, sBSP430onewireSerialNumber *snp)
int iBSP430onewireReset_ni(const sBSP430onewireBus *bus)
static BSP430_CORE_INLINE int iBSP430onewireTemperatureReady_ni(const sBSP430onewireBus *bus)
Definition: onewire.h:204
int iBSP430onewireRequestTemperature_ni(const sBSP430onewireBus *bus)
void vBSP430onewireShutdown_ni(const sBSP430onewireBus *bus)
Definition: onewire.h:89