资源简介
NULL
博文链接:https://yiqieanhao.iteye.com/blog/1744598
代码片段和文件信息
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License or (at your option) any later version.
// Version 3.7.2 modified on Dec 6 2011 to support Arduino 1.0
// See Includes...
// Modified by Jordan Hochenbaum
#include “DallasTemperature.h“
#if ARDUINO >= 100
#include “Arduino.h“
#else
extern “C“ {
#include “WConstants.h“
}
#endif
DallasTemperature::DallasTemperature(OneWire* _oneWire)
#if REQUIRESALARMS
: _AlarmHandler(&defaultAlarmHandler)
#endif
{
_wire = _oneWire;
devices = 0;
parasite = false;
bitResolution = 9;
waitForConversion = true;
checkForConversion = true;
}
// initialise the bus
void DallasTemperature::begin(void)
{
DeviceAddress deviceAddress;
_wire->reset_search();
devices = 0; // Reset the number of devices when we enumerate wire devices
while (_wire->search(deviceAddress))
{
if (validAddress(deviceAddress))
{
if (!parasite && readPowerSupply(deviceAddress)) parasite = true;
ScratchPad scratchPad;
readScratchPad(deviceAddress scratchPad);
bitResolution = max(bitResolution getResolution(deviceAddress));
devices++;
}
}
}
// returns the number of devices found on the bus
uint8_t DallasTemperature::getDeviceCount(void)
{
return devices;
}
// returns true if address is valid
bool DallasTemperature::validAddress(uint8_t* deviceAddress)
{
return (_wire->crc8(deviceAddress 7) == deviceAddress[7]);
}
// finds an address at a given index on the bus
// returns true if the device was found
bool DallasTemperature::getAddress(uint8_t* deviceAddress uint8_t index)
{
uint8_t depth = 0;
_wire->reset_search();
while (depth <= index && _wire->search(deviceAddress))
{
if (depth == index && validAddress(deviceAddress)) return true;
depth++;
}
return false;
}
// attempt to determine if the device at the given address is connected to the bus
bool DallasTemperature::isConnected(uint8_t* deviceAddress)
{
ScratchPad scratchPad;
return isConnected(deviceAddress scratchPad);
}
// attempt to determine if the device at the given address is connected to the bus
// also allows for updating the read scratchpad
bool DallasTemperature::isConnected(uint8_t* deviceAddress uint8_t* scratchPad)
{
readScratchPad(deviceAddress scratchPad);
return (_wire->crc8(scratchPad 8) == scratchPad[SCRATCHPAD_CRC]);
}
// read device‘s scratch pad
void DallasTemperature::readScratchPad(uint8_t* deviceAddress uint8_t* scratchPad)
{
// send the command
_wire->reset();
_wire->select(deviceAddress);
_wire->write(READSCRATCH);
// TODO => collect all comments & use simple loop
// byte 0: temperature LSB
// byte 1: temperature MSB
// byte 2: high alarm temp
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3961 2011-12-11 15:44 dallasTemperatureControl\change.txt
文件 21604 2011-12-11 15:44 dallasTemperatureControl\DallasTemperature.cpp
文件 6795 2011-12-11 15:44 dallasTemperatureControl\DallasTemperature.h
文件 4326 2011-12-11 15:44 dallasTemperatureControl\examples\Alarm\Alarm.pde
文件 3899 2011-12-11 15:44 dallasTemperatureControl\examples\AlarmHandler\AlarmHandler.pde
文件 4767 2011-12-11 15:44 dallasTemperatureControl\examples\Multiple\Multiple.pde
文件 928 2011-12-11 15:44 dallasTemperatureControl\examples\Simple\Simple.pde
文件 3992 2011-12-11 15:44 dallasTemperatureControl\examples\Single\Single.pde
文件 3674 2011-12-11 15:44 dallasTemperatureControl\examples\Tester\Tester.pde
文件 1916 2011-12-11 15:44 dallasTemperatureControl\examples\WaitForConversion\WaitForConversion.pde
文件 2128 2011-12-11 15:44 dallasTemperatureControl\examples\WaitForConversion2\WaitForConversion2.pde
文件 1351 2011-12-11 15:44 dallasTemperatureControl\keywords.txt
文件 1916 2011-12-11 15:44 dallasTemperatureControl\README.TXT
文件 2763 2011-10-29 12:18 OneWire\examples\DS18x20_Temperature\DS18x20_Temperature.pde
文件 1907 2011-10-29 03:03 OneWire\examples\DS2408_Switch\DS2408_Switch.pde
文件 4099 2011-10-29 01:51 OneWire\examples\DS250x_PROM\DS250x_PROM.pde
文件 819 2011-10-29 03:39 OneWire\keywords.txt
文件 16361 2011-11-01 11:52 OneWire\OneWire.cpp
文件 7206 2011-11-01 11:52 OneWire\OneWire.h
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\Alarm
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\AlarmHandler
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\Multiple
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\Simple
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\Single
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\Tester
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\WaitForConversion
目录 0 2012-12-08 17:23 dallasTemperatureControl\examples\WaitForConversion2
目录 0 2012-12-08 17:20 OneWire\examples\DS18x20_Temperature
目录 0 2012-12-08 17:20 OneWire\examples\DS2408_Switch
目录 0 2012-12-08 17:20 OneWire\examples\DS250x_PROM
............此处省略7个文件信息
相关资源
- 如何将.spc和.pvk转换成.pfx格式
- eclipse 下的hibernate tools
- 服务器部署多个tomcat方法
- qt双色球
- 个人简历
- 我的Firefox插件开发之旅——从零开始
- 汉字转拼音(AS3.0)
-
[原创]Hba
seClient - IE中使用firebug
- treePanel与gridPanel技术实现页面的增删
- myeclipse免安装方法
- 发个普通类转成json的工具类,功能比
- Ubuntu16.04源码安装Mininet
- 大数据视频及源码资料
- 喜马拉雅win10文件改名工具
- SpringMVC+MyBatis企业应用实战+源码
- DDOS压力测试工具
- Exaware OnTop And PushPin 窗口置顶好工具
- VS2010 完整彻底卸载工具
- 串口调试助手易语言源码
- md5生成及校验工具
- QJson库包括源码文件和dll以及libqjson
- putty中文版69950
- MCPF跟踪算法源码
- TCP/IP调试助手
- 语音识别系统源码和开发文档
- 虚拟机模拟防火墙专用工具--piped
- 四川大学软件开发环境与工具—复习
- Xilinx Zynq-7000嵌入式系统设计及实现
- 700个H5网站模板源码
评论
共有 条评论