![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Project to practice collaboration and header files
SegDisplay.cpp@1:1cfbe060cf10, 2016-01-11 (annotated)
- Committer:
- jonathanbarta
- Date:
- Mon Jan 11 18:49:13 2016 +0000
- Revision:
- 1:1cfbe060cf10
SegConvert function going from 0 up to F
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jonathanbarta | 1:1cfbe060cf10 | 1 | #include "mbed.h" |
jonathanbarta | 1:1cfbe060cf10 | 2 | #include "SegDisplay.h" |
jonathanbarta | 1:1cfbe060cf10 | 3 | |
jonathanbarta | 1:1cfbe060cf10 | 4 | BusOut Seg1(p5,p6,p7,p8,p9,p10,p11,p12); // A,B,C,D,E,F,G,DP |
jonathanbarta | 1:1cfbe060cf10 | 5 | BusOut Seg2(p13,p14,p15,p16,p17,p18,p19,p20); // A,B,C,D,E,F,G,DP |
jonathanbarta | 1:1cfbe060cf10 | 6 | |
jonathanbarta | 1:1cfbe060cf10 | 7 | void SegInit(void){ |
jonathanbarta | 1:1cfbe060cf10 | 8 | Seg1 = SegConvert(0); |
jonathanbarta | 1:1cfbe060cf10 | 9 | Seg2 = SegConvert(0); |
jonathanbarta | 1:1cfbe060cf10 | 10 | } |
jonathanbarta | 1:1cfbe060cf10 | 11 | char SegConvert(char SegValue){ |
jonathanbarta | 1:1cfbe060cf10 | 12 | char SegByte=0x00; |
jonathanbarta | 1:1cfbe060cf10 | 13 | switch (SegValue){ |
jonathanbarta | 1:1cfbe060cf10 | 14 | case 0 : SegByte = 0x3F;break; |
jonathanbarta | 1:1cfbe060cf10 | 15 | case 1 : SegByte = 0x06;break; |
jonathanbarta | 1:1cfbe060cf10 | 16 | case 2 : SegByte = 0x5B;break; |
jonathanbarta | 1:1cfbe060cf10 | 17 | case 3 : SegByte = 0x4F;break; |
jonathanbarta | 1:1cfbe060cf10 | 18 | case 4 : SegByte = 0x66;break; |
jonathanbarta | 1:1cfbe060cf10 | 19 | case 5 : SegByte = 0x6D;break; |
jonathanbarta | 1:1cfbe060cf10 | 20 | case 6 : SegByte = 0x7D;break; |
jonathanbarta | 1:1cfbe060cf10 | 21 | case 7 : SegByte = 0x07;break; |
jonathanbarta | 1:1cfbe060cf10 | 22 | case 8 : SegByte = 0x7F;break; |
jonathanbarta | 1:1cfbe060cf10 | 23 | case 9 : SegByte = 0x6F;break; |
jonathanbarta | 1:1cfbe060cf10 | 24 | case 10: SegByte = 0x77;break; |
jonathanbarta | 1:1cfbe060cf10 | 25 | case 11: SegByte = 0x7C;break; |
jonathanbarta | 1:1cfbe060cf10 | 26 | case 12: SegByte = 0x39;break; |
jonathanbarta | 1:1cfbe060cf10 | 27 | case 13: SegByte = 0x5E;break; |
jonathanbarta | 1:1cfbe060cf10 | 28 | case 14: SegByte = 0x79;break; |
jonathanbarta | 1:1cfbe060cf10 | 29 | case 15: SegByte = 0x71;break; |
jonathanbarta | 1:1cfbe060cf10 | 30 | } |
jonathanbarta | 1:1cfbe060cf10 | 31 | return SegByte; |
jonathanbarta | 1:1cfbe060cf10 | 32 | } |