Skip to content

Commit 0d7a631

Browse files
Fixed functions so -fpermissive doesn't throw errors
Also updated library properties to reflect the new release that this is accompanied by
1 parent 26d0d9d commit 0d7a631

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun MCP9600 Thermocouple Library
2-
version=1.0.0
2+
version=1.0.1
33
author=SparkFun Electronics <techsupport@sparkfun.com>
44
maintainer=Fischer Moseley <fischer.moseley@sparkfun.com>
55
sentence=Driver for Microchip's MCP9600 Thermocouple Amplifier.

src/SparkFun_MCP9600.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool MCP9600::setThermocoupleResolution(Thermocouple_Resolution res){
154154

155155
Thermocouple_Resolution MCP9600::getThermocoupleResolution(){
156156
uint8_t config = readSingleRegister(DEVICE_CONFIG); //grab current device configuration
157-
Thermocouple_Resolution res; //define new thermocoupleResolution enum to return
157+
uint8_t res; //define new thermocoupleResolution enum to return
158158
bool highResolutionBit = bitRead(config, 6);
159159
bool lowResolutionBit = bitRead(config, 5);
160160
bitWrite(res, 1, highResolutionBit); //set 1st bit of the enum to the 6th bit of the config register
@@ -225,11 +225,11 @@ Burst_Sample MCP9600::getBurstSamples(){
225225
bool highResolutionBit = bitRead(config, 4);
226226
bool midResolutionBit = bitRead(config, 3);
227227
bool lowResolutionBit = bitRead(config, 2);
228-
Burst_Sample samples;
228+
uint8_t samples;
229229
bitWrite(samples, 2, highResolutionBit); //write 4th bit of config to 2nd bit of samples
230230
bitWrite(samples, 1, midResolutionBit); //write 3rd bit of config to 1st bit of samples
231231
bitWrite(samples, 0, lowResolutionBit); //write 2nd bit of config to 0th bit of samples
232-
return samples;
232+
return static_cast<Burst_Sample>(samples);
233233
}
234234

235235
bool MCP9600::burstAvailable(){
@@ -262,7 +262,7 @@ Shutdown_Mode MCP9600::getShutdownMode(){
262262
uint8_t mode = 0;
263263
bitWrite(mode, 0, bitRead(config, 0));
264264
bitWrite(mode, 1, bitRead(config, 1));
265-
return mode; //clear all bits except the last two and return
265+
return static_cast <Shutdown_Mode>(mode); //clear all bits except the last two and return
266266
}
267267

268268

@@ -284,7 +284,7 @@ bool MCP9600::configAlertTemp(uint8_t number, float temp){
284284
tempLimitRegister = ALERT4_LIMIT;
285285
break;
286286
default:
287-
return;
287+
return 1;
288288
break;
289289
}
290290

@@ -314,7 +314,7 @@ bool MCP9600::configAlertJunction(uint8_t number, bool junction){
314314
alertConfigRegister = ALERT4_CONFIG;
315315
break;
316316
default:
317-
return;
317+
return 1;
318318
break;
319319
}
320320

@@ -340,7 +340,7 @@ bool MCP9600::configAlertHysteresis(uint8_t number, uint8_t hysteresis){
340340
alertHysteresisRegister = ALERT4_HYSTERESIS;
341341
break;
342342
default:
343-
return;
343+
return 1;
344344
break;
345345
}
346346

@@ -364,7 +364,7 @@ bool MCP9600::configAlertEdge(uint8_t number, bool edge){
364364
alertConfigRegister = ALERT4_CONFIG;
365365
break;
366366
default:
367-
return;
367+
return 1;
368368
break;
369369
}
370370

@@ -390,7 +390,7 @@ bool MCP9600::configAlertLogicLevel(uint8_t number, bool level){
390390
alertConfigRegister = ALERT4_CONFIG;
391391
break;
392392
default:
393-
return;
393+
return 1;
394394
break;
395395
}
396396

@@ -416,7 +416,7 @@ bool MCP9600::configAlertMode(uint8_t number, bool mode){
416416
alertConfigRegister = ALERT4_CONFIG;
417417
break;
418418
default:
419-
return;
419+
return 1;
420420
break;
421421
}
422422

@@ -442,7 +442,7 @@ bool MCP9600::configAlertEnable(uint8_t number, bool enable){
442442
alertConfigRegister = ALERT4_CONFIG;
443443
break;
444444
default:
445-
return;
445+
return 1;
446446
break;
447447
}
448448

@@ -472,7 +472,7 @@ bool MCP9600::clearAlertPin(uint8_t number){
472472
break;
473473

474474
default:
475-
return;
475+
return 1;
476476
break;
477477
}
478478
//grab the data already in the register so we don't override any other settings!
@@ -484,7 +484,7 @@ bool MCP9600::clearAlertPin(uint8_t number){
484484
}
485485

486486
bool MCP9600::isTempGreaterThanLimit(uint8_t number){
487-
if(number > 4) return; //if a nonexistent alert number is given, return with nothing
487+
if(number > 4) return 0; //if a nonexistent alert number is given, return with nothing
488488
uint8_t status = readSingleRegister(SENSOR_STATUS);
489489
switch (number){
490490
case 1:
@@ -500,7 +500,7 @@ bool MCP9600::isTempGreaterThanLimit(uint8_t number){
500500
return bitRead(status, 3);
501501
break;
502502
default:
503-
return;
503+
return 1;
504504
break;
505505
}
506506
}
@@ -520,7 +520,6 @@ uint8_t MCP9600::readSingleRegister(MCP9600_Register reg){
520520
return _i2cPort->read();
521521
}
522522
}
523-
return;
524523
}
525524

526525
uint16_t MCP9600::readDoubleRegister(MCP9600_Register reg){
@@ -538,7 +537,6 @@ uint16_t MCP9600::readDoubleRegister(MCP9600_Register reg){
538537
return data;
539538
}
540539
}
541-
return;
542540
}
543541

544542
bool MCP9600::writeSingleRegister(MCP9600_Register reg, uint8_t data){

0 commit comments

Comments
 (0)