Skip to content

Commit f2fd02d

Browse files
authored
Merge pull request #35 from caternuson/actionsci
moving to github actions
2 parents 010598f + f29fe4c commit f2fd02d

File tree

8 files changed

+202
-110
lines changed

8 files changed

+202
-110
lines changed

.github/workflows/githubci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Arduino Library CI
2+
3+
on: [pull_request, push, repository_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/setup-python@v1
11+
with:
12+
python-version: '3.x'
13+
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v2
15+
with:
16+
repository: adafruit/ci-arduino
17+
path: ci
18+
19+
- name: pre-install
20+
run: bash ci/actions_install.sh
21+
22+
- name: test platforms
23+
run: python3 ci/build_platform.py main_platforms
24+
25+
- name: clang
26+
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
27+
28+
- name: doxygen
29+
env:
30+
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
31+
PRETTYNAME : "Adafruit MAX31855 Library"
32+
run: bash ci/doxy_gen_and_deploy.sh

Adafruit_MAX31855.cpp

Lines changed: 103 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,91 @@
1-
/***************************************************
2-
This is a library for the Adafruit Thermocouple Sensor w/MAX31855K
3-
4-
Designed specifically to work with the Adafruit Thermocouple Sensor
5-
----> https://www.adafruit.com/products/269
6-
7-
These displays use SPI to communicate, 3 pins are required to
8-
interface
9-
Adafruit invests time and resources providing this open source code,
10-
please support Adafruit and open-source hardware by purchasing
11-
products from Adafruit!
12-
13-
Written by Limor Fried/Ladyada for Adafruit Industries.
14-
BSD license, all text above must be included in any redistribution
15-
****************************************************/
1+
/*!
2+
* @file Adafruit_MAX31855.cpp
3+
*
4+
* @mainpage Adafruit MAX31855 Thermocouple Breakout Driver
5+
*
6+
* @section intro_sec Introduction
7+
*
8+
* This is the documentation for Adafruit's MAX31855 thermocouple breakout
9+
* driver for the Arduino platform. It is designed specifically to work with
10+
* the Adafruit MAX31855 breakout: https://www.adafruit.com/products/269
11+
*
12+
* This breakout uses SPI to communicate, 3 pins are required
13+
* to interface with the breakout.
14+
*
15+
* Adafruit invests time and resources providing this open source code,
16+
* please support Adafruit and open-source hardware by purchasing
17+
* products from Adafruit!
18+
*
19+
* @section dependencies Dependencies
20+
*
21+
* This library depends on <a
22+
* href="https://github.com/adafruit/Adafruit_BusIO"> Adafruit_BusIO</a> being
23+
* present on your system. Please make sure you have installed the latest
24+
* version before using this library.
25+
*
26+
* @section author Author
27+
*
28+
* Written by Limor Fried/Ladyada for Adafruit Industries.
29+
*
30+
* @section license License
31+
*
32+
* BSD license, all text above must be included in any redistribution.
33+
*
34+
*/
1635

1736
#include "Adafruit_MAX31855.h"
1837
#ifdef __AVR
19-
#include <avr/pgmspace.h>
38+
#include <avr/pgmspace.h>
2039
#elif defined(ESP8266)
21-
#include <pgmspace.h>
40+
#include <pgmspace.h>
2241
#endif
2342

2443
#include <stdlib.h>
2544

45+
/**************************************************************************/
46+
/*!
47+
@brief Instantiates a new Adafruit_MAX31855 class using software SPI.
2648
49+
@param _sclk The pin to use for SPI Serial Clock.
50+
@param _cs The pin to use for SPI Chip Select.
51+
@param _miso The pin to use for SPI Master In Slave Out.
52+
*/
53+
/**************************************************************************/
2754
Adafruit_MAX31855::Adafruit_MAX31855(int8_t _sclk, int8_t _cs, int8_t _miso) {
2855
spi_dev = Adafruit_SPIDevice(_cs, _sclk, _miso, -1, 4000000);
2956

3057
initialized = false;
3158
}
3259

60+
/**************************************************************************/
61+
/*!
62+
@brief Instantiates a new Adafruit_MAX31855 class using hardware SPI.
63+
64+
@param _cs The pin to use for SPI Chip Select.
65+
*/
66+
/**************************************************************************/
3367
Adafruit_MAX31855::Adafruit_MAX31855(int8_t _cs) {
3468
spi_dev = Adafruit_SPIDevice(_cs, 4000000);
3569

3670
initialized = false;
3771
}
3872

39-
void Adafruit_MAX31855::begin(void) {
40-
initialized = spi_dev.begin();
41-
}
73+
/**************************************************************************/
74+
/*!
75+
@brief Setup the HW
76+
77+
@return True if the device was successfully initialized, otherwise false.
78+
*/
79+
/**************************************************************************/
80+
void Adafruit_MAX31855::begin(void) { initialized = spi_dev.begin(); }
81+
82+
/**************************************************************************/
83+
/*!
84+
@brief Read the internal temperature.
4285
86+
@return The internal temperature in degrees Celsius.
87+
*/
88+
/**************************************************************************/
4389
double Adafruit_MAX31855::readInternal(void) {
4490
uint32_t v;
4591

@@ -57,17 +103,24 @@ double Adafruit_MAX31855::readInternal(void) {
57103
internal = tmp;
58104
}
59105
internal *= 0.0625; // LSB = 0.0625 degrees
60-
//Serial.print("\tInternal Temp: "); Serial.println(internal);
106+
// Serial.print("\tInternal Temp: "); Serial.println(internal);
61107
return internal;
62108
}
63109

110+
/**************************************************************************/
111+
/*!
112+
@brief Read the thermocouple temperature.
113+
114+
@return The thermocouple temperature in degrees Celsius.
115+
*/
116+
/**************************************************************************/
64117
double Adafruit_MAX31855::readCelsius(void) {
65118

66119
int32_t v;
67120

68121
v = spiread32();
69122

70-
//Serial.print("0x"); Serial.println(v, HEX);
123+
// Serial.print("0x"); Serial.println(v, HEX);
71124

72125
/*
73126
float internal = (v >> 4) & 0x7FF;
@@ -85,12 +138,11 @@ double Adafruit_MAX31855::readCelsius(void) {
85138
if (v & 0x80000000) {
86139
// Negative value, drop the lower 18 bits and explicitly extend sign bits.
87140
v = 0xFFFFC000 | ((v >> 18) & 0x00003FFFF);
88-
}
89-
else {
141+
} else {
90142
// Positive value, just drop the lower 18 bits.
91143
v >>= 18;
92144
}
93-
//Serial.println(v, HEX);
145+
// Serial.println(v, HEX);
94146

95147
double centigrade = v;
96148

@@ -99,25 +151,44 @@ double Adafruit_MAX31855::readCelsius(void) {
99151
return centigrade;
100152
}
101153

102-
uint8_t Adafruit_MAX31855::readError() {
103-
return spiread32() & 0x7;
104-
}
154+
/**************************************************************************/
155+
/*!
156+
@brief Read the error state.
157+
158+
@return The error state.
159+
*/
160+
/**************************************************************************/
161+
uint8_t Adafruit_MAX31855::readError() { return spiread32() & 0x7; }
105162

106-
double Adafruit_MAX31855::readFarenheit(void) {
163+
/**************************************************************************/
164+
/*!
165+
@brief Read the thermocouple temperature.
166+
167+
@return The thermocouple temperature in degrees Fahrenheit.
168+
*/
169+
/**************************************************************************/
170+
double Adafruit_MAX31855::readFahrenheit(void) {
107171
float f = readCelsius();
108172
f *= 9.0;
109173
f /= 5.0;
110174
f += 32;
111175
return f;
112176
}
113177

178+
/**************************************************************************/
179+
/*!
180+
@brief Read 4 bytes (32 bits) from breakout over SPI.
181+
182+
@return The raw 32 bit value read.
183+
*/
184+
/**************************************************************************/
114185
uint32_t Adafruit_MAX31855::spiread32(void) {
115186
int i;
116187
uint32_t d = 0;
117188
uint8_t buf[4];
118189

119190
// backcompatibility!
120-
if (! initialized) {
191+
if (!initialized) {
121192
begin();
122193
}
123194

@@ -128,10 +199,10 @@ uint32_t Adafruit_MAX31855::spiread32(void) {
128199
d |= buf[1];
129200
d <<= 8;
130201
d |= buf[2];
131-
d <<=8;
202+
d <<= 8;
132203
d |= buf[3];
133204

134-
//Serial.println(d, HEX);
205+
// Serial.println(d, HEX);
135206

136207
return d;
137208
}

Adafruit_MAX31855.h

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,51 @@
1-
/***************************************************
2-
This is a library for the Adafruit Thermocouple Sensor w/MAX31855K
3-
4-
Designed specifically to work with the Adafruit Thermocouple Sensor
5-
----> https://www.adafruit.com/products/269
6-
7-
These displays use SPI to communicate, 3 pins are required to
8-
interface
9-
Adafruit invests time and resources providing this open source code,
10-
please support Adafruit and open-source hardware by purchasing
11-
products from Adafruit!
12-
13-
Written by Limor Fried/Ladyada for Adafruit Industries.
14-
BSD license, all text above must be included in any redistribution
15-
****************************************************/
1+
/*!
2+
* @file Adafruit_MAX31855.h
3+
*
4+
* This is the documentation for Adafruit's MAX31855 thermocouple breakout
5+
* driver for the Arduino platform. It is designed specifically to work with
6+
* the Adafruit MAX31855 breakout: https://www.adafruit.com/products/269
7+
*
8+
* These sensors use SPI to communicate, 3 pins are required
9+
* to interface with the breakout.
10+
*
11+
* Adafruit invests time and resources providing this open source code,
12+
* please support Adafruit and open-source hardware by purchasing
13+
* products from Adafruit!
14+
*
15+
* Written by Limor Fried/Ladyada for Adafruit Industries.
16+
*
17+
* BSD license, all text above must be included in any redistribution.
18+
*
19+
*/
1620

1721
#ifndef ADAFRUIT_MAX31855_H
1822
#define ADAFRUIT_MAX31855_H
1923

2024
#if (ARDUINO >= 100)
21-
#include "Arduino.h"
25+
#include "Arduino.h"
2226
#else
23-
#include "WProgram.h"
27+
#include "WProgram.h"
2428
#endif
2529

2630
#include <Adafruit_SPIDevice.h>
2731

32+
/**************************************************************************/
33+
/*!
34+
@brief Sensor driver for the Adafruit MAX31855 thermocouple breakout.
35+
*/
36+
/**************************************************************************/
2837
class Adafruit_MAX31855 {
29-
public:
38+
public:
3039
Adafruit_MAX31855(int8_t _sclk, int8_t _cs, int8_t _miso);
3140
Adafruit_MAX31855(int8_t _cs);
3241

3342
void begin(void);
3443
double readInternal(void);
3544
double readCelsius(void);
36-
double readFarenheit(void);
45+
double readFahrenheit(void);
3746
uint8_t readError();
3847

39-
private:
48+
private:
4049
Adafruit_SPIDevice spi_dev = NULL;
4150
boolean initialized;
4251

README.md

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
1-
# Adafruit-MAX31855-library
2-
<!-- START COMPATIBILITY TABLE -->
1+
# Adafruit-MAX31855-library ![Build Status](https://github.com/adafruit/Adafruit-MAX31855-library/workflows/Arduino%20Library%20CI/badge.svg)
32

4-
## Compatibility
3+
Driver for the [Adafruit MAX31855 Thermocouple Amplifier](https://www.adafruit.com/product/269)
54

6-
MCU | Tested Works | Doesn't Work | Not Tested | Notes
7-
------------------ | :----------: | :----------: | :---------: | -----
8-
Atmega328 @ 16MHz | X | | |
9-
Atmega328 @ 12MHz | X | | | For LCD example had to move pin 7.
10-
Atmega32u4 @ 16MHz | X | | |
11-
Atmega32u4 @ 8MHz | X | | |
12-
ESP8266 | X | | |
13-
Atmega2560 @ 16MHz | X | | |
14-
ATSAM3X8E | X | | |
15-
ATSAM21D | X | | |
16-
ATtiny85 @ 16MHz | | X | |
17-
ATtiny85 @ 8MHz | | X | |
18-
Intel Curie @ 32MHz | | | X |
19-
STM32F2 | | | X |
5+
## Info
206

21-
* ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini
22-
* ATmega328 @ 12MHz : Adafruit Pro Trinket 3V
23-
* ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0
24-
* ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro
25-
* ESP8266 : Adafruit Huzzah
26-
* ATmega2560 @ 16MHz : Arduino Mega
27-
* ATSAM3X8E : Arduino Due
28-
* ATSAM21D : Arduino Zero, M0 Pro
29-
* ATtiny85 @ 16MHz : Adafruit Trinket 5V
30-
* ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V
7+
The MAX31855K does everything for you, and can be easily interfaced with any microcontroller, even one without an analog input. This breakout board has the chip itself, a 3.3V regulator with 10uF bypass capacitors and level shifting circuitry, all assembled and tested. For use with
8+
[type K thermocouples](http://www.adafruit.com/products/270)
319

32-
<!-- END COMPATIBILITY TABLE -->
10+
Adafruit invests time and resources providing this open source code, please
11+
support Adafruit and open-source hardware by purchasing products from
12+
[Adafruit](https://www.adafruit.com)!
13+
14+
## License
15+
16+
BSD license, all text above must be included in any redistribution.

0 commit comments

Comments
 (0)