This is the device firmware for the controlBoard in the DIY 3D Printable Raspberry Pi Raman Spectrometer. For more information please visit: http://hackaday.io/project/1279

Dependencies:   mbed

Committer:
flatcat
Date:
Fri Aug 15 10:38:50 2014 +0000
Revision:
0:14942e263231
http://hackaday.io/project/1279

Who changed what in which revision?

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