Allows for a 90 frame animated gauge to be display on the uLCD

Dependents:   uLCDgaugeTest

Files at this revision

API Documentation at this revision

Comitter:
Striker121
Date:
Fri Mar 13 15:20:33 2015 +0000
Parent:
1:5666427710f2
Child:
3:eee40e4de1c4
Commit message:
Added extra inputs needed for custom gauges

Changed in this revision

uLCD_gauges.cpp Show annotated file Show diff for this revision Revisions of this file
uLCD_gauges.h Show annotated file Show diff for this revision Revisions of this file
--- a/uLCD_gauges.cpp	Fri Mar 13 14:05:32 2015 +0000
+++ b/uLCD_gauges.cpp	Fri Mar 13 15:20:33 2015 +0000
@@ -1,25 +1,50 @@
 #include "uLCD_gauges.h"
 #include "mbed.h"
- 
+
+/**
+* Constructor for the uLCD_gauges class. Sets up the value mapping assuming the default gauge is used.
+* @author Matthew Arceri
+* @param screen The uLCD instance that is going to be used for the gauge
+* @param min The minimum value the gauge wil be updated with. Used for mapping.
+* @param max The maximum value the gauge wil be updated with. Used for mapping.
+* @date 3/13/2015
+*/
 uLCD_gauges::uLCD_gauges(uLCD_4DGL& screen, float min, float max){
     uLCD = &screen;
     minVal = min;
     maxVal = max;
     mapOffset = 1;
-    mapSlope = (90 - 1) / (maxVal - minVal);
+    highFrame = 90;
+    mapSlope = (highFrame - mapOffset) / (maxVal - minVal);
     memHigh = 0;
     memLow = 0;
 }
- 
-uLCD_gauges::uLCD_gauges(uLCD_4DGL& screen, float min, float max, long memoryAddressHigh, long memoryAddressLow){
+/**
+* Constructor for the uLCD_gauges class. Sets up the value mapping for custom gauges.
+* @author Matthew Arceri
+* @param screen The uLCD instance that is going to be used for the gauge
+* @param min The minimum value the gauge wil be updated with. Used for mapping.
+* @param max The maximum value the gauge wil be updated with. Used for mapping.
+* @param memoryAddressHigh The ending memory address of the animation that will be displayed as a gauge.
+* @param memoryAddressLow The starting memory address of the animation that will be displayed as a gauge.
+* @date 3/13/2015
+*/
+uLCD_gauges::uLCD_gauges(uLCD_4DGL& screen, float min, float max, int lowF, int highF, long memoryAddressHigh, long memoryAddressLow){
     uLCD = &screen;
     minVal = min;
     maxVal = max;
-    mapOffset = 1;
-    mapSlope = (90 - 1) / (maxVal - minVal);
+    highFrame = highF;
+    mapOffset = lowF;
+    mapSlope = (highFrame - mapOffset) / (maxVal - minVal);
     memHigh = memoryAddressHigh;
     memLow = memoryAddressLow;
 }
+
+/**
+* This method repares the uLCD for displaying the gauge. Must be called once after object instancing
+* @author Matthew Arceri
+* @date 3/13/15
+*/
 void uLCD_gauges::start() {
     uLCD->baudrate(3000000);
     uLCD->cls();
@@ -27,6 +52,12 @@
     uLCD->set_sector_address(0,0);
 }
 
+/**
+* This method updates the gauge based on the new input value
+* @author Harsha Nori
+* @param value The value to be mapped onto the display
+* @date 3/13/15
+*/
 void uLCD_gauges::update(float value){
     //Map value in range minVal to maxVal onto 1 to 99
     int mappedValue = int(mapOffset + mapSlope*(value - minVal));
--- a/uLCD_gauges.h	Fri Mar 13 14:05:32 2015 +0000
+++ b/uLCD_gauges.h	Fri Mar 13 15:20:33 2015 +0000
@@ -1,3 +1,11 @@
+/**
+* @file uLCD_gauges.h
+* @brief This header file lists the functions needed to control gauge display on the uLCD 
+*
+* @author Matthew Arceri and Harsha Nori
+*
+* @date 3/13/2015
+*/
 #ifndef ULCD_GAUGES_H
 #define ULCD_GAUGES_H
  
@@ -7,7 +15,7 @@
 class uLCD_gauges {
 public:
     uLCD_gauges(uLCD_4DGL& screen, float min, float max);
-    uLCD_gauges(uLCD_4DGL& screen, float min, float max, long memoryAddressHigh, long memoryAddressLow);
+    uLCD_gauges(uLCD_4DGL& screen, float min, float max, int lowF, int highF, long memoryAddressHigh, long memoryAddressLow);
     void start();
     void update(float value);
   
@@ -17,6 +25,7 @@
     float maxVal;
     float mapOffset;
     float mapSlope;
+    float highFrame;
     long memHigh;
     long memLow;
 };