Dorian-Filip Pavetić / SigDisplay

Files at this revision

API Documentation at this revision

Comitter:
dpavetic
Date:
Sat Nov 05 07:38:21 2022 +0000
Parent:
0:b400107c7fc3
Commit message:
renaming of the lib

Changed in this revision

SegDisplay.cpp Show annotated file Show diff for this revision Revisions of this file
SegDisplay.h Show annotated file Show diff for this revision Revisions of this file
SigDisplay.cpp Show diff for this revision Revisions of this file
SigDisplay.h Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SegDisplay.cpp	Sat Nov 05 07:38:21 2022 +0000
@@ -0,0 +1,46 @@
+// SegDisplay.cpp file for Exercise 7-7
+#include "SegDisplay.h"
+BusOut Seg1(p5,p6,p7,p8,p9,p10,p11,p12); // A,B,C,D,E,F,G,DP
+BusOut Seg2(p13,p14,p15,p16,p17,p18,p19,p20); // A,B,C,D,E,F,G,DP
+void SegInit(void)
+{
+    Seg1=SegConvert(0); // initialise to zero
+    Seg2=SegConvert(0); // initialise to zero
+}
+char SegConvert(char SegValue)   // function 'SegConvert'
+{
+    char SegByte=0x00;
+    switch (SegValue) { //DP G F E D C B A
+        case 0 :
+            SegByte = 0x3F;
+            break; // 0 0 1 1 1 1 1 1 binary
+        case 1 :
+            SegByte = 0x06;
+            break; // 0 0 0 0 0 1 1 0 binary
+        case 2 :
+            SegByte = 0x5B;
+            break; // 0 1 0 1 1 0 1 1 binary
+        case 3 :
+            SegByte = 0x4F;
+            break; // 0 1 0 0 1 1 1 1 binary
+        case 4 :
+            SegByte = 0x66;
+            break; // 0 1 1 0 0 1 1 0 binary
+        case 5 :
+            SegByte = 0x6D;
+            break; // 0 1 1 0 1 1 0 1 binary
+        case 6 :
+            SegByte = 0x7D;
+            break; // 0 1 1 1 1 1 0 1 binary
+        case 7 :
+            SegByte = 0x07;
+            break; // 0 0 0 0 0 1 1 1 binary
+        case 8 :
+            SegByte = 0x7F;
+            break; // 0 1 1 1 1 1 1 1 binary
+        case 9 :
+            SegByte = 0x6F;
+            break; // 0 1 1 0 1 1 1 1 binary
+    }
+    return SegByte;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SegDisplay.h	Sat Nov 05 07:38:21 2022 +0000
@@ -0,0 +1,9 @@
+// SegDisplay.h file for Exercise 24
+#ifndef SEGDISPLAY_H
+#define SEGDISPLAY_H
+#include "mbed.h"
+extern BusOut Seg1; // allow Seg1 to be manipulated by other files
+extern BusOut Seg2; // allow Seg2 to be manipulated by other files
+void SegInit(void); // function prototype
+char SegConvert(char SegValue); // function prototype
+#endif
\ No newline at end of file
--- a/SigDisplay.cpp	Sat Nov 05 07:31:54 2022 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-// SegDisplay.cpp file for Exercise 7-7
-#include "SegDisplay.h"
-BusOut Seg1(p5,p6,p7,p8,p9,p10,p11,p12); // A,B,C,D,E,F,G,DP
-BusOut Seg2(p13,p14,p15,p16,p17,p18,p19,p20); // A,B,C,D,E,F,G,DP
-void SegInit(void)
-{
-    Seg1=SegConvert(0); // initialise to zero
-    Seg2=SegConvert(0); // initialise to zero
-}
-char SegConvert(char SegValue)   // function 'SegConvert'
-{
-    char SegByte=0x00;
-    switch (SegValue) { //DP G F E D C B A
-        case 0 :
-            SegByte = 0x3F;
-            break; // 0 0 1 1 1 1 1 1 binary
-        case 1 :
-            SegByte = 0x06;
-            break; // 0 0 0 0 0 1 1 0 binary
-        case 2 :
-            SegByte = 0x5B;
-            break; // 0 1 0 1 1 0 1 1 binary
-        case 3 :
-            SegByte = 0x4F;
-            break; // 0 1 0 0 1 1 1 1 binary
-        case 4 :
-            SegByte = 0x66;
-            break; // 0 1 1 0 0 1 1 0 binary
-        case 5 :
-            SegByte = 0x6D;
-            break; // 0 1 1 0 1 1 0 1 binary
-        case 6 :
-            SegByte = 0x7D;
-            break; // 0 1 1 1 1 1 0 1 binary
-        case 7 :
-            SegByte = 0x07;
-            break; // 0 0 0 0 0 1 1 1 binary
-        case 8 :
-            SegByte = 0x7F;
-            break; // 0 1 1 1 1 1 1 1 binary
-        case 9 :
-            SegByte = 0x6F;
-            break; // 0 1 1 0 1 1 1 1 binary
-    }
-    return SegByte;
-}
\ No newline at end of file
--- a/SigDisplay.h	Sat Nov 05 07:31:54 2022 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-// SegDisplay.h file for Exercise 24
-#ifndef SEGDISPLAY_H
-#define SEGDISPLAY_H
-#include "mbed.h"
-extern BusOut Seg1; // allow Seg1 to be manipulated by other files
-extern BusOut Seg2; // allow Seg2 to be manipulated by other files
-void SegInit(void); // function prototype
-char SegConvert(char SegValue); // function prototype
-#endif
\ No newline at end of file