Skip to content

Commit 57e82ad

Browse files
author
FischerMoseley
committed
Added Travis CI, fixed spelling, added readme and license files.
Can't spell coefficient 😢
1 parent b95a8a6 commit 57e82ad

File tree

6 files changed

+158
-28
lines changed

6 files changed

+158
-28
lines changed

.travis.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
language: c
2+
before_install:
3+
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16"
4+
- sleep 3
5+
- export DISPLAY=:1.0
6+
- wget http://downloads.arduino.cc/arduino-1.8.9-linux64.tar.xz
7+
- tar xf arduino-1.8.9-linux64.tar.xz
8+
- sudo mv arduino-1.8.9 /usr/local/share/arduino
9+
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
10+
install:
11+
- ln -s $PWD /usr/local/share/arduino/libraries/Adafruit_FONA
12+
- arduino --install-library "SparkFun MCP9600 Arduino Library,Adafruit MQTT Library"
13+
script:
14+
- arduino --verify --board arduino:avr:uno $PWD/examples/Example1_BasicReadings/Example1_BasicReadings.ino
15+
- arduino --verify --board arduino:avr:uno $PWD/examples/Example2_SetThermocoupleType/Example2_SetThermocoupleType.ino
16+
- arduino --verify --board arduino:avr:uno $PWD/examples/Example3_SetFilterCoefficient/Example3_SetFilterCoefficient.ino
17+
- arduino --verify --board arduino:avr:uno $PWD/examples/Example4_SetResolution/Example4_SetResolution.ino
18+
- arduino --verify --board arduino:avr:uno $PWD/examples/Example5_BurstMode/Example5_BurstMode.ino
19+
- arduino --verify --board arduino:avr:uno $PWD/examples/Example6_ConfigureTemperatureAlert/Example6_ConfigureTemperatureAlert.ino
20+
notifications:
21+
email:
22+
on_success: change
23+
on_failure: change

