Library to interface with the MAX31855 Cold Junction Compensated Thermocouple-to-Digital Converter
Fork of MAX31855 by
The libary is from Joe Station. The conversion factor for the internal chip temperature is changed from 0.25 to 0.0625 to read out the correct chip temperature.
max31855.h@2:88ffddeb1e1d, 2014-03-07 (annotated)
- Committer:
- Franky_74
- Date:
- Fri Mar 07 09:57:48 2014 +0000
- Revision:
- 2:88ffddeb1e1d
- Parent:
- 1:5eeee89cb281
Max31855 from Joe Staton (internal Chip-temperatur conversation factor corrected from 0.25 to 0.0625 to read out the correct chip temperature)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Stavlin | 0:656c522152d4 | 1 | #ifndef MAX31855_h |
Stavlin | 0:656c522152d4 | 2 | #define MAX31855_h |
Stavlin | 0:656c522152d4 | 3 | |
Stavlin | 0:656c522152d4 | 4 | #include "mbed.h" |
Stavlin | 0:656c522152d4 | 5 | |
Stavlin | 0:656c522152d4 | 6 | class max31855 |
Stavlin | 0:656c522152d4 | 7 | { |
Stavlin | 0:656c522152d4 | 8 | SPI& spi; |
Stavlin | 0:656c522152d4 | 9 | DigitalOut ncs; |
Stavlin | 0:656c522152d4 | 10 | Timer pollTimer; |
Stavlin | 0:656c522152d4 | 11 | public: |
Stavlin | 0:656c522152d4 | 12 | |
Stavlin | 0:656c522152d4 | 13 | max31855(SPI& _spi, PinName _ncs); |
Stavlin | 0:656c522152d4 | 14 | void select(); |
Stavlin | 0:656c522152d4 | 15 | void deselect(); |
Stavlin | 1:5eeee89cb281 | 16 | void initialise(int setType=0); |
Stavlin | 0:656c522152d4 | 17 | |
Stavlin | 0:656c522152d4 | 18 | int ready(); |
Stavlin | 1:5eeee89cb281 | 19 | int faultCode; |
Stavlin | 0:656c522152d4 | 20 | |
Stavlin | 0:656c522152d4 | 21 | float chipTemp; |
Stavlin | 0:656c522152d4 | 22 | float read_temp(); |
Stavlin | 0:656c522152d4 | 23 | private: |
Stavlin | 0:656c522152d4 | 24 | PinName _CS_pin; |
Stavlin | 0:656c522152d4 | 25 | PinName _SO_pin; |
Stavlin | 0:656c522152d4 | 26 | PinName _SCK_pin; |
Stavlin | 0:656c522152d4 | 27 | int _units; |
Stavlin | 0:656c522152d4 | 28 | float _error; |
Stavlin | 0:656c522152d4 | 29 | }; |
Stavlin | 0:656c522152d4 | 30 | |
Stavlin | 0:656c522152d4 | 31 | #endif |