OneWireCRC

Dependencies:   mbed

Fork of OneWireCRC by Petras Saduikis

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers OneWireDefs.h Source File

OneWireDefs.h

00001 /*
00002 * OneWireCRC. This is a port to mbed of Jim Studt's Adruino One Wire
00003 * library.
00004 *
00005 * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk>
00006 *
00007 * This file is part of OneWireCRC.
00008 *
00009 * OneWireCRC is free software: you can redistribute it and/or modify
00010 * it under the terms of the GNU General Public License as published by
00011 * the Free Software Foundation, either version 3 of the License, or
00012 * (at your option) any later version.
00013 * 
00014 * OneWireCRC is distributed in the hope that it will be useful,
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 * GNU General Public License for more details.
00018 *
00019 * You should have received a copy of the GNU General Public License
00020 * along with OneWireCRC.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 
00023 #ifndef SNATCH59_ONEWIREDEFS_H
00024 #define SNATCH59_ONEWIREDEFS_H
00025 
00026 // device ids
00027 #define DS18B20_ID        0x28
00028 #define DS18S20_ID        0x10
00029 
00030 #define ALARM_CONFIG_SIZE 3
00031 #define THERMOM_SCRATCHPAD_SIZE    9
00032 #define THERMOM_CRC_BYTE  8
00033 #define ADDRESS_SIZE      8
00034 #define ADDRESS_CRC_BYTE  7
00035 
00036 // One Wire command codes
00037 #define OVERDRIVE_SKIP    0x3C
00038 // ROM commands
00039 #define SEARCH_ROM        0xF0
00040 #define READ_ROM          0x33
00041 #define MATCH_ROM         0x55
00042 #define SKIP_ROM          0xCC
00043 #define ALARM_SEARCH      0xEC
00044 // Functions Commnds
00045 #define CONVERT           0x44
00046 #define WRITESCRATCH      0x4E
00047 #define READSCRATCH       0xBE
00048 #define COPYSCRATCH       0x48
00049 #define RECALLE2          0xB8
00050 #define READPOWERSUPPLY   0xB4
00051 
00052 // temperature read resolutions
00053 enum eResolution {nineBit = 0, tenBit, elevenBit, twelveBit};
00054 const int CONVERSION_TIME[] = {94, 188, 375, 750};    // milli-seconds
00055 
00056 // DS18B20/DS18S20 related
00057 #define TEMPERATURE_LSB    0
00058 #define TEMPERATURE_MSB    1
00059 #define HIGH_ALARM_BYTE    2
00060 #define LOW_ALARM_BYTE     3
00061 #define CONFIG_REG_BYTE    4
00062 #define CONFIG_READ_END    5
00063 #define COUNT_REMAIN_BYTE  6
00064 #define COUNT_PER_DEG_BYTE 7
00065 
00066 #endif