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.
Diff: AlphaNumDisplay.cpp
- Revision:
- 0:410a1870af10
- Child:
- 1:d5692deaa688
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/AlphaNumDisplay.cpp Sat Dec 11 22:33:15 2010 +0000
@@ -0,0 +1,76 @@
+#include "mbed.h"
+#include "AlphaNumDisplay.hpp"
+
+unsigned char AlphaNumDisplay::m_alphadisplay[][11]= { // < Table of symbols
+ {0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0 }, // 0
+ {1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 }, // 1
+ {0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 }, // 2
+ {0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1 }, // 3
+ {1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1 }, // 4
+ {0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1 }, // 5
+ {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1 }, // 6
+ {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, // 7
+ {0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1 }, // 8
+ {0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1 }, // 9
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, // blank
+ {0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, // A
+ {1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1 }, // B
+ {0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 }, // C
+ {1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1 }, // D
+ {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }, // E
+ {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1 }, // F
+ {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1 }, // G
+ {1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, // H
+ {0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1 }, // I
+ {1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1 }, // J
+ {1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1 }, // K
+ {1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 }, // L
+ {0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1 }, // M
+ {1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1 }, // N
+ {0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1 }, // O
+ {0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1 }, // P
+ {0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1 }, // Q
+ {0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1 }, // R
+ {0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1 }, // S
+ {0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 }, // T
+ {1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1 }, // U
+ {1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1 }, // V
+ {1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1 }, // W
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, // X
+ {1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1 }, // Y
+ {0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 }, // Z
+ {1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0 }, // *
+ {1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0 } // check mark
+ };
+
+ AlphaNumDisplay::AlphaNumDisplay(PinName HT = p13, PinName HM = p10, PinName HB = p8,
+ PinName VTL = p11, PinName VBL = p9, PinName VTM = p15, PinName VBM = p6,
+ PinName VTR = p14, PinName VBR = p5, PinName DTL = p12, PinName DTR = p7)
+ : m_HTop(HT), m_HMiddle(HM), m_HBottom(HB), m_VTopLeft(VTL), m_VBottomLeft(VBL),
+ m_VTopMiddle(VTM), m_VBottomMiddle(VBM), m_VTopRight(VTR), m_VBottomRight(VBR),
+ m_DTopLeft(DTL), m_DTopRight(DTR)
+ {
+ }
+
+ void AlphaNumDisplay::DisplayChar(unsigned char c) {
+ unsigned char index = ALPHA_NUM_CLEAR_I;
+ if(c == ALPHA_NUM_CHECK) index = ALPHA_NUM_CHECK_I;
+ if(c == ALPHA_NUM_CLEAR) index = ALPHA_NUM_CLEAR_I;
+ if(c == ALPHA_NUM_STAR) index = ALPHA_NUM_STAR_I;
+ if(c < 10) index = c + ALPHA_NUM_ZERO_I;
+ if(c >= '0' && c <= '9') index = c - '0' + ALPHA_NUM_ZERO_I;
+ if(c >= 'a' && c <= 'z') index = c - 'a' + ALPHA_NUM_A_I;
+ if(c >= 'A' && c <= 'Z') index = c - 'A' + ALPHA_NUM_A_I;
+
+ m_HTop = AlphaNumDisplay::m_alphadisplay[index][0];
+ m_HMiddle = AlphaNumDisplay::m_alphadisplay[index][1];
+ m_HBottom = AlphaNumDisplay::m_alphadisplay[index][2];
+ m_VTopLeft = AlphaNumDisplay::m_alphadisplay[index][3];
+ m_VBottomLeft = AlphaNumDisplay::m_alphadisplay[index][4];
+ m_VTopMiddle = AlphaNumDisplay::m_alphadisplay[index][5];
+ m_VBottomMiddle = AlphaNumDisplay::m_alphadisplay[index][6];
+ m_VTopRight = AlphaNumDisplay::m_alphadisplay[index][7];
+ m_VBottomRight = AlphaNumDisplay::m_alphadisplay[index][8];
+ m_DTopLeft = AlphaNumDisplay::m_alphadisplay[index][9];
+ m_DTopRight = AlphaNumDisplay::m_alphadisplay[index][10];
+ }
\ No newline at end of file