grove: add documentation for grove module
authorBrendan Le Foll <brendan.le.foll@intel.com>
Mon, 11 Aug 2014 13:12:23 +0000 (14:12 +0100)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Mon, 11 Aug 2014 13:12:23 +0000 (14:12 +0100)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
examples/groveled.cxx
examples/grovetemp.cxx
src/grove/grove.h

index 59de305..25a4ba3 100644 (file)
@@ -29,7 +29,7 @@
 int
 main(int argc, char **argv)
 {
-    // Use i2c device 0 all the time
+//! [Interesting]
     upm::GroveLed* led = new upm::GroveLed(2);
     std::cout << led->name() << std::endl;
     for (int i=0; i < 10; i++) {
@@ -38,6 +38,7 @@ main(int argc, char **argv)
         led->off();
         sleep(1);
     }
+//! [Interesting]
 
     return 0;
 }
index 3053ed1..7ec07ed 100644 (file)
 int
 main(int argc, char **argv)
 {
-    // Use i2c device 0 all the time
+//! [Interesting]
     upm::GroveTemp* s = new upm::GroveTemp(0);
     std::cout << s->name() << std::endl;
     for (int i=0; i < 10; i++) {
         std::cout << s->value() << std::endl;
         sleep(1);
     }
+//! [Interesting]
 
     return 0;
 }
index 86568a1..3d05a7f 100644 (file)
@@ -40,6 +40,13 @@ class Grove {
         std::string m_name;
 };
 
+/**
+ * @brief C++ API for Grove LED
+ *
+ * Very basic UPM module for grove LED, or any LED for that matter
+ *
+ * @snippet groveled.cxx Interesting
+ */
 class GroveLed: public Grove {
     public:
         GroveLed(int pin);
@@ -51,21 +58,55 @@ class GroveLed: public Grove {
         mraa_gpio_context m_gpio;
 };
 
+/**
+ * @brief C++ API for Grove Temperature sensor
+ *
+ * Very basic UPM module for grove temperature sensor on analog
+ *
+ * @snippet grovetemp.cxx Interesting
+ */
 class GroveTemp: public Grove {
     public:
         GroveTemp(unsigned int pin);
         ~GroveTemp();
+        /**
+         * Get raw value from AIO pin
+         *
+         * @return the raw value from the ADC
+         */
         float raw_value();
+        /**
+         * Get the temperature from the sensor
+         *
+         * @return the normalised temperature
+         */
         int value();
     private:
         mraa_aio_context m_aio;
 };
 
+/**
+ * @brief C++ API for Grove light sensor
+ *
+ * Very basic UPM module for grove Light sensor on analog
+ *
+ * @snippet grovelight.cxx Interesting
+ */
 class GroveLight: public Grove {
     public:
         GroveLight(unsigned int pin);
         ~GroveLight();
+        /**
+         * Get raw value from AIO pin
+         *
+         * @return the raw value from the ADC
+         */
         float raw_value();
+        /**
+         * Get the light value from the sensor
+         *
+         * @return the normalised light reading
+         */
         int value();
     private:
         mraa_aio_context m_aio;