![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Project to practice collaboration and header files
Diff: SegDisplay.cpp
- Revision:
- 1:1cfbe060cf10
diff -r 7854ff9b64bf -r 1cfbe060cf10 SegDisplay.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SegDisplay.cpp Mon Jan 11 18:49:13 2016 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#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); + Seg2 = SegConvert(0); +} +char SegConvert(char SegValue){ + char SegByte=0x00; + switch (SegValue){ + case 0 : SegByte = 0x3F;break; + case 1 : SegByte = 0x06;break; + case 2 : SegByte = 0x5B;break; + case 3 : SegByte = 0x4F;break; + case 4 : SegByte = 0x66;break; + case 5 : SegByte = 0x6D;break; + case 6 : SegByte = 0x7D;break; + case 7 : SegByte = 0x07;break; + case 8 : SegByte = 0x7F;break; + case 9 : SegByte = 0x6F;break; + case 10: SegByte = 0x77;break; + case 11: SegByte = 0x7C;break; + case 12: SegByte = 0x39;break; + case 13: SegByte = 0x5E;break; + case 14: SegByte = 0x79;break; + case 15: SegByte = 0x71;break; + } + return SegByte; +} \ No newline at end of file