Alphanumeric display for iHvZ
AlphaNumDisplay.cpp@2:48d04cc40e1c, 2010-12-12 (annotated)
- Committer:
- etherealflaim
- Date:
- Sun Dec 12 06:42:30 2010 +0000
- Revision:
- 2:48d04cc40e1c
- Parent:
- 1:d5692deaa688
Updated hpp comments
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 | 1:d5692deaa688 | 46 | AlphaNumDisplay::AlphaNumDisplay(PinName ht, PinName hm, PinName hb, |
etherealflaim | 1:d5692deaa688 | 47 | PinName vtl, PinName vbl, PinName vtm, PinName vbm, |
etherealflaim | 1:d5692deaa688 | 48 | PinName vtr, PinName vbr, PinName dtl, PinName dtr) |
etherealflaim | 1:d5692deaa688 | 49 | : m_htop(ht), m_hmiddle(hm), m_hbottom(hb), m_vtopleft(vtl), m_vbottomleft(vbl), |
etherealflaim | 1:d5692deaa688 | 50 | m_vtopmiddle(vtm), m_vbottommiddle(vbm), m_vtopright(vtr), m_vbottomright(vbr), |
etherealflaim | 1:d5692deaa688 | 51 | m_dtopleft(dtl), m_dtopright(dtr) |
etherealflaim | 0:410a1870af10 | 52 | { |
etherealflaim | 0:410a1870af10 | 53 | } |
etherealflaim | 0:410a1870af10 | 54 | |
etherealflaim | 1:d5692deaa688 | 55 | void AlphaNumDisplay::display(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 | 1:d5692deaa688 | 65 | m_htop = AlphaNumDisplay::m_alphadisplay[index][0]; |
etherealflaim | 1:d5692deaa688 | 66 | m_hmiddle = AlphaNumDisplay::m_alphadisplay[index][1]; |
etherealflaim | 1:d5692deaa688 | 67 | m_hbottom = AlphaNumDisplay::m_alphadisplay[index][2]; |
etherealflaim | 1:d5692deaa688 | 68 | m_vtopleft = AlphaNumDisplay::m_alphadisplay[index][3]; |
etherealflaim | 1:d5692deaa688 | 69 | m_vbottomleft = AlphaNumDisplay::m_alphadisplay[index][4]; |
etherealflaim | 1:d5692deaa688 | 70 | m_vtopmiddle = AlphaNumDisplay::m_alphadisplay[index][5]; |
etherealflaim | 1:d5692deaa688 | 71 | m_vbottommiddle = AlphaNumDisplay::m_alphadisplay[index][6]; |
etherealflaim | 1:d5692deaa688 | 72 | m_vtopright = AlphaNumDisplay::m_alphadisplay[index][7]; |
etherealflaim | 1:d5692deaa688 | 73 | m_vbottomright = AlphaNumDisplay::m_alphadisplay[index][8]; |
etherealflaim | 1:d5692deaa688 | 74 | m_dtopleft = AlphaNumDisplay::m_alphadisplay[index][9]; |
etherealflaim | 1:d5692deaa688 | 75 | m_dtopright = AlphaNumDisplay::m_alphadisplay[index][10]; |
etherealflaim | 0:410a1870af10 | 76 | } |