LICENSE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
SparkFun License Information
2+
============================
3+
4+
SparkFun uses two different licenses for our files — one for hardware and one for code.
5+
6+
Hardware
7+
---------
8+
9+
**SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).**
10+
11+
Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode).
12+
13+
You are free to:
14+
15+
Share — copy and redistribute the material in any medium or format
16+
Adapt — remix, transform, and build upon the material
17+
for any purpose, even commercially.
18+
The licensor cannot revoke these freedoms as long as you follow the license terms.
19+
Under the following terms:
20+
21+
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
22+
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
23+
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
24+
Notices:
25+
26+
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
27+
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
28+
29+
30+
Code
31+
--------
32+
33+
**SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).**
34+
35+
The MIT License (MIT)
36+
37+
Copyright (c) 2016 SparkFun Electronics
38+
39+
Permission is hereby granted, free of charge, to any person obtaining a copy
40+
of this software and associated documentation files (the "Software"), to deal
41+
in the Software without restriction, including without limitation the rights
42+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43+
copies of the Software, and to permit persons to whom the Software is
44+
furnished to do so, subject to the following conditions:
45+
46+
The above copyright notice and this permission notice shall be included in all
47+
copies or substantial portions of the Software.
48+
49+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55+
SOFTWARE.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
SparkFun MCP9600 Arduino Library [![Build Status](https://travis-ci.com/sparkfun/SparkFun_MCP9600_Arduino_Library.svg?token=3wUDYUD5kXLUXs2Cb6te&branch=master)](https://travis-ci.com/sparkfun/SparkFun_MCP9600_Arduino_Library)
2+
========================================
3+
4+
![SparkFun MCP9600 Breakout](https://media.tenor.com/images/47b81948be5023555549c01d88ae3289/tenor.gif)
5+
6+
This library allows the user to:
7+
8+
* Read temperature in Celcius or Fahrenheit
9+
* Use a variety of thermocouple types
10+
* Configure the onboard exponential moving average filter
11+
* Set up continuous and burst conversion modes
12+
* Configure temperature alerts
13+
14+
15+
Repository Contents
16+
-------------------
17+
18+
* **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE.
19+
* **/extras** - Additional documentation for the user. These files are ignored by the IDE.
20+
* **/src** - Source files for the library (.cpp, .h).
21+
* **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE.
22+
* **library.properties** - General library properties for the Arduino package manager.
23+
24+
Documentation
25+
--------------
26+
27+
* **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library.
28+
* **[Product Repository](https://github.com/sparkfun/BME280-Breakout-Board)** - Main repository (including hardware files) for the SparkFun BME280 Breakout.
29+
* **[Hookup Guide](https://learn.sparkfun.com/tutorials/sparkfun-bme280-breakout-hookup-guide)** - Basic hookup guide for the SparkFun BME280 Breakout.
30+
31+
Products that use this Library
32+
---------------------------------
33+
34+
* [*SEN-14348*](https://www.sparkfun.com/products/14348)
35+
36+
Version History
37+
---------------
38+
39+
* [V_1.0.0](https://github.com/sparkfun/SparkFun_MCP9600_Arduino_Library/tree/V_1.0.0) - Public release.
40+
41+
License Information
42+
-------------------
43+
44+
This product is _**open source**_!
45+
46+
Please review the LICENSE.md file for license information.
47+
48+
If you have any questions or concerns on licensing, please contact techsupport@sparkfun.com.
49+
50+
Distributed as-is; no warranty is given.
51+
52+
- Your friends at SparkFun.

examples/Example3_SetFilterCoeffecients/Example3_SetFilterCoeffecients.ino renamed to examples/Example3_SetFilterCoefficient/Example3_SetFilterCoefficient.ino

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
Setting Filter Coeffecients with the MCP9600 Thermocouple Amplifier
2+
Setting Filter Coefficient with the MCP9600 Thermocouple Amplifier
33
By: Fischer Moseley
44
SparkFun Electronics
55
Date: July 8, 2019
66
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware License).
77
88
This example outputs the ambient and thermocouple temperatures from the MCP9600 sensor, but allows the filtering
99
onboard the MCP9600 to be controlled. The MCP9600 implements an exponential running average filter, the
10-
"strength" of which is programmable! The setFilterCoeffecients function takes a coeffecient between 0 and 7,
10+
"strength" of which is programmable! The setFilterCoefficient function takes a coefficient between 0 and 7,
1111
where 0 disables the filter, 1 corresponds to minimum filtering, and 7 enables maximum filtering. The "strength"
1212
of the filter just refers to how long it takes for the filter to respond to a step function input.
1313
@@ -19,7 +19,7 @@
1919

2020
#include <SparkFun_MCP9600.h>
2121
MCP9600 tempSensor;
22-
uint8_t coeffecient = 3;
22+
uint8_t coefficient = 3;
2323

2424
void setup(){
2525
Serial.begin(115200);
@@ -46,22 +46,22 @@ void setup(){
4646
while(1); //hang forever
4747
}
4848

49-
//print the filter coeffecient that's about to be set
50-
Serial.print("Setting Filter Coeffecient to ");
51-
Serial.print(coeffecient);
49+
//print the filter coefficient that's about to be set
50+
Serial.print("Setting Filter coefficient to ");
51+
Serial.print(coefficient);
5252
Serial.println("!");
5353

54-
tempSensor.setFilterCoeffecients(coeffecient);
54+
tempSensor.setFilterCoefficient(coefficient);
5555

56-
//tell us if the coeffecient was set sucessfully
57-
if(tempSensor.getFilterCoeffecients() == coeffecient){
58-
Serial.println("Filter Coeffecients set sucessfully!");
56+
//tell us if the coefficient was set sucessfully
57+
if(tempSensor.getFilterCoefficient() == coefficient){
58+
Serial.println("Filter Coefficient set sucessfully!");
5959
}
6060

6161
else{
62-
Serial.println("Setting filter coeffecient failed!");
63-
Serial.println("The value of the coeffecient is: ");
64-
Serial.println(tempSensor.getFilterCoeffecients(), BIN);
62+
Serial.println("Setting filter coefficient failed!");
63+
Serial.println("The value of the coefficient is: ");
64+
Serial.println(tempSensor.getFilterCoefficient(), BIN);
6565
}
6666
}
6767

@@ -73,8 +73,8 @@ void loop(){ //print the thermocouple, ambient and delta temperatures every 200m
7373
Serial.print(" °C Temperature Delta: ");
7474
Serial.print(tempSensor.tempDelta());
7575
Serial.print(" °C");
76-
Serial.print(" Current Coeffecient: ");
77-
Serial.print(tempSensor.getFilterCoeffecients(), BIN);
76+
Serial.print(" Current coefficient: ");
77+
Serial.print(tempSensor.getFilterCoefficient(), BIN);
7878
Serial.println();
7979
delay(200);
8080
}

src/SparkFun_MCP9600.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,31 +145,31 @@ Thermocouple_Type MCP9600::getThermocoupleType(){
145145
return (config >> 4); //clear the non-thermocouple-type bits in the config registe
146146
}
147147

148-
uint8_t MCP9600::setFilterCoeffecients(uint8_t coeffecient){
149-
if(coeffecient > 7) return 3; //return immediately if the value is too big
148+
uint8_t MCP9600::setFilterCoefficient(uint8_t coefficient){
149+
if(coefficient > 7) return 3; //return immediately if the value is too big
150150

151151
uint8_t config = readSingleRegister(THERMO_SENSOR_CONFIG);
152-
bitWrite(coeffecient, 3, bitRead(config, 3));
153-
bitWrite(coeffecient, 4, bitRead(config, 3));
154-
bitWrite(coeffecient, 5, bitRead(config, 3));
155-
bitWrite(coeffecient, 6, bitRead(config, 3));
156-
bitWrite(coeffecient, 7, bitRead(config, 3));
152+
bitWrite(coefficient, 3, bitRead(config, 3));
153+
bitWrite(coefficient, 4, bitRead(config, 3));
154+
bitWrite(coefficient, 5, bitRead(config, 3));
155+
bitWrite(coefficient, 6, bitRead(config, 3));
156+
bitWrite(coefficient, 7, bitRead(config, 3));
157157

158158
//config = config >> 3;
159159
//config = config << 3;
160-
//config |= coeffecient; //set the necessary bits in the config register
160+
//config |= coefficient; //set the necessary bits in the config register
161161

162-
return writeSingleRegister(THERMO_SENSOR_CONFIG, coeffecient);
162+
return writeSingleRegister(THERMO_SENSOR_CONFIG, coefficient);
163163
}
164164

165-
uint8_t MCP9600::getFilterCoeffecients(){
165+
uint8_t MCP9600::getFilterCoefficient(){
166166
uint8_t config = readSingleRegister(THERMO_SENSOR_CONFIG);
167167
uint8_t coeff = 0;
168168
bitWrite(coeff, 0, bitRead(config, 0));
169169
bitWrite(coeff, 1, bitRead(config, 1));
170170
bitWrite(coeff, 2, bitRead(config, 2));
171171

172-
return coeff; //clear the non-filter-coeffecients data in the config register
172+
return coeff; //clear the non-filter-Coefficient data in the config register
173173
}
174174

175175
bool MCP9600::setBurstSamples(Burst_Sample samples){

src/SparkFun_MCP9600.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class MCP9600{
120120

121121
uint8_t setThermocoupleType(Thermocouple_Type type); //Changes the type of thermocouple connected to the MCP9600. Supported types are KJTNSEBR.
122122
Thermocouple_Type getThermocoupleType(); //Returns the type of thermocouple connected to the MCP9600 as found in its configuration register. Supported types are KJTNSEBR.
123-
uint8_t setFilterCoeffecients(uint8_t coeffecient); //Changes the weight of the on-chip exponential moving average filter. Set this to 0 for no filter, 1 for minimum filter, and 7 for maximum filter.
124-
uint8_t getFilterCoeffecients(); //Returns the weight of the on-chip exponential moving average filter.
123+
uint8_t setFilterCoefficient(uint8_t coefficient); //Changes the weight of the on-chip exponential moving average filter. Set this to 0 for no filter, 1 for minimum filter, and 7 for maximum filter.
124+
uint8_t getFilterCoefficient(); //Returns the weight of the on-chip exponential moving average filter.
125125

126126
bool setBurstSamples(Burst_Sample samples); //Changes the amount of samples to take in burst mode. Returns 0 if set sucessfully, 1 otherwise.
127127
Burst_Sample getBurstSamples(); //Returns the amount of samples to take in burst mode, according to the device's configuration register.

0 commit comments

Comments
 (0)