MAX31855 library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX31855.h Source File

MAX31855.h

00001 
00002 
00003 /*    
00004  * A library for MAX31855 
00005  *   
00006  * Copyright (c) 2015 Seeed Technology Limited.  
00007  * Author      : Yihui Xiong
00008  *
00009  * The MIT License (MIT)
00010  *
00011  * Permission is hereby granted, free of charge, to any person obtaining a copy
00012  * of this software and associated documentation files (the "Software"), to deal
00013  * in the Software without restriction, including without limitation the rights
00014  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00015  * copies of the Software, and to permit persons to whom the Software is
00016  * furnished to do so, subject to the following conditions:
00017  * 
00018  * The above copyright notice and this permission notice shall be included in
00019  * all copies or substantial portions of the Software.
00020  * 
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00022  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00024  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00026  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00027  * THE SOFTWARE.
00028  */
00029  
00030 #ifndef __MAX31855_H__
00031 #define __MAX31855_H__
00032 
00033 #include "mbed.h"
00034 
00035 class MAX31855
00036 {
00037     public:
00038         typedef enum {
00039             THERMOCOUPLE_T = 0,
00040             INTERNAL_T     = 1,
00041         } temperature_type_t;
00042         
00043     public:
00044         MAX31855(SPI& _spi, PinName _ncs);
00045         float read(temperature_type_t type = THERMOCOUPLE_T);
00046 
00047   
00048   private:
00049     SPI& spi;
00050     DigitalOut ncs;
00051     float thermocoupleT;
00052     float internalT;
00053     uint32_t lastReadTime;
00054 };
00055 
00056 #endif // __MAX31855_H__