Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
AlphaNumDisplay.cpp@0:410a1870af10, 2010-12-11 (annotated)
- Committer:
- etherealflaim
- Date:
- Sat Dec 11 22:33:15 2010 +0000
- Revision:
- 0:410a1870af10
- Child:
- 1:d5692deaa688
12/11/10 Joshua Durham
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| etherealflaim | 0:410a1870af10 | 1 | #include "mbed.h" |
| etherealflaim | 0:410a1870af10 | 2 | #include "AlphaNumDisplay.hpp" |
| etherealflaim | 0:410a1870af10 | 3 | |
| etherealflaim | 0:410a1870af10 | 4 | unsigned char AlphaNumDisplay::m_alphadisplay[][11]= { // < Table of symbols |
| etherealflaim | 0:410a1870af10 | 5 | {0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0 }, // 0 |
| etherealflaim | 0:410a1870af10 | 6 | {1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 }, // 1 |
| etherealflaim | 0:410a1870af10 | 7 | {0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 }, // 2 |
| etherealflaim | 0:410a1870af10 | 8 | {0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1 }, // 3 |
| etherealflaim | 0:410a1870af10 | 9 | {1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1 }, // 4 |
| etherealflaim | 0:410a1870af10 | 10 | {0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1 }, // 5 |
| etherealflaim | 0:410a1870af10 | 11 | {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1 }, // 6 |
| etherealflaim | 0:410a1870af10 | 12 | {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, // 7 |
| etherealflaim | 0:410a1870af10 | 13 | {0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1 }, // 8 |
| etherealflaim | 0:410a1870af10 | 14 | {0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1 }, // 9 |
| etherealflaim | 0:410a1870af10 | 15 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // blank |
| etherealflaim | 0:410a1870af10 | 16 | {0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, // A |
| etherealflaim | 0:410a1870af10 | 17 | {1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1 }, // B |
| etherealflaim | 0:410a1870af10 | 18 | {0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 }, // C |
| etherealflaim | 0:410a1870af10 | 19 | {1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1 }, // D |
| etherealflaim | 0:410a1870af10 | 20 | {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }, // E |
| etherealflaim | 0:410a1870af10 | 21 | {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1 }, // F |
| etherealflaim | 0:410a1870af10 | 22 | {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1 }, // G |
| etherealflaim | 0:410a1870af10 | 23 | {1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, // H |
| etherealflaim | 0:410a1870af10 | 24 | {0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1 }, // I |
| etherealflaim | 0:410a1870af10 | 25 | {1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1 }, // J |
| etherealflaim | 0:410a1870af10 | 26 | {1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1 }, // K |
| etherealflaim | 0:410a1870af10 | 27 | {1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 }, // L |
| etherealflaim | 0:410a1870af10 | 28 | {0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1 }, // M |
| etherealflaim | 0:410a1870af10 | 29 | {1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1 }, // N |
| etherealflaim | 0:410a1870af10 | 30 | {0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1 }, // O |
| etherealflaim | 0:410a1870af10 | 31 | {0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1 }, // P |
| etherealflaim | 0:410a1870af10 | 32 | {0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1 }, // Q |
| etherealflaim | 0:410a1870af10 | 33 | {0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1 }, // R |
| etherealflaim | 0:410a1870af10 | 34 | {0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1 }, // S |
| etherealflaim | 0:410a1870af10 | 35 | {0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 }, // T |
| etherealflaim | 0:410a1870af10 | 36 | {1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1 }, // U |
| etherealflaim | 0:410a1870af10 | 37 | {1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1 }, // V |
| etherealflaim | 0:410a1870af10 | 38 | {1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1 }, // W |
| etherealflaim | 0:410a1870af10 | 39 | {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, // X |
| etherealflaim | 0:410a1870af10 | 40 | {1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1 }, // Y |
| etherealflaim | 0:410a1870af10 | 41 | {0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 }, // Z |
| etherealflaim | 0:410a1870af10 | 42 | {1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0 }, // * |
| etherealflaim | 0:410a1870af10 | 43 | {1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0 } // check mark |
| etherealflaim | 0:410a1870af10 | 44 | }; |
| etherealflaim | 0:410a1870af10 | 45 | |
| etherealflaim | 0:410a1870af10 | 46 | AlphaNumDisplay::AlphaNumDisplay(PinName HT = p13, PinName HM = p10, PinName HB = p8, |
| etherealflaim | 0:410a1870af10 | 47 | PinName VTL = p11, PinName VBL = p9, PinName VTM = p15, PinName VBM = p6, |
| etherealflaim | 0:410a1870af10 | 48 | PinName VTR = p14, PinName VBR = p5, PinName DTL = p12, PinName DTR = p7) |
| etherealflaim | 0:410a1870af10 | 49 | : m_HTop(HT), m_HMiddle(HM), m_HBottom(HB), m_VTopLeft(VTL), m_VBottomLeft(VBL), |
| etherealflaim | 0:410a1870af10 | 50 | m_VTopMiddle(VTM), m_VBottomMiddle(VBM), m_VTopRight(VTR), m_VBottomRight(VBR), |
| etherealflaim | 0:410a1870af10 | 51 | m_DTopLeft(DTL), m_DTopRight(DTR) |
| etherealflaim | 0:410a1870af10 | 52 | { |
| etherealflaim | 0:410a1870af10 | 53 | } |
| etherealflaim | 0:410a1870af10 | 54 | |
| etherealflaim | 0:410a1870af10 | 55 | void AlphaNumDisplay::DisplayChar(unsigned char c) { |
| etherealflaim | 0:410a1870af10 | 56 | unsigned char index = ALPHA_NUM_CLEAR_I; |
| etherealflaim | 0:410a1870af10 | 57 | if(c == ALPHA_NUM_CHECK) index = ALPHA_NUM_CHECK_I; |
| etherealflaim | 0:410a1870af10 | 58 | if(c == ALPHA_NUM_CLEAR) index = ALPHA_NUM_CLEAR_I; |
| etherealflaim | 0:410a1870af10 | 59 | if(c == ALPHA_NUM_STAR) index = ALPHA_NUM_STAR_I; |
| etherealflaim | 0:410a1870af10 | 60 | if(c < 10) index = c + ALPHA_NUM_ZERO_I; |
| etherealflaim | 0:410a1870af10 | 61 | if(c >= '0' && c <= '9') index = c - '0' + ALPHA_NUM_ZERO_I; |
| etherealflaim | 0:410a1870af10 | 62 | if(c >= 'a' && c <= 'z') index = c - 'a' + ALPHA_NUM_A_I; |
| etherealflaim | 0:410a1870af10 | 63 | if(c >= 'A' && c <= 'Z') index = c - 'A' + ALPHA_NUM_A_I; |
| etherealflaim | 0:410a1870af10 | 64 | |
| etherealflaim | 0:410a1870af10 | 65 | m_HTop = AlphaNumDisplay::m_alphadisplay[index][0]; |
| etherealflaim | 0:410a1870af10 | 66 | m_HMiddle = AlphaNumDisplay::m_alphadisplay[index][1]; |
| etherealflaim | 0:410a1870af10 | 67 | m_HBottom = AlphaNumDisplay::m_alphadisplay[index][2]; |
| etherealflaim | 0:410a1870af10 | 68 | m_VTopLeft = AlphaNumDisplay::m_alphadisplay[index][3]; |
| etherealflaim | 0:410a1870af10 | 69 | m_VBottomLeft = AlphaNumDisplay::m_alphadisplay[index][4]; |
| etherealflaim | 0:410a1870af10 | 70 | m_VTopMiddle = AlphaNumDisplay::m_alphadisplay[index][5]; |
| etherealflaim | 0:410a1870af10 | 71 | m_VBottomMiddle = AlphaNumDisplay::m_alphadisplay[index][6]; |
| etherealflaim | 0:410a1870af10 | 72 | m_VTopRight = AlphaNumDisplay::m_alphadisplay[index][7]; |
| etherealflaim | 0:410a1870af10 | 73 | m_VBottomRight = AlphaNumDisplay::m_alphadisplay[index][8]; |
| etherealflaim | 0:410a1870af10 | 74 | m_DTopLeft = AlphaNumDisplay::m_alphadisplay[index][9]; |
| etherealflaim | 0:410a1870af10 | 75 | m_DTopRight = AlphaNumDisplay::m_alphadisplay[index][10]; |
| etherealflaim | 0:410a1870af10 | 76 | } |