doxyclang

This commit is contained in:
lady ada 2020-05-28 17:24:30 -04:00
parent c2bddcf43c
commit 8d48fd2708
2 changed files with 43 additions and 32 deletions

View file

@ -30,13 +30,13 @@
#include "Adafruit_SHTC3.h"
/*!
* @brief SHTC3 constructor using i2c
* @param *theWire
* optional wire
* @brief SHTC3 constructor
*/
Adafruit_SHTC3::Adafruit_SHTC3(void) {
}
Adafruit_SHTC3::Adafruit_SHTC3(void) {}
/*!
* @brief SHTC3 destructor
*/
Adafruit_SHTC3::~Adafruit_SHTC3(void) {
if (temp_sensor) {
delete temp_sensor;
@ -49,7 +49,7 @@ Adafruit_SHTC3::~Adafruit_SHTC3(void) {
/**
* Initialises the I2C bus, and assigns the I2C address to us.
*
* @param i2caddr The I2C address to use for the sensor.
* @param theWire The I2C bus to use, defaults to &Wire
*
* @return True if initialisation was successful, otherwise False.
*/
@ -76,6 +76,11 @@ bool Adafruit_SHTC3::begin(TwoWire *theWire) {
return true;
}
/**
* @brief Brings the SHTC3 in or out of sleep mode
*
* @param sleepmode If true, go into sleep mode. Else, wakeup
*/
void Adafruit_SHTC3::sleep(bool sleepmode) {
if (sleepmode) {
writeCommand(SHTC3_SLEEP);
@ -85,10 +90,13 @@ void Adafruit_SHTC3::sleep(bool sleepmode) {
}
}
void Adafruit_SHTC3::lowPowerMode(bool readmode) {
_lpMode = readmode;
}
/**
* @brief Tells the SHTC3 to read future data in low power (fast) or normal
* (precise)
*
* @param readmode If true, use low power mode for reads
*/
void Adafruit_SHTC3::lowPowerMode(bool readmode) { _lpMode = readmode; }
/**
* Gets the ID register contents.
@ -140,7 +148,7 @@ bool Adafruit_SHTC3::getEvent(sensors_event_t *humidity,
delay(13);
}
while (! i2c_dev->read(readbuffer, sizeof(readbuffer))) {
while (!i2c_dev->read(readbuffer, sizeof(readbuffer))) {
delay(1);
}
@ -189,8 +197,6 @@ void Adafruit_SHTC3::fillHumidityEvent(sensors_event_t *humidity,
humidity->relative_humidity = _humidity;
}
/**
* @brief Gets the Adafruit_Sensor object for the SHTC3's humidity sensor
*
@ -288,7 +294,8 @@ bool Adafruit_SHTC3::writeCommand(uint16_t command) {
*
* @param cmd The 16-bit command ID to send.
*/
bool Adafruit_SHTC3::readCommand(uint16_t command, uint8_t *buffer, uint8_t num_bytes) {
bool Adafruit_SHTC3::readCommand(uint16_t command, uint8_t *buffer,
uint8_t num_bytes) {
uint8_t cmd[2];
cmd[0] = command >> 8;
@ -297,7 +304,6 @@ bool Adafruit_SHTC3::writeCommand(uint16_t command) {
return i2c_dev->write_then_read(cmd, 2, buffer, num_bytes);
}
/**
* Performs a CRC8 calculation on the supplied values.
*

View file

@ -25,16 +25,23 @@
#include <Adafruit_Sensor.h>
#define SHTC3_DEFAULT_ADDR 0x70 /**< SHTC3 I2C Address */
#define SHTC3_NORMAL_MEAS_TFIRST_STRETCH 0x7CA2 /**< Normal measurement, temp first with Clock Stretch Enabled */
#define SHTC3_LOWPOW_MEAS_TFIRST_STRETCH 0x6458 /**< Low power measurement, temp first with Clock Stretch Enabled */
#define SHTC3_NORMAL_MEAS_HFIRST_STRETCH 0x5C24 /**< Normal measurement, hum first with Clock Stretch Enabled */
#define SHTC3_LOWPOW_MEAS_HFIRST_STRETCH 0x44DE /**< Low power measurement, hum first with Clock Stretch Enabled */
#define SHTC3_NORMAL_MEAS_TFIRST 0x7866 /**< Normal measurement, temp first with Clock Stretch disabled */
#define SHTC3_LOWPOW_MEAS_TFIRST 0x609C /**< Low power measurement, temp first with Clock Stretch disabled */
#define SHTC3_NORMAL_MEAS_HFIRST 0x58E0 /**< Normal measurement, hum first with Clock Stretch disabled */
#define SHTC3_LOWPOW_MEAS_HFIRST 0x401A /**< Low power measurement, hum first with Clock Stretch disabled */
#define SHTC3_NORMAL_MEAS_TFIRST_STRETCH \
0x7CA2 /**< Normal measurement, temp first with Clock Stretch Enabled */
#define SHTC3_LOWPOW_MEAS_TFIRST_STRETCH \
0x6458 /**< Low power measurement, temp first with Clock Stretch Enabled */
#define SHTC3_NORMAL_MEAS_HFIRST_STRETCH \
0x5C24 /**< Normal measurement, hum first with Clock Stretch Enabled */
#define SHTC3_LOWPOW_MEAS_HFIRST_STRETCH \
0x44DE /**< Low power measurement, hum first with Clock Stretch Enabled */
#define SHTC3_NORMAL_MEAS_TFIRST \
0x7866 /**< Normal measurement, temp first with Clock Stretch disabled */
#define SHTC3_LOWPOW_MEAS_TFIRST \
0x609C /**< Low power measurement, temp first with Clock Stretch disabled */
#define SHTC3_NORMAL_MEAS_HFIRST \
0x58E0 /**< Normal measurement, hum first with Clock Stretch disabled */
#define SHTC3_LOWPOW_MEAS_HFIRST \
0x401A /**< Low power measurement, hum first with Clock Stretch disabled */
#define SHTC3_READID 0xEFC8 /**< Read Out of ID Register */
#define SHTC3_SOFTRESET 0x805D /**< Soft Reset */
@ -82,8 +89,6 @@ private:
Adafruit_SHTC3 *_theSHTC3 = NULL;
};
/**
* Driver for the Adafruit SHTC3 Temperature and Humidity breakout board.
*/
@ -114,7 +119,7 @@ protected:
Adafruit_SHTC3_Humidity *humidity_sensor =
NULL; ///< Humidity sensor data object
private:
private:
bool _lpMode = false;
bool writeCommand(uint16_t cmd);
bool readCommand(uint16_t command, uint8_t *buffer, uint8_t num_bytes);