Distance Sensor Embedded Systems Project SID: 200864479 James Erringham-Bruce

Dependencies:   N5110 SRF02-JEB mbed

Committer:
ll13j7b
Date:
Wed May 04 21:20:21 2016 +0000
Revision:
1:f82359c58eda
Child:
2:01f697b856de
working version before adding classes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ll13j7b 1:f82359c58eda 1 /*
ll13j7b 1:f82359c58eda 2 @file Graph.h
ll13j7b 1:f82359c58eda 3 @brief Header file containing member functions and variables
ll13j7b 1:f82359c58eda 4 @author James Erringham-Bruce
ll13j7b 1:f82359c58eda 5 */
ll13j7b 1:f82359c58eda 6
ll13j7b 1:f82359c58eda 7 #ifndef GRAPH_H
ll13j7b 1:f82359c58eda 8 #define GRAPH_H
ll13j7b 1:f82359c58eda 9
ll13j7b 1:f82359c58eda 10 #include "mbed.h" // mbed library
ll13j7b 1:f82359c58eda 11 #include "DataController.h"
ll13j7b 1:f82359c58eda 12 #include <deque> // std::deque
ll13j7b 1:f82359c58eda 13
ll13j7b 1:f82359c58eda 14
ll13j7b 1:f82359c58eda 15 // creating the class used in plotting the graph
ll13j7b 1:f82359c58eda 16 class Graph
ll13j7b 1:f82359c58eda 17 {
ll13j7b 1:f82359c58eda 18 // defining the public functions and variables
ll13j7b 1:f82359c58eda 19 public:
ll13j7b 1:f82359c58eda 20 /**
ll13j7b 1:f82359c58eda 21 @fn graphPlot
ll13j7b 1:f82359c58eda 22 @brief plots a graph of distance on the
ll13j7b 1:f82359c58eda 23 */
ll13j7b 1:f82359c58eda 24 void plotGraph();
ll13j7b 1:f82359c58eda 25 /**
ll13j7b 1:f82359c58eda 26 @fn drawGraphAxis
ll13j7b 1:f82359c58eda 27 @brief draws the axis of the graph
ll13j7b 1:f82359c58eda 28 */
ll13j7b 1:f82359c58eda 29 void drawGraphAxis();
ll13j7b 1:f82359c58eda 30 /**
ll13j7b 1:f82359c58eda 31 @fn drawBitmap
ll13j7b 1:f82359c58eda 32 @brief draws the bit map for the vertical word used in the graph axis
ll13j7b 1:f82359c58eda 33 */
ll13j7b 1:f82359c58eda 34 void drawBitmap();
ll13j7b 1:f82359c58eda 35 /**
ll13j7b 1:f82359c58eda 36 @fn drawLines
ll13j7b 1:f82359c58eda 37 @brief draws the lines between the points on the graph
ll13j7b 1:f82359c58eda 38 */
ll13j7b 1:f82359c58eda 39 void drawLines();
ll13j7b 1:f82359c58eda 40
ll13j7b 1:f82359c58eda 41 void drawLinesBackwards();
ll13j7b 1:f82359c58eda 42
ll13j7b 1:f82359c58eda 43
ll13j7b 1:f82359c58eda 44 // defining the private functions and variables
ll13j7b 1:f82359c58eda 45 private:
ll13j7b 1:f82359c58eda 46
ll13j7b 1:f82359c58eda 47 };
ll13j7b 1:f82359c58eda 48
ll13j7b 1:f82359c58eda 49
ll13j7b 1:f82359c58eda 50 // members initialies outside of the class//
ll13j7b 1:f82359c58eda 51 /**
ll13j7b 1:f82359c58eda 52 @var i
ll13j7b 1:f82359c58eda 53 @brief used as a global variable for iterations
ll13j7b 1:f82359c58eda 54 */
ll13j7b 1:f82359c58eda 55 unsigned int i = 0;
ll13j7b 1:f82359c58eda 56 /**
ll13j7b 1:f82359c58eda 57 @var x
ll13j7b 1:f82359c58eda 58 @brief used as an x axis for drawing points on a graph
ll13j7b 1:f82359c58eda 59 */
ll13j7b 1:f82359c58eda 60 unsigned int x = 20;
ll13j7b 1:f82359c58eda 61
ll13j7b 1:f82359c58eda 62 int points[7] = {10 ,20 , 30 ,40 ,50 ,60, 70};
ll13j7b 1:f82359c58eda 63
ll13j7b 1:f82359c58eda 64 /**
ll13j7b 1:f82359c58eda 65 @var verticalWord_bitmap
ll13j7b 1:f82359c58eda 66 @brief bitmap of the vertical word " distance "
ll13j7b 1:f82359c58eda 67 */
ll13j7b 1:f82359c58eda 68 const bool verticalWord_bitmap[46][7] = {
ll13j7b 1:f82359c58eda 69 { 0,0,0,1,1,0,0 },
ll13j7b 1:f82359c58eda 70 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 71 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 72 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 73 { 0,0,0,1,1,1,0 },
ll13j7b 1:f82359c58eda 74 { 0,0,0,0,0,0,0 },
ll13j7b 1:f82359c58eda 75 { 0,0,0,0,0,1,0 },
ll13j7b 1:f82359c58eda 76 { 0,0,1,0,0,0,1 },
ll13j7b 1:f82359c58eda 77 { 0,0,1,0,0,0,1 },
ll13j7b 1:f82359c58eda 78 { 0,0,1,0,0,0,1 },
ll13j7b 1:f82359c58eda 79 { 0,0,0,1,1,1,0 },
ll13j7b 1:f82359c58eda 80 { 0,0,0,0,0,0,0 },
ll13j7b 1:f82359c58eda 81 { 0,0,0,1,1,1,1 },
ll13j7b 1:f82359c58eda 82 { 0,0,1,0,0,0,0 },
ll13j7b 1:f82359c58eda 83 { 0,0,1,0,0,0,0 },
ll13j7b 1:f82359c58eda 84 { 0,0,0,1,0,0,0 },
ll13j7b 1:f82359c58eda 85 { 0,0,1,1,1,1,1 },
ll13j7b 1:f82359c58eda 86 { 0,0,0,0,0,0,0 },
ll13j7b 1:f82359c58eda 87 { 0,0,0,1,1,1,1 },
ll13j7b 1:f82359c58eda 88 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 89 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 90 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 91 { 0,0,0,0,0,1,0 },
ll13j7b 1:f82359c58eda 92 { 0,0,0,0,0,0,0 },
ll13j7b 1:f82359c58eda 93 { 0,0,0,0,0,1,0 },
ll13j7b 1:f82359c58eda 94 { 0,0,0,0,0,0,1 },
ll13j7b 1:f82359c58eda 95 { 0,0,1,0,0,0,1 },
ll13j7b 1:f82359c58eda 96 { 1,1,1,1,1,1,0 },
ll13j7b 1:f82359c58eda 97 { 0,0,1,0,0,0,0 },
ll13j7b 1:f82359c58eda 98 { 0,0,0,0,0,0,0 },
ll13j7b 1:f82359c58eda 99 { 0,0,1,0,0,1,0 },
ll13j7b 1:f82359c58eda 100 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 101 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 102 { 0,0,1,0,1,0,1 },
ll13j7b 1:f82359c58eda 103 { 0,0,0,1,0,0,1 },
ll13j7b 1:f82359c58eda 104 { 0,0,0,0,0,0,0 },
ll13j7b 1:f82359c58eda 105 { 0,0,0,0,0,0,1 },
ll13j7b 1:f82359c58eda 106 { 1,0,1,1,1,1,1 },
ll13j7b 1:f82359c58eda 107 { 0,0,1,0,0,0,1 },
ll13j7b 1:f82359c58eda 108 { 0,0,0,0,0,0,0 },
ll13j7b 1:f82359c58eda 109 { 1,1,1,1,1,1,1 },
ll13j7b 1:f82359c58eda 110 { 0,0,0,1,0,0,1 },
ll13j7b 1:f82359c58eda 111 { 0,0,1,0,0,0,1 },
ll13j7b 1:f82359c58eda 112 { 0,0,1,0,0,0,1 },
ll13j7b 1:f82359c58eda 113 { 0,0,0,1,1,1,0 },
ll13j7b 1:f82359c58eda 114 { 0,0,0,0,0,0,0 }
ll13j7b 1:f82359c58eda 115 };
ll13j7b 1:f82359c58eda 116
ll13j7b 1:f82359c58eda 117 #endif