summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-12-31 15:19:36 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-12-31 15:19:36 +0100
commitd3e2b724b4f924b9839f2896db4455c2564cf29d (patch)
treeef5e2720a2aa719378c7e016a0dace67ac9b6e0b
parent666124c9a2b1a7ac81d9129a489ed378c0856624 (diff)
am2320: documentation
-rw-r--r--include/driver/am2320.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/driver/am2320.h b/include/driver/am2320.h
index 606bbd5..d0e1653 100644
--- a/include/driver/am2320.h
+++ b/include/driver/am2320.h
@@ -6,6 +6,13 @@
#ifndef AM2320_H
#define AM2320_H
+/**
+ * Driver for AM2320 I2C Temperature and Humidity Sensor.
+ * The sensor is in a low-power sleep mode by default. The read() function
+ * causes it to wake up, perform a single temperature and humidity reading, and
+ * go back to sleeep. Afterwards, the results can be read using getStatus(),
+ * getTemp(), and getHumidity().
+ */
class AM2320 {
private:
AM2320(const AM2320 &copy);
@@ -14,11 +21,34 @@ class AM2320 {
unsigned char rxbuf[8];
public:
+ /**
+ * The constructor does nothing.
+ * @param addr AM2320 I2C address
+ */
AM2320(unsigned char const addr) : address(addr) {}
+ /**
+ * Perform a single temperature and humidity measurement. Afterwards,
+ * the readings can be accessed using getTemp() and getHumidity().
+ */
void read();
+
+ /**
+ * Check whether the latest read() operation returned valid data.
+ * @return 0 if valid, non-zero otherwise
+ */
unsigned char getStatus();
+
+ /**
+ * Return temperature measured by latest read() call.
+ * @return temperature [degree celsius]
+ */
float getTemp();
+
+ /**
+ * Return humidity measured by latest read() call.
+ * @return relative humidity [percent]
+ */
float getHumidity();
};