MAX31855 Cold-Junction Compensated Thermocouple-to-Digital Converter

Files at this revision

API Documentation at this revision

Comitter:
mederic
Date:
Wed Jul 29 12:28:35 2015 +0000
Parent:
0:cd9dd4f2c484
Child:
2:c4d43aacb666
Commit message:
add constructor for SPI bus

Changed in this revision

MAX31855.cpp Show annotated file Show diff for this revision Revisions of this file
MAX31855.h Show annotated file Show diff for this revision Revisions of this file
--- a/MAX31855.cpp	Tue Sep 09 08:17:42 2014 +0000
+++ b/MAX31855.cpp	Wed Jul 29 12:28:35 2015 +0000
@@ -10,6 +10,13 @@
     _spi.frequency(1000000);
 }
 
+MAX31855::MAX31855(SPI& spi, PinName ncs) :_spi(spi), _ncs(ncs)
+{
+    _ncs = 1;   //CS high
+    _spi.format(16,0);
+    _spi.frequency(1000000);
+}
+
 //***********************************/************************************
 //                                Get Set                               //
 //***********************************/************************************
--- a/MAX31855.h	Tue Sep 09 08:17:42 2014 +0000
+++ b/MAX31855.h	Wed Jul 29 12:28:35 2015 +0000
@@ -33,6 +33,12 @@
     */
     MAX31855(PinName mosi, PinName miso, PinName sck, PinName ncs);
     
+    /** Create MAX31855 instance connected to spi & ncs
+    * @param SPI bus instance (MAX31855 is only read device)
+    * @param ncs pin to connect at CS input
+    */
+    MAX31855(SPI& spi, PinName ncs);
+    
     /**Get Thermocouple temperature
     * @returns temperature [°C]
     */