-
-
Save credomane/40721243deeafb6c2713ce3b65a01798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
This is a library for my work's Monochrome sign based on MBI5026GNS chips | |
(glorified shift registers) | |
My attempt at a legible font. | |
Written by Credomane for work | |
MIT license | |
******************************************************************************/ | |
//ASCII font. Wasting some space to pad the array so that "(int)'A'" gets the right index. | |
//Plus PROGMEM has plenty of space for it. | |
PROGMEM const byte font_characters[]= { | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0000 Control Char: NULL | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0001 Control Char: Start of Heading | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0002 Control Char: Start of Text | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0003 Control Char: End of Text | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0004 Control Char: End of Transmission | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0005 Control Char: Enquiry | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0006 Control Char: Acknowledge | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0007 Control Char: Bell | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0008 Control Char: Backspace | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0009 Control Char: Horizontal Tab | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0010 Control Char: Line Feed | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0011 Control Char: Vertical Tab | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0012 Control Char: Form Feed | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0013 Control Char: Carriage Return | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0014 Control Char: Shift Out | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0015 Control Char: Shift In | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0016 Control Char: Data Link Escape | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0017 Control Char: Device Control 1 (XON) | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0018 Control Char: Device Control 2 | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0019 Control Char: Device Control 3 (XOFF) | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0020 Control Char: Device Control 4 | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0021 Control Char: Negative Acknowledge | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0022 Control Char: Synchronous Idle | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0023 Control Char: End of Transmission Block | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0024 Control Char: Cancel | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0025 Control Char: End of Medium | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0026 Control Char: Substitude | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0027 Control Char: Escape | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0028 Control Char: File Separator | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0029 Control Char: Group Separator | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0030 Control Char: Record Separator | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0031 Control Char: Unit Separator | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0032 (space) | |
0x00, 0x00, 0x5F, 0x00, 0x00, // 0033 ! | |
0x00, 0x07, 0x00, 0x07, 0x00, // 0034 " | |
0x14, 0x7F, 0x14, 0x7F, 0x14, // 0035 # | |
0x24, 0x2A, 0x7F, 0x2A, 0x12, // 0036 $ | |
0x23, 0x13, 0x08, 0x64, 0x62, // 0037 % | |
0x36, 0x49, 0x55, 0x22, 0x50, // 0038 & | |
0x00, 0x05, 0x03, 0x00, 0x00, // 0039 ' | |
0x00, 0x1C, 0x22, 0x41, 0x00, // 0040 ( | |
0x00, 0x41, 0x22, 0x1C, 0x00, // 0041 ) | |
0x08, 0x2A, 0x1C, 0x2A, 0x08, // 0042 * | |
0x08, 0x08, 0x3E, 0x08, 0x08, // 0043 + | |
0x00, 0x50, 0x30, 0x00, 0x00, // 0044 , | |
0x08, 0x08, 0x08, 0x08, 0x08, // 0045 - | |
0x00, 0x60, 0x60, 0x00, 0x00, // 0046 . | |
0x20, 0x10, 0x08, 0x04, 0x02, // 0047 / | |
0x3E, 0x51, 0x49, 0x45, 0x3E, // 0048 0 | |
0x00, 0x42, 0x7F, 0x40, 0x00, // 0049 1 | |
0x42, 0x61, 0x51, 0x49, 0x46, // 0050 2 | |
0x21, 0x41, 0x45, 0x4B, 0x31, // 0051 3 | |
0x18, 0x14, 0x12, 0x7F, 0x10, // 0052 4 | |
0x27, 0x45, 0x45, 0x45, 0x39, // 0053 5 | |
0x3C, 0x4A, 0x49, 0x49, 0x30, // 0054 6 | |
0x01, 0x71, 0x09, 0x05, 0x03, // 0055 7 | |
0x36, 0x49, 0x49, 0x49, 0x36, // 0056 8 | |
0x06, 0x49, 0x49, 0x29, 0x1E, // 0057 9 | |
0x00, 0x36, 0x36, 0x00, 0x00, // 0058 : | |
0x00, 0x56, 0x36, 0x00, 0x00, // 0059 ; | |
0x00, 0x08, 0x14, 0x22, 0x41, // 0060 < | |
0x14, 0x14, 0x14, 0x14, 0x14, // 0061 = | |
0x41, 0x22, 0x14, 0x08, 0x00, // 0062 > | |
0x02, 0x01, 0x51, 0x09, 0x06, // 0063 ? | |
0x32, 0x49, 0x79, 0x41, 0x3E, // 0064 @ | |
0x7E, 0x11, 0x11, 0x11, 0x7E, // 0065 A | |
0x7F, 0x49, 0x49, 0x49, 0x36, // 0066 B | |
0x3E, 0x41, 0x41, 0x41, 0x22, // 0067 C | |
0x7F, 0x41, 0x41, 0x22, 0x1C, // 0068 D | |
0x7F, 0x49, 0x49, 0x49, 0x41, // 0069 E | |
0x7F, 0x09, 0x09, 0x01, 0x01, // 0070 F | |
0x3E, 0x41, 0x41, 0x51, 0x32, // 0071 G | |
0x7F, 0x08, 0x08, 0x08, 0x7F, // 0072 H | |
0x00, 0x41, 0x7F, 0x41, 0x00, // 0073 I | |
0x20, 0x40, 0x41, 0x3F, 0x01, // 0074 J | |
0x7F, 0x08, 0x14, 0x22, 0x41, // 0075 K | |
0x7F, 0x40, 0x40, 0x40, 0x40, // 0076 L | |
0x7F, 0x02, 0x04, 0x02, 0x7F, // 0077 M | |
0x7F, 0x04, 0x08, 0x10, 0x7F, // 0078 N | |
0x3E, 0x41, 0x41, 0x41, 0x3E, // 0079 O | |
0x7F, 0x09, 0x09, 0x09, 0x06, // 0080 P | |
0x3E, 0x41, 0x51, 0x21, 0x5E, // 0081 Q | |
0x7F, 0x09, 0x19, 0x29, 0x46, // 0082 R | |
0x46, 0x49, 0x49, 0x49, 0x31, // 0083 S | |
0x01, 0x01, 0x7F, 0x01, 0x01, // 0084 T | |
0x3F, 0x40, 0x40, 0x40, 0x3F, // 0085 U | |
0x1F, 0x20, 0x40, 0x20, 0x1F, // 0086 V | |
0x7F, 0x20, 0x18, 0x20, 0x7F, // 0087 W | |
0x63, 0x14, 0x08, 0x14, 0x63, // 0088 X | |
0x03, 0x04, 0x78, 0x04, 0x03, // 0089 Y | |
0x61, 0x51, 0x49, 0x45, 0x43, // 0090 Z | |
0x00, 0x00, 0x7F, 0x41, 0x41, // 0091 [ | |
0x02, 0x04, 0x08, 0x10, 0x20, // 0092 \ Backslash | |
0x41, 0x41, 0x7F, 0x00, 0x00, // 0093 ] | |
0x04, 0x02, 0x01, 0x02, 0x04, // 0094 ^ | |
0x40, 0x40, 0x40, 0x40, 0x40, // 0095 _ | |
0x00, 0x01, 0x02, 0x04, 0x00, // 0096 ` | |
0x20, 0x54, 0x54, 0x54, 0x78, // 0097 a | |
0x7F, 0x48, 0x44, 0x44, 0x38, // 0098 b | |
0x38, 0x44, 0x44, 0x44, 0x20, // 0099 c | |
0x38, 0x44, 0x44, 0x48, 0x7F, // 0100 d | |
0x38, 0x54, 0x54, 0x54, 0x18, // 0101 e | |
0x08, 0x7E, 0x09, 0x01, 0x02, // 0102 f | |
0x08, 0x14, 0x54, 0x54, 0x3C, // 0103 g | |
0x7F, 0x08, 0x04, 0x04, 0x78, // 0104 h | |
0x00, 0x44, 0x7D, 0x40, 0x00, // 0105 i | |
0x20, 0x40, 0x44, 0x3D, 0x00, // 0106 j | |
0x00, 0x7F, 0x10, 0x28, 0x44, // 0107 k | |
0x00, 0x41, 0x7F, 0x40, 0x00, // 0108 l | |
0x7C, 0x04, 0x18, 0x04, 0x78, // 0109 m | |
0x7C, 0x08, 0x04, 0x04, 0x78, // 0110 n | |
0x38, 0x44, 0x44, 0x44, 0x38, // 0111 o | |
0x7C, 0x14, 0x14, 0x14, 0x08, // 0112 p | |
0x08, 0x14, 0x14, 0x18, 0x7C, // 0113 q | |
0x7C, 0x08, 0x04, 0x04, 0x08, // 0114 r | |
0x48, 0x54, 0x54, 0x54, 0x20, // 0115 s | |
0x04, 0x3F, 0x44, 0x40, 0x20, // 0116 t | |
0x3C, 0x40, 0x40, 0x20, 0x7C, // 0117 u | |
0x1C, 0x20, 0x40, 0x20, 0x1C, // 0118 v | |
0x3C, 0x40, 0x30, 0x40, 0x3C, // 0119 w | |
0x44, 0x28, 0x10, 0x28, 0x44, // 0120 x | |
0x0C, 0x50, 0x50, 0x50, 0x3C, // 0121 y | |
0x44, 0x64, 0x54, 0x4C, 0x44, // 0122 z | |
0x00, 0x08, 0x36, 0x41, 0x00, // 0123 { | |
0x00, 0x00, 0x7F, 0x00, 0x00, // 0124 | | |
0x00, 0x41, 0x36, 0x08, 0x00, // 0125 } | |
0x06, 0x01, 0x02 ,0x04 ,0x03, // 0126 ~ | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0127 Control Char: Delete | |
0x14, 0x3E, 0x55, 0x41, 0x22, // 0128 € | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0129 Unused | |
0x00, 0x40, 0x38, 0x00, 0x00, // 0130 ‚ Single low-9 quotation mark | |
0x00, 0x48, 0x3E, 0x09, 0x09, // 0131 ƒ Latin small letter f with hook | |
0x00, 0x40, 0x38, 0x40, 0x38, // 0132 „ Double low-9 quotation mark | |
0x40, 0x00, 0x40, 0x00, 0x40, // 0133 … Horizontal Ellipsis | |
0x04, 0x04, 0x7F, 0x04, 0x04, // 0134 † (ALT + 0134) Dagger | |
0x24, 0x24, 0x7F, 0x24, 0x24, // 0135 ‡ (ALT + 0135) Double Dagger | |
0x04, 0x02, 0x01, 0x02, 0x04, // 0136 ˆ (ALT + 0136) | |
0xE5, 0xB5, 0xEF, 0xA4, 0xE2, // 0137 ‰ Per mille sign | |
0x00, 0x5D, 0x56, 0x75, 0x00, // 0138 Š Latin capital letter S with caron | |
0x08, 0x1C, 0x2A, 0x08, 0x08, // 0139 ‹ Single left-pointing angle quotation mark | |
0x3E, 0x41, 0x7F, 0x49, 0x49, // 0140 Œ Latin capital ligature OE | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0141 Unused | |
0x00, 0x65, 0x56, 0x4D, 0x00, // 0142 Ž Latin capital letter Z with caron | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0143 Unused | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0144 Unused | |
0x00, 0x07, 0x08, 0x00, 0x00, // 0145 ‘ Left single quotation mark | |
0x00, 0x00, 0x08, 0x07, 0x00, // 0146 ’ Right single quotation mark | |
0x00, 0x07, 0x08, 0x07, 0x08, // 0147 “ Left double quotation mark | |
0x08, 0x07, 0x08, 0x07, 0x00, // 0148 ” Right double quotation mark | |
0x00, 0x1C, 0x1C, 0x1C, 0x00, // 0149 • Bullet | |
0x00, 0x08, 0x08, 0x08, 0x00, // 0150 – En dash | |
0x08, 0x08, 0x08, 0x08, 0x08, // 0151 — Em dash | |
0x04, 0x02, 0x04, 0x08, 0x04, // 0152 ˜ Small tilde | |
0x01, 0x0F, 0x3D, 0x08, 0x3C, // 0153 ™ Trademark | |
0x00, 0x59, 0x56, 0x35, 0x00, // 0154 š Latin small letter s with caron | |
0x08, 0x08, 0x2A, 0x1C, 0x08, // 0155 › Single right-pointing angle quotation mark | |
0x38, 0x44, 0x7C, 0x54, 0x48, // 0156 œ Latin small ligature oe | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0157 Unused | |
0x00, 0x54, 0x78, 0x54, 0x00, // 0158 ž Latin small letter z with caron | |
0x06, 0x09, 0x70, 0x09, 0x06, // 0159 Ÿ Latin capital letter Y with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0160 No-break space | |
0x00, 0x00, 0x7D, 0x00, 0x00, // 0161 ¡ Inverted Exclamation mark | |
0x0C, 0x12, 0x3F, 0x12, 0x00, // 0162 ¢ Cent Sign | |
0x48, 0x6E, 0x59, 0x49, 0x4A, // 0163 £ Pount Sign | |
0x22, 0x1C, 0x14, 0x1C, 0x22, // 0164 ¤ Current Sign | |
0x00, 0x2B, 0x7C, 0x2B, 0x00, // 0165 ¥ Yen Sign | |
0x00, 0x00, 0x77, 0x00, 0x00, // 0166 ¦ Broken Bar | |
0x00, 0x5F, 0x55, 0x7D, 0x00, // 0167 § Section Sign | |
0x00, 0x01, 0x00, 0x01, 0x00, // 0168 ¨ Diaeresis | |
0x1E, 0x2D, 0x33, 0x33, 0x1E, // 0169 © Copyright Sign | |
0x00, 0x19, 0x15, 0x1F, 0x00, // 0170 ª Feminine Ordinal indicator | |
0x08, 0x14, 0x2A, 0x14, 0x22, // 0171 « Left-point double angle quotation | |
0x04, 0x04, 0x04, 0x04, 0x0C, // 0172 ¬ Not sign | |
0x00, 0x08, 0x08, 0x08, 0x00, // 0173 Soft hyphen | |
0x1E, 0x3F, 0x2B, 0x35, 0x1E, // 0174 ® Registered sign | |
0x00, 0x02, 0x02, 0x02, 0x00, // 0175 ¯ Macron | |
0x00, 0x07, 0x05, 0x07, 0x00, // 0176 ° Degree | |
0x24, 0x24, 0x3F, 0x24, 0x24, // 0177 ± PlusMinus sign | |
0x00, 0x0D, 0x0D, 0x0B, 0x00, // 0178 ² Superscript two | |
0x00, 0x11, 0x15, 0x0E, 0x00, // 0179 ³ Superscript three | |
0x00, 0x00, 0x02, 0x01, 0x01, // 0180 ´ Acute accent | |
0x7F, 0x20, 0x20, 0x10, 0x7F, // 0181 µ Micro sign | |
0x07, 0x09, 0x7F, 0x01, 0x7F, // 0182 ¶ Pilcrow sign | |
0x00, 0x00, 0x08, 0x00, 0x00, // 0183 · Middle dot | |
0x00, 0x20, 0x48, 0x34, 0x00, // 0184 ¸ Cedilla | |
0x00, 0x01, 0x07, 0x00, 0x00, // 0185 ¹ Superscript one | |
0x00, 0x02, 0x05, 0x02, 0x00, // 0186 º Masculine ordinal indicator | |
0x22, 0x55, 0x2A, 0x14, 0x08, // 0187 » Right-pointing double angle quotation mark | |
0x21, 0x17, 0x38, 0x24, 0x7A, // 0188 ¼ Vulgar fraction one quarter | |
0x21, 0x17, 0x58, 0x6C, 0x52, // 0189 ½ Vulgar fraction one half | |
0x2D, 0x1F, 0x38, 0x24, 0x72, // 0190 ¾ Vulgar fraction three quarters | |
0x00, 0x70, 0x4D, 0x60, 0x00, // 0191 ¿ Inverted question mark | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0192 À Latin capital letter A with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0193 Á Latin capital letter A with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0194 Â Latin capital letter A with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0195 Ã Latin capital letter A with tilde | |
0x7D, 0x12, 0x12, 0x7D, 0x00, // 0196 Ä Latin capital letter A with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0197 Å Latin capital letter A with ring above | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0198 Æ Latin capital letter AE | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0199 Ç Latin capital letter C with cedilla | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0200 È Latin capital letter E with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0201 É Latin capital letter E with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0202 Ê Latin capital letter E with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0203 Ë Latin capital letter E with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0204 Ì Latin capital letter I with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0205 Í Latin capital letter I with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0206 Î Latin capital letter I with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0207 Ï Latin capital letter I with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0208 Ð Latin capital letter Eth | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0209 Ñ Latin capital letter N with tilde | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0210 Ò Latin capital letter O with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0211 Ó Latin capital letter O with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0212 Ô Latin capital letter O with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0213 Õ Latin capital letter O with tilde | |
0x3D, 0x42, 0x42, 0x42, 0x3D, // 0214 Ö Latin capital letter O with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0215 × Multiplication sign | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0216 Ø Latin capital letter O with stroke | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0217 Ù Latin capital letter U with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0218 Ú Latin capital letter U with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0219 Û Latin capital letter U with circumflex | |
0x3D, 0x40, 0x40, 0x40, 0x3D, // 0220 Ü Latin capital letter U with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0221 Ý Latin capital letter Y with acute | |
0x00, 0x7F, 0x12, 0x12, 0x0C, // 0222 Þ Latin capital letter Thorn | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0223 ß Latin small letter sharp s | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0224 à Latin small letter a with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0225 á Latin small letter a with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0226 â Latin small letter a with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0227 ã Latin small letter a with tilde | |
0x20, 0x55, 0x54, 0x55, 0x78, // 0228 ä Latin small letter a with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0229 å Latin small letter a with ring above | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0230 æ Latin small letter ae | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0231 ç Latin small letter c with cedilla | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0232 è Latin small letter e with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0233 é Latin small letter e with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0234 ê Latin small letter e with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0235 ë Latin small letter e with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0236 ì Latin small letter i with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0237 í Latin small letter i with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0238 î Latin small letter i with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0239 ï Latin small letter i with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0240 ð Latin small letter eth | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0241 ñ Latin small letter n with tilde | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0242 ò Latin small letter o with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0243 ó Latin small letter o with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0244 ô Latin small letter o with circumflex | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0245 õ Latin small letter o with tilde | |
0x3A, 0x44, 0x44, 0x3A, 0x00, // 0246 ö Latin small letter o with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0247 ÷ Division sign | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0248 ø Latin small letter o with stroke | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0249 ù Latin small letter u with grave | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0250 ú Latin small letter u with acute | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0251 û Latin small letter u with circumflex | |
0x3A, 0x40, 0x40, 0x3A, 0x00, // 0252 ü Latin small letter u with diaeresis | |
0x00, 0x00, 0x00, 0x00, 0x00, // 0253 ý Latin small letter y with acute | |
0x00, 0x7C, 0x28, 0x28, 0x10, // 0254 þ Latin small letter thorn | |
0x00, 0x00, 0x00, 0x00, 0x00 // 0255 ÿ Latin small letter y with diaeresis | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
This is a library for my work's Monochrome sign based on MBI5026GNS chips | |
(glorified shift registers) | |
This display can use SPI to communicate you can use either hardware or software SPI | |
Hardware SPI: Needs MOSI, SCLK, 5 digital pins (Latches 1,2,3,4 and Output Enable) | |
Software SPI: Needs 7 digital pins (Data, Clock, Latches 1,2,3,4 and Output Enable) | |
Written by Credomane for work | |
MIT license | |
******************************************************************************/ | |
#include "font.h" | |
//Comment out to use software SPI. Well...shiftOut() | |
#define HARDWARE_SPI | |
// Only used for software SPI | |
#define LED_CLK 12 | |
#define LED_DATA 11 | |
// These are needed for both hardware & softare SPI | |
#define LED_OE 10 | |
#define LED_LATCH1 9 | |
#define LED_LATCH2 8 | |
#define LED_LATCH3 7 | |
#define LED_LATCH4 6 | |
#ifdef HARDWARE_SPI | |
#include <SPI.h> | |
SPISettings led_spisettings = SPISettings(4000000, MSBFIRST, SPI_MODE0); | |
#endif | |
void setup() { | |
//set all needed pins to output. | |
pinMode(LED_CLK, OUTPUT); | |
pinMode(LED_DATA, OUTPUT); | |
pinMode(LED_OE, OUTPUT); | |
pinMode(LED_LATCH1, OUTPUT); | |
pinMode(LED_LATCH2, OUTPUT); | |
pinMode(LED_LATCH3, OUTPUT); | |
pinMode(LED_LATCH4, OUTPUT); | |
digitalWrite(LED_CLK, LOW); | |
digitalWrite(LED_DATA, LOW); | |
digitalWrite(LED_OE, HIGH); | |
digitalWrite(LED_LATCH1, LOW); | |
digitalWrite(LED_LATCH2, LOW); | |
digitalWrite(LED_LATCH3, LOW); | |
digitalWrite(LED_LATCH4, LOW); | |
Serial.begin(115200); | |
#ifdef HARDWARE_SPI | |
SPI.begin(); | |
clearBuffer(); | |
writeCharString("Using SPI. "); | |
#else | |
clearBuffer(); | |
writeCharString("Using shiftOut."); | |
#endif | |
updateDisplay(LED_LATCH2); | |
clearBuffer(); | |
writeCharString("Firmware: 0.70 BETA"); | |
updateDisplay(LED_LATCH1); | |
for (int i = 10; i > 0; i--) { | |
clearBuffer(); | |
writeCharString("Ready in "); | |
writeCharString((i + 48)); | |
writeCharString(" "); | |
updateDisplay(LED_LATCH3); | |
clearBuffer(); | |
writeCharString(i * 19 + 33); | |
writeCharString(i * 19 + 34); | |
writeCharString(i * 19 + 35); | |
writeCharString(i * 19 + 36); | |
writeCharString(i * 19 + 37); | |
writeCharString(i * 19 + 38); | |
writeCharString(i * 19 + 39); | |
writeCharString(i * 19 + 40); | |
writeCharString(i * 19 + 41); | |
writeCharString(i * 19 + 42); | |
writeCharString(i * 19 + 43); | |
writeCharString(i * 19 + 44); | |
writeCharString(i * 19 + 45); | |
writeCharString(i * 19 + 46); | |
writeCharString(i * 19 + 47); | |
writeCharString(i * 19 + 48); | |
writeCharString(i * 19 + 49); | |
writeCharString(i * 19 + 50); | |
writeCharString(i * 19 + 51); | |
updateDisplay(LED_LATCH4); | |
delay(500); | |
} | |
clearBuffer(); | |
updateDisplays(); | |
} | |
byte sData[100]; | |
size_t dataLen = 0; | |
void loop() { | |
if (Serial.available() > 0) { | |
// read the incoming line: | |
dataLen = Serial.readBytesUntil("\n", sData, 100); | |
//Ignore the \r character at the very end. | |
if (sData[dataLen] = 10) { | |
dataLen -= 1; | |
} | |
// say what you got: | |
int latch = 0; | |
//All commands are at least 2 characters long. | |
//First character is the command type: L = Letters ; B = Raw Bytes ; C = Clear ; | |
//Second character is the line/latch to manipulate: 1, 2, 3, 4 | |
if (dataLen >= 2) { | |
if (sData[0] == 76) { | |
/* Check for "L" */ | |
if (sData[1] == 49) { | |
latch = LED_LATCH1; | |
} | |
if (sData[1] == 50) { | |
latch = LED_LATCH2; | |
} | |
if (sData[1] == 51) { | |
latch = LED_LATCH3; | |
} | |
if (sData[1] == 52) { | |
latch = LED_LATCH4; | |
} | |
clearBuffer(); | |
Serial.print("I received: "); | |
for (int i = 2; i < dataLen; i++) { | |
Serial.print((char)sData[i]); | |
writeCharString((char)sData[i]); | |
} | |
Serial.print("\n"); | |
updateDisplay(latch); | |
} else if (sData[0] == 66) { | |
/* Check for "B" */ | |
if (sData[1] == 49) { | |
latch = LED_LATCH1; | |
} | |
if (sData[1] == 50) { | |
latch = LED_LATCH2; | |
} | |
if (sData[1] == 51) { | |
latch = LED_LATCH3; | |
} | |
if (sData[1] == 52) { | |
latch = LED_LATCH4; | |
} | |
clearBuffer(); | |
Serial.print("I received: "); | |
for (int i = 2; i < dataLen; i++) { | |
Serial.print(sData[i]); | |
writeByte(sData[i]); | |
} | |
Serial.print("\n"); | |
updateDisplay(latch); | |
} else if (sData[0] == 67) { | |
/* Check for "C" */ | |
if (sData[1] == 49) { | |
latch = LED_LATCH1; | |
} | |
if (sData[1] == 50) { | |
latch = LED_LATCH2; | |
} | |
if (sData[1] == 51) { | |
latch = LED_LATCH3; | |
} | |
if (sData[1] == 52) { | |
latch = LED_LATCH4; | |
} | |
clearBuffer(); | |
updateDisplay(latch); | |
} | |
} | |
} | |
} | |
void writeCharString(char chars[]) { | |
int len = strlen(chars); | |
byte d[5] = {0, 0, 0, 0, 0}; | |
for (int i = 0; i < len; i++) { | |
d[0] = pgm_read_byte_near(font_characters + (byte)chars[i] * 5 + 0); | |
d[1] = pgm_read_byte_near(font_characters + (byte)chars[i] * 5 + 1); | |
d[2] = pgm_read_byte_near(font_characters + (byte)chars[i] * 5 + 2); | |
d[3] = pgm_read_byte_near(font_characters + (byte)chars[i] * 5 + 3); | |
d[4] = pgm_read_byte_near(font_characters + (byte)chars[i] * 5 + 4); | |
writeData(d); | |
}; | |
} | |
void writeCharString(char chars) { | |
byte d[5] = {0, 0, 0, 0, 0}; | |
d[0] = pgm_read_byte_near(font_characters + (byte)chars * 5 + 0); | |
d[1] = pgm_read_byte_near(font_characters + (byte)chars * 5 + 1); | |
d[2] = pgm_read_byte_near(font_characters + (byte)chars * 5 + 2); | |
d[3] = pgm_read_byte_near(font_characters + (byte)chars * 5 + 3); | |
d[4] = pgm_read_byte_near(font_characters + (byte)chars * 5 + 4); | |
writeData(d); | |
} | |
void clearBuffer() { | |
#ifdef HARDWARE_SPI | |
SPI.beginTransaction(led_spisettings); | |
#endif | |
int i; | |
for (i = 0; i < 128; i++) { | |
#ifdef HARDWARE_SPI | |
SPI.transfer(0); | |
#else | |
shiftOut(LED_DATA, LED_CLK, MSBFIRST, 0); | |
#endif | |
} | |
#ifdef HARDWARE_SPI | |
SPI.endTransaction(); | |
#endif | |
} | |
void writeByte(byte data) { | |
//Write out the data | |
#ifdef HARDWARE_SPI | |
SPI.beginTransaction(led_spisettings); | |
SPI.transfer(data); | |
SPI.endTransaction(); | |
#else | |
shiftOut(LED_DATA, LED_CLK, MSBFIRST, data); | |
#endif | |
} | |
void writeData(byte data[]) { | |
//Write out the data | |
#ifdef HARDWARE_SPI | |
SPI.beginTransaction(led_spisettings); | |
SPI.transfer(data[0]); | |
SPI.transfer(data[1]); | |
SPI.transfer(data[2]); | |
SPI.transfer(data[3]); | |
SPI.transfer(data[4]); | |
SPI.endTransaction(); | |
#else | |
shiftOut(LED_DATA, LED_CLK, MSBFIRST, data[0]); | |
shiftOut(LED_DATA, LED_CLK, MSBFIRST, data[1]); | |
shiftOut(LED_DATA, LED_CLK, MSBFIRST, data[2]); | |
shiftOut(LED_DATA, LED_CLK, MSBFIRST, data[3]); | |
shiftOut(LED_DATA, LED_CLK, MSBFIRST, data[4]); | |
#endif | |
} | |
void updateDisplays() { | |
//I know. Strange to send the data then do this stuff. | |
//but this is just how this shift register docs says to do it. | |
digitalWrite(LED_OE, HIGH);//Turn off the display | |
delay(0.005);//Delay ~50 nanoseconds | |
digitalWrite(LED_LATCH1, HIGH);//Bring the latch HIGH to copy data | |
digitalWrite(LED_LATCH2, HIGH);//Bring the latch HIGH to copy data | |
digitalWrite(LED_LATCH3, HIGH);//Bring the latch HIGH to copy data | |
digitalWrite(LED_LATCH4, HIGH);//Bring the latch HIGH to copy data | |
delay(0.005);//Delay ~50 nanoseconds | |
digitalWrite(LED_LATCH1, LOW);//Drop the latch LOW to wait for more data | |
digitalWrite(LED_LATCH2, LOW);//Drop the latch LOW to wait for more data | |
digitalWrite(LED_LATCH3, LOW);//Drop the latch LOW to wait for more data | |
digitalWrite(LED_LATCH4, LOW);//Drop the latch LOW to wait for more data | |
delay(0.005);//Delay ~50 nanoseconds | |
digitalWrite(LED_OE, LOW);//Turn on the display | |
} | |
void updateDisplay(int latch) { | |
//I know. Strange to send the data then do this stuff. | |
//but this is just how this shift register docs says to do it. | |
digitalWrite(LED_OE, HIGH);//Turn off the display | |
delay(0.005);//Delay ~50 nanoseconds | |
digitalWrite(latch, HIGH);//Bring the latch HIGH to copy data | |
delay(0.005);//Delay ~50 nanoseconds | |
digitalWrite(latch, LOW);//Drop the latch LOW to wait for more data | |
delay(0.005);//Delay ~50 nanoseconds | |
digitalWrite(LED_OE, LOW);//Turn on the display | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment