Skip to content

Commit d961e58

Browse files
committed
Change to const char* to get rid of compilation warnings.
1 parent 723c9fe commit d961e58

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/SparkFun_SHTC3.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ SHTC3_Status_TypeDef SHTC3::sendCommand(SHTC3_MeasurementModes_TypeDef cmd)
2828
return sendCommand((SHTC3_Commands_TypeDef)cmd);
2929
}
3030

31-
SHTC3_Status_TypeDef SHTC3::abortUpdate(SHTC3_Status_TypeDef status, char *file, uint16_t line) // Sets the values to a known error state
31+
SHTC3_Status_TypeDef SHTC3::abortUpdate(SHTC3_Status_TypeDef status, const char *file, uint16_t line) // Sets the values to a known error state
3232
{
3333
passRHcrc = false;
3434
passTcrc = false;
@@ -41,7 +41,7 @@ SHTC3_Status_TypeDef SHTC3::abortUpdate(SHTC3_Status_TypeDef status, char *file,
4141
return exitOp(status, file, line);
4242
}
4343

44-
SHTC3_Status_TypeDef SHTC3::exitOp(SHTC3_Status_TypeDef status, char *file, uint16_t line)
44+
SHTC3_Status_TypeDef SHTC3::exitOp(SHTC3_Status_TypeDef status, const char *file, uint16_t line)
4545
{
4646
lastStatus = status;
4747
SHTC3_exitOp_Callback(status, _inProcess, file, line);
@@ -403,7 +403,9 @@ SHTC3_Status_TypeDef SHTC3::update()
403403

404404
SHTC3_Status_TypeDef SHTC3::checkCRC(uint16_t packet, uint8_t cs)
405405
{
406-
uint8_t data[2] = {((packet & 0xFF00) >> 8), ((packet & 0x00FF) >> 0)};
406+
uint8_t upper = packet >> 8;
407+
uint8_t lower = packet & 0x00FF;
408+
uint8_t data[2] = {upper, lower};
407409
uint8_t crc = 0xFF;
408410
uint8_t poly = 0x31;
409411

@@ -446,4 +448,4 @@ float SHTC3_raw2Percent(uint16_t RH)
446448
return 100 * ((float)RH / 65535);
447449
}
448450

449-
void SHTC3_exitOp_Callback(SHTC3_Status_TypeDef status, bool inProcess, char *file, uint16_t line) {} // Empty implementation. You can make your own implementation
451+
void SHTC3_exitOp_Callback(SHTC3_Status_TypeDef status, bool inProcess, const char *file, uint16_t line) {} // Empty implementation. You can make your own implementation

src/SparkFun_SHTC3.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ class SHTC3
6060
bool _isAsleep; // Used to indicate if a wake() command is needed before talking
6161

6262
SHTC3_Status_TypeDef sendCommand(SHTC3_Commands_TypeDef cmd);
63-
SHTC3_Status_TypeDef sendCommand(SHTC3_MeasurementModes_TypeDef cmd); // Overloaded version of send command to support the "measurement type" commands
64-
SHTC3_Status_TypeDef abortUpdate(SHTC3_Status_TypeDef status, char *file, uint16_t line); // Used to bail from an update. Sets reading values to known fail state
65-
SHTC3_Status_TypeDef exitOp(SHTC3_Status_TypeDef status, char *file, uint16_t line); // Used to bail from any other operation - puts the sensor back to sleep
63+
SHTC3_Status_TypeDef sendCommand(SHTC3_MeasurementModes_TypeDef cmd); // Overloaded version of send command to support the "measurement type" commands
64+
SHTC3_Status_TypeDef abortUpdate(SHTC3_Status_TypeDef status, const char *file, uint16_t line); // Used to bail from an update. Sets reading values to known fail state
65+
SHTC3_Status_TypeDef exitOp(SHTC3_Status_TypeDef status, const char *file, uint16_t line); // Used to bail from any other operation - puts the sensor back to sleep
6666

6767
SHTC3_Status_TypeDef startProcess(void); // Used to wake up the sensor and set the _inProcess variable to true
6868
SHTC3_Status_TypeDef endProcess(void); // Used to end processes as the user desires
@@ -101,6 +101,6 @@ float SHTC3_raw2DegC(uint16_t T); // Converts SHTC3 T data to deg C
101101
float SHTC3_raw2DegF(uint16_t T); // Converts SHTC3 T data to deg F
102102
float SHTC3_raw2Percent(uint16_t RH); // Converts SHTC3 RH data to % RH
103103

104-
void SHTC3_exitOp_Callback(SHTC3_Status_TypeDef status, bool inProcess, char *file, uint16_t line) __attribute__((weak)); // Called whenever exitOp is called, which is on most return statements
104+
void SHTC3_exitOp_Callback(SHTC3_Status_TypeDef status, bool inProcess, const char *file, uint16_t line) __attribute__((weak)); // Called whenever exitOp is called, which is on most return statements
105105

106106
#endif /* SF_SHTC3 */

0 commit comments

Comments
 (0)