Skip to content

Commit

Permalink
clang-format + doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Apr 9, 2024
1 parent 27b6d46 commit 87aeadb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/components/i2c/WipperSnapper_I2C.cpp
Expand Up @@ -430,7 +430,8 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
}
_mcp9601->configureDriver(msgDeviceInitReq);
drivers.push_back(_mcp9601);
WS_DEBUG_PRINTLN("MCP9601 Initialized with K-Type thermocouple successfully!");
WS_DEBUG_PRINTLN(
"MCP9601 Initialized with K-Type thermocouple successfully!");
} else if (strcmp("mcp9808", msgDeviceInitReq->i2c_device_name) == 0) {
_mcp9808 = new WipperSnapper_I2C_Driver_MCP9808(this->_i2c, i2cAddress);
if (!_mcp9808->begin()) {
Expand Down
29 changes: 10 additions & 19 deletions src/components/i2c/drivers/WipperSnapper_I2C_Driver_MCP9601.h
Expand Up @@ -23,8 +23,7 @@
@brief Class that provides a driver interface for a MCP9601 sensor.
*/
/**************************************************************************/
class WipperSnapper_I2C_Driver_MCP9601 : public WipperSnapper_I2C_Driver
{
class WipperSnapper_I2C_Driver_MCP9601 : public WipperSnapper_I2C_Driver {
public:
/*******************************************************************************/
/*!
Expand All @@ -36,8 +35,7 @@ class WipperSnapper_I2C_Driver_MCP9601 : public WipperSnapper_I2C_Driver
*/
/*******************************************************************************/
WipperSnapper_I2C_Driver_MCP9601(TwoWire *i2c, uint16_t sensorAddress)
: WipperSnapper_I2C_Driver(i2c, sensorAddress)
{
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
_i2c = i2c;
_sensorAddress = sensorAddress;
}
Expand All @@ -47,8 +45,7 @@ class WipperSnapper_I2C_Driver_MCP9601 : public WipperSnapper_I2C_Driver
@brief Destructor for an MCP9601 sensor.
*/
/*******************************************************************************/
~WipperSnapper_I2C_Driver_MCP9601()
{
~WipperSnapper_I2C_Driver_MCP9601() {
// Called when a MCP9601 component is deleted.
delete _MCP9601;
}
Expand All @@ -59,11 +56,9 @@ class WipperSnapper_I2C_Driver_MCP9601 : public WipperSnapper_I2C_Driver
@returns True if initialized successfully, False otherwise.
*/
/*******************************************************************************/
bool begin()
{
bool begin() {
_MCP9601 = new Adafruit_MCP9601();
if (!_MCP9601->begin((uint8_t)_sensorAddress, _i2c))
{
if (!_MCP9601->begin((uint8_t)_sensorAddress, _i2c)) {
return false;
}
_MCP9601->setADCresolution(MCP9600_ADCRESOLUTION_18);
Expand All @@ -81,31 +76,27 @@ class WipperSnapper_I2C_Driver_MCP9601 : public WipperSnapper_I2C_Driver
otherwise.
*/
/*******************************************************************************/
bool getEventAmbientTemp(sensors_event_t *tempEvent)
{
bool getEventAmbientTemp(sensors_event_t *tempEvent) {
tempEvent->temperature = _MCP9601->readAmbient();
return true;
}

/*******************************************************************************/
/*!
@brief Gets the MCP9601's current thermocouple temperature.
@param tempEvent
@param rawEvent
Pointer to an Adafruit_Sensor event.
@returns True if the temperature was obtained successfully, False
otherwise.
*/
/*******************************************************************************/
bool getEventRaw(sensors_event_t *rawEvent)
{
bool getEventRaw(sensors_event_t *rawEvent) {
uint8_t status = _MCP9601->getStatus();
if (status & MCP9601_STATUS_OPENCIRCUIT)
{
if (status & MCP9601_STATUS_OPENCIRCUIT) {
WS_DEBUG_PRINTLN("Thermocouple open!");
return false;
}
if (status & MCP9601_STATUS_SHORTCIRCUIT)
{
if (status & MCP9601_STATUS_SHORTCIRCUIT) {
WS_DEBUG_PRINTLN("Thermocouple shorted to ground!");
return false;
}
Expand Down

0 comments on commit 87aeadb

Please sign in to comment.