A copy of very incomplete program for forum
Dependencies: mbed SDFileSystem
OneWireDefs.h@1:d1c29c7b7ab3, 2012-03-17 (annotated)
- Committer:
- roselea
- Date:
- Sat Mar 17 14:34:23 2012 +0000
- Revision:
- 1:d1c29c7b7ab3
- Parent:
- 0:bfcb5b67b1d6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
roselea | 0:bfcb5b67b1d6 | 1 | /* |
roselea | 0:bfcb5b67b1d6 | 2 | * OneWireCRC. This is a port to mbed of Jim Studt's Adruino One Wire |
roselea | 0:bfcb5b67b1d6 | 3 | * library. |
roselea | 0:bfcb5b67b1d6 | 4 | * |
roselea | 0:bfcb5b67b1d6 | 5 | * Copyright (C) <2009> Petras Saduikis <petras@petras.co.uk> |
roselea | 0:bfcb5b67b1d6 | 6 | * |
roselea | 0:bfcb5b67b1d6 | 7 | * This file is part of OneWireCRC. |
roselea | 0:bfcb5b67b1d6 | 8 | * |
roselea | 0:bfcb5b67b1d6 | 9 | * OneWireCRC is free software: you can redistribute it and/or modify |
roselea | 0:bfcb5b67b1d6 | 10 | * it under the terms of the GNU General Public License as published by |
roselea | 0:bfcb5b67b1d6 | 11 | * the Free Software Foundation, either version 3 of the License, or |
roselea | 0:bfcb5b67b1d6 | 12 | * (at your option) any later version. |
roselea | 0:bfcb5b67b1d6 | 13 | * |
roselea | 0:bfcb5b67b1d6 | 14 | * OneWireCRC is distributed in the hope that it will be useful, |
roselea | 0:bfcb5b67b1d6 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
roselea | 0:bfcb5b67b1d6 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
roselea | 0:bfcb5b67b1d6 | 17 | * GNU General Public License for more details. |
roselea | 0:bfcb5b67b1d6 | 18 | * |
roselea | 0:bfcb5b67b1d6 | 19 | * You should have received a copy of the GNU General Public License |
roselea | 0:bfcb5b67b1d6 | 20 | * along with OneWireCRC. If not, see <http://www.gnu.org/licenses/>. |
roselea | 0:bfcb5b67b1d6 | 21 | */ |
roselea | 0:bfcb5b67b1d6 | 22 | |
roselea | 0:bfcb5b67b1d6 | 23 | #ifndef SNATCH59_ONEWIREDEFS_H |
roselea | 0:bfcb5b67b1d6 | 24 | #define SNATCH59_ONEWIREDEFS_H |
roselea | 0:bfcb5b67b1d6 | 25 | |
roselea | 0:bfcb5b67b1d6 | 26 | // device ids |
roselea | 0:bfcb5b67b1d6 | 27 | #define DS18B20_ID 0x28 |
roselea | 0:bfcb5b67b1d6 | 28 | #define DS18S20_ID 0x10 |
roselea | 0:bfcb5b67b1d6 | 29 | |
roselea | 0:bfcb5b67b1d6 | 30 | #define ALARM_CONFIG_SIZE 3 |
roselea | 0:bfcb5b67b1d6 | 31 | #define THERMOM_SCRATCHPAD_SIZE 9 |
roselea | 0:bfcb5b67b1d6 | 32 | #define THERMOM_CRC_BYTE 8 |
roselea | 0:bfcb5b67b1d6 | 33 | #define ADDRESS_SIZE 8 |
roselea | 0:bfcb5b67b1d6 | 34 | #define ADDRESS_CRC_BYTE 7 |
roselea | 0:bfcb5b67b1d6 | 35 | |
roselea | 0:bfcb5b67b1d6 | 36 | // One Wire command codes |
roselea | 0:bfcb5b67b1d6 | 37 | #define OVERDRIVE_SKIP 0x3C |
roselea | 0:bfcb5b67b1d6 | 38 | // ROM commands |
roselea | 0:bfcb5b67b1d6 | 39 | #define SEARCH_ROM 0xF0 |
roselea | 0:bfcb5b67b1d6 | 40 | #define READ_ROM 0x33 |
roselea | 0:bfcb5b67b1d6 | 41 | #define MATCH_ROM 0x55 |
roselea | 0:bfcb5b67b1d6 | 42 | #define SKIP_ROM 0xCC |
roselea | 0:bfcb5b67b1d6 | 43 | #define ALARM_SEARCH 0xEC |
roselea | 0:bfcb5b67b1d6 | 44 | // Functions Commnds |
roselea | 0:bfcb5b67b1d6 | 45 | #define CONVERT 0x44 |
roselea | 0:bfcb5b67b1d6 | 46 | #define WRITESCRATCH 0x4E |
roselea | 0:bfcb5b67b1d6 | 47 | #define READSCRATCH 0xBE |
roselea | 0:bfcb5b67b1d6 | 48 | #define COPYSCRATCH 0x48 |
roselea | 0:bfcb5b67b1d6 | 49 | #define RECALLE2 0xB8 |
roselea | 0:bfcb5b67b1d6 | 50 | #define READPOWERSUPPLY 0xB4 |
roselea | 0:bfcb5b67b1d6 | 51 | |
roselea | 0:bfcb5b67b1d6 | 52 | // temperature read resolutions |
roselea | 0:bfcb5b67b1d6 | 53 | enum eResolution {nineBit = 0, tenBit, elevenBit, twelveBit}; |
roselea | 0:bfcb5b67b1d6 | 54 | const int CONVERSION_TIME[] = {94, 188, 375, 750}; // milli-seconds |
roselea | 0:bfcb5b67b1d6 | 55 | |
roselea | 0:bfcb5b67b1d6 | 56 | // DS18B20/DS18S20 related |
roselea | 0:bfcb5b67b1d6 | 57 | #define TEMPERATURE_LSB 0 |
roselea | 0:bfcb5b67b1d6 | 58 | #define TEMPERATURE_MSB 1 |
roselea | 0:bfcb5b67b1d6 | 59 | #define HIGH_ALARM_BYTE 2 |
roselea | 0:bfcb5b67b1d6 | 60 | #define LOW_ALARM_BYTE 3 |
roselea | 0:bfcb5b67b1d6 | 61 | #define CONFIG_REG_BYTE 4 |
roselea | 0:bfcb5b67b1d6 | 62 | #define CONFIG_READ_END 5 |
roselea | 0:bfcb5b67b1d6 | 63 | #define COUNT_REMAIN_BYTE 6 |
roselea | 0:bfcb5b67b1d6 | 64 | #define COUNT_PER_DEG_BYTE 7 |
roselea | 0:bfcb5b67b1d6 | 65 | |
roselea | 0:bfcb5b67b1d6 | 66 | #endif |