Skip to content

Commit

Permalink
Change to const char* to get rid of compilation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed May 25, 2020
1 parent 723c9fe commit d961e58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/SparkFun_SHTC3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SHTC3_Status_TypeDef SHTC3::sendCommand(SHTC3_MeasurementModes_TypeDef cmd)
return sendCommand((SHTC3_Commands_TypeDef)cmd);
}

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

SHTC3_Status_TypeDef SHTC3::exitOp(SHTC3_Status_TypeDef status, char *file, uint16_t line)
SHTC3_Status_TypeDef SHTC3::exitOp(SHTC3_Status_TypeDef status, const char *file, uint16_t line)
{
lastStatus = status;
SHTC3_exitOp_Callback(status, _inProcess, file, line);
Expand Down Expand Up @@ -403,7 +403,9 @@ SHTC3_Status_TypeDef SHTC3::update()

SHTC3_Status_TypeDef SHTC3::checkCRC(uint16_t packet, uint8_t cs)
{
uint8_t data[2] = {((packet & 0xFF00) >> 8), ((packet & 0x00FF) >> 0)};
uint8_t upper = packet >> 8;
uint8_t lower = packet & 0x00FF;
uint8_t data[2] = {upper, lower};
uint8_t crc = 0xFF;
uint8_t poly = 0x31;

Expand Down Expand Up @@ -446,4 +448,4 @@ float SHTC3_raw2Percent(uint16_t RH)
return 100 * ((float)RH / 65535);
}

void SHTC3_exitOp_Callback(SHTC3_Status_TypeDef status, bool inProcess, char *file, uint16_t line) {} // Empty implementation. You can make your own implementation
void SHTC3_exitOp_Callback(SHTC3_Status_TypeDef status, bool inProcess, const char *file, uint16_t line) {} // Empty implementation. You can make your own implementation
8 changes: 4 additions & 4 deletions src/SparkFun_SHTC3.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class SHTC3
bool _isAsleep; // Used to indicate if a wake() command is needed before talking

SHTC3_Status_TypeDef sendCommand(SHTC3_Commands_TypeDef cmd);
SHTC3_Status_TypeDef sendCommand(SHTC3_MeasurementModes_TypeDef cmd); // Overloaded version of send command to support the "measurement type" commands
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
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
SHTC3_Status_TypeDef sendCommand(SHTC3_MeasurementModes_TypeDef cmd); // Overloaded version of send command to support the "measurement type" commands
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
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

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

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
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

#endif /* SF_SHTC3 */

0 comments on commit d961e58

Please sign in to comment.