MAX31855 library

Committer:
yihui
Date:
Mon Feb 09 05:56:04 2015 +0000
Revision:
0:5d56064bc4c3
initial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 0:5d56064bc4c3 1
yihui 0:5d56064bc4c3 2
yihui 0:5d56064bc4c3 3 /*
yihui 0:5d56064bc4c3 4 * A library for MAX31855
yihui 0:5d56064bc4c3 5 *
yihui 0:5d56064bc4c3 6 * Copyright (c) 2015 Seeed Technology Limited.
yihui 0:5d56064bc4c3 7 * Author : Yihui Xiong
yihui 0:5d56064bc4c3 8 *
yihui 0:5d56064bc4c3 9 * The MIT License (MIT)
yihui 0:5d56064bc4c3 10 *
yihui 0:5d56064bc4c3 11 * Permission is hereby granted, free of charge, to any person obtaining a copy
yihui 0:5d56064bc4c3 12 * of this software and associated documentation files (the "Software"), to deal
yihui 0:5d56064bc4c3 13 * in the Software without restriction, including without limitation the rights
yihui 0:5d56064bc4c3 14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
yihui 0:5d56064bc4c3 15 * copies of the Software, and to permit persons to whom the Software is
yihui 0:5d56064bc4c3 16 * furnished to do so, subject to the following conditions:
yihui 0:5d56064bc4c3 17 *
yihui 0:5d56064bc4c3 18 * The above copyright notice and this permission notice shall be included in
yihui 0:5d56064bc4c3 19 * all copies or substantial portions of the Software.
yihui 0:5d56064bc4c3 20 *
yihui 0:5d56064bc4c3 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
yihui 0:5d56064bc4c3 22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
yihui 0:5d56064bc4c3 23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
yihui 0:5d56064bc4c3 24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
yihui 0:5d56064bc4c3 25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
yihui 0:5d56064bc4c3 26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
yihui 0:5d56064bc4c3 27 * THE SOFTWARE.
yihui 0:5d56064bc4c3 28 */
yihui 0:5d56064bc4c3 29
yihui 0:5d56064bc4c3 30 #ifndef __MAX31855_H__
yihui 0:5d56064bc4c3 31 #define __MAX31855_H__
yihui 0:5d56064bc4c3 32
yihui 0:5d56064bc4c3 33 #include "mbed.h"
yihui 0:5d56064bc4c3 34
yihui 0:5d56064bc4c3 35 class MAX31855
yihui 0:5d56064bc4c3 36 {
yihui 0:5d56064bc4c3 37 public:
yihui 0:5d56064bc4c3 38 typedef enum {
yihui 0:5d56064bc4c3 39 THERMOCOUPLE_T = 0,
yihui 0:5d56064bc4c3 40 INTERNAL_T = 1,
yihui 0:5d56064bc4c3 41 } temperature_type_t;
yihui 0:5d56064bc4c3 42
yihui 0:5d56064bc4c3 43 public:
yihui 0:5d56064bc4c3 44 MAX31855(SPI& _spi, PinName _ncs);
yihui 0:5d56064bc4c3 45 float read(temperature_type_t type = THERMOCOUPLE_T);
yihui 0:5d56064bc4c3 46
yihui 0:5d56064bc4c3 47
yihui 0:5d56064bc4c3 48 private:
yihui 0:5d56064bc4c3 49 SPI& spi;
yihui 0:5d56064bc4c3 50 DigitalOut ncs;
yihui 0:5d56064bc4c3 51 float thermocoupleT;
yihui 0:5d56064bc4c3 52 float internalT;
yihui 0:5d56064bc4c3 53 uint32_t lastReadTime;
yihui 0:5d56064bc4c3 54 };
yihui 0:5d56064bc4c3 55
yihui 0:5d56064bc4c3 56 #endif // __MAX31855_H__