"Library" for reading force values from LCM101 S-beam force sensor Simply reading out an analog value, and scaling it

Files at this revision

API Documentation at this revision

Comitter:
megrootens
Date:
Thu Aug 25 14:34:28 2016 +0000
Parent:
0:116acb03eb85
Commit message:
C++ Style guide: file names lower case

Changed in this revision

Lcm101.h Show diff for this revision Revisions of this file
lcm101.h Show annotated file Show diff for this revision Revisions of this file
diff -r 116acb03eb85 -r 493c1de4a28d Lcm101.h
--- a/Lcm101.h	Wed Aug 24 13:08:37 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-#ifndef _LCM101_H_
-#define _LCM101_H_
-
-#include "mbed.h"
-
-/**
- * Simple class to read out an LCM101 S-beam force sensor connected to an analog
- * input.
- */
-class Lcm101 {
-public:
-
-    /**
-     * @param pin_a_in PinName of analog input
-     * @param offset of analog value (calibration data)
-     * @param factor multiplication factor for analog value (calibration data)
-     */
-    Lcm101(PinName pin_a_in, float offset, float factor) :
-        analog_in_(pin_a_in),
-        kOffset_(offset),
-        kFactor_(factor)
-    {
-    }
-
-    /**
-     * @return unscaled analog input value
-     */
-    float getForceRaw() 
-    {
-        return analog_in_.read();
-    }
-
-    /**
-     * @return force value kOffset_ + kFactor_ * getForceRaw();
-     */
-    float getForce() 
-    {
-        return kOffset_ + kFactor_ * getForceRaw();
-    }
-    
-    /**
-     * @return ffset of analog value
-     */
-    float get_offset() { return kOffset_; }
-    
-    /**
-     * @return factor multiplication factor for analog value
-     */
-    float get_factor() { return kFactor_; }
-
-
-private:
-    AnalogIn analog_in_;
-    
-    const float kOffset_;
-    const float kFactor_;
-};
-
-#endif
\ No newline at end of file
diff -r 116acb03eb85 -r 493c1de4a28d lcm101.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lcm101.h	Thu Aug 25 14:34:28 2016 +0000
@@ -0,0 +1,59 @@
+#ifndef _LCM101_H_
+#define _LCM101_H_
+
+#include "mbed.h"
+
+/**
+ * Simple class to read out an LCM101 S-beam force sensor connected to an analog
+ * input.
+ */
+class Lcm101 {
+public:
+
+    /**
+     * @param pin_a_in PinName of analog input
+     * @param offset of analog value (calibration data)
+     * @param factor multiplication factor for analog value (calibration data)
+     */
+    Lcm101(PinName pin_a_in, float offset, float factor) :
+        analog_in_(pin_a_in),
+        kOffset_(offset),
+        kFactor_(factor)
+    {
+    }
+
+    /**
+     * @return unscaled analog input value
+     */
+    float getForceRaw() 
+    {
+        return analog_in_.read();
+    }
+
+    /**
+     * @return force value kOffset_ + kFactor_ * getForceRaw();
+     */
+    float getForce() 
+    {
+        return kOffset_ + kFactor_ * getForceRaw();
+    }
+    
+    /**
+     * @return ffset of analog value
+     */
+    float get_offset() { return kOffset_; }
+    
+    /**
+     * @return factor multiplication factor for analog value
+     */
+    float get_factor() { return kFactor_; }
+
+
+private:
+    AnalogIn analog_in_;
+    
+    const float kOffset_;
+    const float kFactor_;
+};
+
+#endif
\ No newline at end of file