Software hold - Team 1 - PRO2 2017 / Mbed 2 deprecated PRO2_samlet_kode_rev2

Dependencies:   SHTx mbed

Fork of PRO2_samlet_kode by Olga Høyer

Revision:
6:12f1849aad21
Parent:
0:21e9cc38dd31
Child:
7:75d5c1db2027
--- a/7_segment_control.cpp	Wed May 24 09:34:54 2017 +0000
+++ b/7_segment_control.cpp	Wed May 24 11:19:51 2017 +0000
@@ -1,18 +1,19 @@
 /*
-================================================================================
-==              ==                                                            ==
-== Source File: ==  main.cpp                                                  ==
-== File Name:   ==  7_segment_control.cpp                                     ==
-== Author:      ==  Poul Erik Tjørnfelt                                       ==
-== Date:        ==  07/05-2017                                                ==
-== Copyright:   ==  Open to all                                               ==
-== Version:     ==  0.6 - Creation of file.                                   ==
-==              ==                                                            ==
-== Description: ==  The .cpp file for a class, that creates instances of      ==
-==              ==  the setup of 3 seven-segmented displays that is used in   ==
-==              ==  project.                                                  ==
-==              ==                                                            ==
-================================================================================
+-------------------------------------------------------------------------------
+-- Project:         PRO2 "Awareness and Optimisation of energy consumption"
+-- Team:            Team 1
+
+-- File Name:       7_segment_control.cpp
+-- Author:          Poul Erik Tjørnfelt
+-- Date:            07/05-2017
+-- Copyright:       Open to all
+-- Version:         0.6 - Creation of file.
+--
+-- Description:     The .cpp file for a class, that creates instances of
+--                  the setup of 3 seven-segmented displays that is used in
+--                  project.
+--
+-------------------------------------------------------------------------------
 */
 
 #include "mbed.h"
@@ -21,29 +22,29 @@
 segment_7::segment_7(PinName seg_A, PinName seg_B, PinName seg_C, PinName seg_D,
                      PinName seg_E, PinName seg_F, PinName seg_G, PinName DP,
                      PinName dig_1, PinName dig_2, PinName dig_3)
-          :Seg_A(seg_A), Seg_B(seg_B), Seg_C(seg_C), Seg_D(seg_D), Seg_E(seg_E),
-           Seg_F(seg_F), Seg_G(seg_G), _DP(DP), Dig_1(dig_1), Dig_2(dig_2),
-           Dig_3(dig_3)
-/*
-        At line 7 starts the constructor. It creates instances in the memory,
-        that gets tied to the physical pins of the class. That is, it creates a
-        software representation of the pin.
- */
+    :Seg_A(seg_A), Seg_B(seg_B), Seg_C(seg_C), Seg_D(seg_D), Seg_E(seg_E),
+     Seg_F(seg_F), Seg_G(seg_G), _DP(DP), Dig_1(dig_1), Dig_2(dig_2),
+     Dig_3(dig_3)
+ /*
+         At line 7 starts the constructor. It creates instances in the memory,
+         that gets tied to the physical pins of the class. That is, it creates a
+         software representation of the pin.
+  */
 {
-    
+
 }
 
 void segment_7::show(int number, int dig)
-{    
-    switch(dig)     // First switch is for switching the transistor for the
-    {               // actual digit on.
+{
+    switch(dig) {   // First switch is for switching the transistor for the
+            // actual digit on.
         case 1:
             Dig_1 = 1;
             Dig_2 = 0;
             Dig_3 = 0;
-            switch(number)  // Second switch is for opening the output pin
-            {               // for the segments on the actual display to 
-                            // showcase a number due to the right combination.
+            switch(number) { // Second switch is for opening the output pin
+                    // for the segments on the actual display to
+                    // showcase a number due to the right combination.
                 case 0:         // 0 is used for 'L' for low.
                     Seg_A = 0;
                     Seg_B = 0;
@@ -72,8 +73,7 @@
             Dig_1 = 0;
             Dig_2 = 1;
             Dig_3 = 0;
-            switch(number)
-            {
+            switch(number) {
                 case 0:
                     Seg_A = 1;
                     Seg_B = 1;
@@ -164,7 +164,7 @@
                     Seg_F = 1;
                     Seg_G = 1;
                     break;
-                default:        // Erroneous data. So we turn off all the 
+                default:        // Erroneous data. So we turn off all the
                     Dig_1 = 0;  // displays.
                     Dig_2 = 0;
                     Dig_3 = 0;
@@ -174,8 +174,7 @@
             Dig_1 = 0;
             Dig_2 = 0;
             Dig_3 = 1;
-            switch(number)
-            {
+            switch(number) {
                 case 0:
                     Seg_A = 1;
                     Seg_B = 1;
@@ -266,11 +265,11 @@
                     Seg_F = 1;
                     Seg_G = 1;
                     break;
-                default:        // Erroneous data. So we turn off all the 
+                default:        // Erroneous data. So we turn off all the
                     Dig_1 = 0;  // displays.
                     Dig_2 = 0;
-                    Dig_3 = 0;                    
+                    Dig_3 = 0;
             }
-            break;    
+            break;
     }
 }
\ No newline at end of file