File indexing completed on 2024-05-05 05:46:07
0001 /*************************************************************************** 0002 * Copyright (C) 2005 by David Saxton * 0003 * david@bluehaze.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #include "matrixdisplaydriver.h" 0012 #include "libraryitem.h" 0013 #include "logic.h" 0014 0015 #include <KLocalizedString> 0016 #include <QPainter> 0017 #include <QString> 0018 0019 #include <cassert> 0020 0021 // Thank you Scott Dattalo! 0022 // http://www.dattalo.com/gnupic/lcdfont.inc 0023 0024 static char characterMap[256][5] = { 0025 {0x00, 0x00, 0x00, 0x00, 0x00}, // 0 0026 {0x00, 0x00, 0x00, 0x00, 0x00}, // 1 0027 {0x00, 0x00, 0x00, 0x00, 0x00}, // 2 0028 {0x00, 0x00, 0x00, 0x00, 0x00}, // 3 0029 {0x00, 0x00, 0x00, 0x00, 0x00}, // 4 0030 {0x00, 0x00, 0x00, 0x00, 0x00}, // 5 0031 {0x00, 0x00, 0x00, 0x00, 0x00}, // 6 0032 {0x00, 0x00, 0x00, 0x00, 0x00}, // 7 0033 {0x00, 0x00, 0x00, 0x00, 0x00}, // 8 0034 {0x00, 0x00, 0x00, 0x00, 0x00}, // 9 0035 {0x00, 0x00, 0x00, 0x00, 0x00}, // 10 0036 {0x00, 0x00, 0x00, 0x00, 0x00}, // 11 0037 {0x00, 0x00, 0x00, 0x00, 0x00}, // 12 0038 {0x00, 0x00, 0x00, 0x00, 0x00}, // 13 0039 {0x00, 0x00, 0x00, 0x00, 0x00}, // 14 0040 {0x00, 0x00, 0x00, 0x00, 0x00}, // 15 0041 {0x00, 0x00, 0x00, 0x00, 0x00}, // 16 0042 {0x00, 0x00, 0x00, 0x00, 0x00}, // 17 0043 {0x00, 0x00, 0x00, 0x00, 0x00}, // 18 0044 {0x00, 0x00, 0x00, 0x00, 0x00}, // 19 0045 {0x00, 0x00, 0x00, 0x00, 0x00}, // 20 0046 {0x00, 0x00, 0x00, 0x00, 0x00}, // 21 0047 {0x00, 0x00, 0x00, 0x00, 0x00}, // 22 0048 {0x00, 0x00, 0x00, 0x00, 0x00}, // 23 0049 {0x00, 0x00, 0x00, 0x00, 0x00}, // 24 0050 {0x00, 0x00, 0x00, 0x00, 0x00}, // 25 0051 {0x00, 0x00, 0x00, 0x00, 0x00}, // 26 0052 {0x00, 0x00, 0x00, 0x00, 0x00}, // 27 0053 {0x00, 0x00, 0x00, 0x00, 0x00}, // 28 0054 {0x00, 0x00, 0x00, 0x00, 0x00}, // 29 0055 {0x00, 0x00, 0x00, 0x00, 0x00}, // 30 0056 {0x00, 0x00, 0x00, 0x00, 0x00}, // 31 0057 {0x00, 0x00, 0x00, 0x00, 0x00}, // 32 0058 {0x00, 0x00, 0x7d, 0x00, 0x00}, // 33 0059 {0x00, 0x70, 0x00, 0x70, 0x00}, // 34 0060 {0x14, 0x7f, 0x14, 0x7f, 0x14}, // 35 0061 {0x12, 0x2a, 0x7f, 0x2a, 0x24}, // 36 0062 {0x62, 0x64, 0x08, 0x13, 0x23}, // 37 0063 {0x36, 0x49, 0x55, 0x22, 0x05}, // 38 0064 {0x00, 0x50, 0x60, 0x00, 0x00}, // 39 0065 {0x00, 0x1c, 0x22, 0x41, 0x00}, // 40 0066 {0x00, 0x41, 0x22, 0x1c, 0x00}, // 41 0067 {0x14, 0x08, 0x3e, 0x08, 0x14}, // 42 0068 {0x08, 0x08, 0x3e, 0x08, 0x08}, // 43 0069 {0x00, 0x05, 0x06, 0x00, 0x00}, // 44 0070 {0x08, 0x08, 0x08, 0x08, 0x08}, // 45 0071 {0x00, 0x03, 0x03, 0x00, 0x00}, // 46 0072 {0x02, 0x04, 0x08, 0x10, 0x20}, // 47 0073 {0x3e, 0x45, 0x49, 0x51, 0x3e}, // 48 0074 {0x00, 0x21, 0x7f, 0x01, 0x00}, // 49 0075 {0x21, 0x43, 0x45, 0x49, 0x31}, // 50 0076 {0x42, 0x41, 0x51, 0x69, 0x46}, // 51 0077 {0x0c, 0x14, 0x24, 0x7f, 0x04}, // 52 0078 {0x72, 0x51, 0x51, 0x51, 0x4e}, // 53 0079 {0x1e, 0x29, 0x49, 0x49, 0x06}, // 54 0080 {0x40, 0x47, 0x48, 0x50, 0x60}, // 55 0081 {0x36, 0x49, 0x49, 0x49, 0x36}, // 56 0082 {0x30, 0x49, 0x49, 0x4a, 0x3c}, // 57 0083 {0x00, 0x36, 0x36, 0x00, 0x00}, // 58 0084 {0x00, 0x35, 0x36, 0x00, 0x00}, // 59 0085 {0x08, 0x14, 0x22, 0x41, 0x00}, // 60 0086 {0x14, 0x14, 0x14, 0x14, 0x14}, // 61 0087 {0x41, 0x22, 0x14, 0x08, 0x00}, // 62 0088 {0x20, 0x40, 0x45, 0x48, 0x30}, // 63 0089 {0x26, 0x49, 0x4f, 0x41, 0x3e}, // 64 0090 {0x3f, 0x44, 0x44, 0x44, 0x3f}, // 65 0091 {0x7f, 0x49, 0x49, 0x49, 0x36}, // 66 0092 {0x3e, 0x41, 0x41, 0x41, 0x22}, // 67 0093 {0x7f, 0x41, 0x41, 0x41, 0x3e}, // 68 0094 {0x7f, 0x49, 0x49, 0x49, 0x41}, // 69 0095 {0x7f, 0x48, 0x48, 0x48, 0x40}, // 70 0096 {0x3e, 0x41, 0x49, 0x49, 0x2f}, // 71 0097 {0x7f, 0x08, 0x08, 0x08, 0x7f}, // 72 0098 {0x00, 0x41, 0x7f, 0x41, 0x00}, // 73 0099 {0x02, 0x01, 0x41, 0x7e, 0x40}, // 74 0100 {0x7f, 0x08, 0x14, 0x22, 0x41}, // 75 0101 {0x7f, 0x01, 0x01, 0x01, 0x01}, // 76 0102 {0x7f, 0x40, 0x20, 0x40, 0x7f}, // 77 0103 {0x7f, 0x10, 0x08, 0x04, 0x7f}, // 78 0104 {0x3e, 0x41, 0x41, 0x41, 0x3e}, // 79 0105 {0x7f, 0x48, 0x48, 0x48, 0x30}, // 80 0106 {0x3e, 0x41, 0x45, 0x42, 0x3d}, // 81 0107 {0x7f, 0x48, 0x4c, 0x4a, 0x31}, // 82 0108 {0x31, 0x49, 0x49, 0x49, 0x46}, // 83 0109 {0x40, 0x40, 0x7f, 0x40, 0x40}, // 84 0110 {0x7e, 0x01, 0x01, 0x01, 0x7e}, // 85 0111 {0x7c, 0x02, 0x01, 0x02, 0x7c}, // 86 0112 {0x7e, 0x01, 0x0e, 0x01, 0x7e}, // 87 0113 {0x63, 0x14, 0x08, 0x14, 0x63}, // 88 0114 {0x70, 0x08, 0x07, 0x08, 0x70}, // 89 0115 {0x43, 0x45, 0x49, 0x51, 0x61}, // 90 0116 {0x00, 0x7f, 0x41, 0x41, 0x00}, // 91 0117 {0x54, 0x34, 0x1f, 0x34, 0x54}, // 92 0118 {0x00, 0x41, 0x41, 0x7f, 0x00}, // 93 0119 {0x10, 0x20, 0x40, 0x20, 0x10}, // 94 0120 {0x01, 0x01, 0x01, 0x01, 0x01}, // 95 0121 {0x00, 0x40, 0x20, 0x10, 0x00}, // 96 0122 {0x02, 0x15, 0x15, 0x15, 0x0f}, // 97 0123 {0x7f, 0x09, 0x11, 0x11, 0x0e}, // 98 0124 {0x0e, 0x11, 0x11, 0x11, 0x02}, // 99 0125 {0x0e, 0x11, 0x11, 0x09, 0x7f}, // 100 0126 {0x0e, 0x15, 0x15, 0x15, 0x0c}, // 101 0127 {0x08, 0x3f, 0x48, 0x40, 0x20}, // 102 0128 {0x30, 0x49, 0x49, 0x49, 0x7e}, // 103 0129 {0x7f, 0x08, 0x10, 0x10, 0x0f}, // 104 0130 {0x00, 0x11, 0x5f, 0x01, 0x00}, // 105 0131 {0x02, 0x01, 0x21, 0x7e, 0x00}, // 106 0132 {0x7f, 0x04, 0x0a, 0x11, 0x00}, // 107 0133 {0x00, 0x41, 0x7f, 0x01, 0x00}, // 108 0134 {0x1f, 0x10, 0x0c, 0x10, 0x0f}, // 109 0135 {0x1f, 0x08, 0x10, 0x10, 0x0f}, // 110 0136 {0x0e, 0x11, 0x11, 0x11, 0x0e}, // 111 0137 {0x1f, 0x14, 0x14, 0x14, 0x08}, // 112 0138 {0x08, 0x14, 0x14, 0x0c, 0x1f}, // 113 0139 {0x1f, 0x08, 0x10, 0x10, 0x08}, // 114 0140 {0x09, 0x15, 0x15, 0x15, 0x12}, // 115 0141 {0x20, 0x7e, 0x21, 0x01, 0x02}, // 116 0142 {0x1e, 0x01, 0x01, 0x02, 0x1f}, // 117 0143 {0x1c, 0x02, 0x01, 0x02, 0x1c}, // 118 0144 {0x1e, 0x01, 0x06, 0x01, 0x1e}, // 119 0145 {0x11, 0x0a, 0x04, 0x0a, 0x11}, // 120 0146 {0x18, 0x05, 0x05, 0x05, 0x1e}, // 121 0147 {0x11, 0x13, 0x15, 0x19, 0x11}, // 122 0148 {0x00, 0x08, 0x36, 0x41, 0x00}, // 123 0149 {0x00, 0x00, 0x7f, 0x00, 0x00}, // 124 0150 {0x00, 0x41, 0x36, 0x08, 0x00}, // 125 0151 {0x08, 0x08, 0x2a, 0x1c, 0x08}, // 126 0152 {0x08, 0x1c, 0x2a, 0x08, 0x08}, // 127 0153 {0x00, 0x00, 0x00, 0x00, 0x00}, // 128 0154 {0x00, 0x00, 0x00, 0x00, 0x00}, // 129 0155 {0x00, 0x00, 0x00, 0x00, 0x00}, // 130 0156 {0x00, 0x00, 0x00, 0x00, 0x00}, // 131 0157 {0x00, 0x00, 0x00, 0x00, 0x00}, // 132 0158 {0x00, 0x00, 0x00, 0x00, 0x00}, // 133 0159 {0x00, 0x00, 0x00, 0x00, 0x00}, // 134 0160 {0x00, 0x00, 0x00, 0x00, 0x00}, // 135 0161 {0x00, 0x00, 0x00, 0x00, 0x00}, // 136 0162 {0x00, 0x00, 0x00, 0x00, 0x00}, // 137 0163 {0x00, 0x00, 0x00, 0x00, 0x00}, // 138 0164 {0x00, 0x00, 0x00, 0x00, 0x00}, // 139 0165 {0x00, 0x00, 0x00, 0x00, 0x00}, // 140 0166 {0x00, 0x00, 0x00, 0x00, 0x00}, // 141 0167 {0x00, 0x00, 0x00, 0x00, 0x00}, // 142 0168 {0x00, 0x00, 0x00, 0x00, 0x00}, // 143 0169 {0x00, 0x00, 0x00, 0x00, 0x00}, // 144 0170 {0x07, 0x05, 0x07, 0x00, 0x00}, // 145 0171 {0x00, 0x00, 0x78, 0x40, 0x40}, // 146 0172 {0x01, 0x01, 0x0f, 0x00, 0x00}, // 147 0173 {0x04, 0x02, 0x01, 0x00, 0x00}, // 148 0174 {0x00, 0x0c, 0x0c, 0x00, 0x00}, // 149 0175 {0x28, 0x28, 0x29, 0x2a, 0x3c}, // 150 0176 {0x10, 0x11, 0x16, 0x14, 0x18}, // 151 0177 {0x02, 0x04, 0x0f, 0x10, 0x00}, // 152 0178 {0x0c, 0x08, 0x19, 0x09, 0x0e}, // 153 0179 {0x09, 0x09, 0x0f, 0x09, 0x09}, // 154 0180 {0x09, 0x0a, 0x0c, 0x1f, 0x08}, // 155 0181 {0x08, 0x1f, 0x08, 0x0a, 0x0c}, // 156 0182 {0x01, 0x09, 0x09, 0x0f, 0x01}, // 157 0183 {0x15, 0x15, 0x15, 0x1f, 0x00}, // 158 0184 {0x0c, 0x00, 0x0d, 0x01, 0x0e}, // 159 0185 {0x04, 0x04, 0x04, 0x04, 0x04}, // 160 0186 {0x40, 0x41, 0x5e, 0x48, 0x70}, // 161 0187 {0x04, 0x08, 0x1f, 0x20, 0x40}, // 162 0188 {0x38, 0x20, 0x61, 0x22, 0x3c}, // 163 0189 {0x11, 0x11, 0x1f, 0x11, 0x11}, // 164 0190 {0x22, 0x24, 0x28, 0x7f, 0x20}, // 165 0191 {0x21, 0x7e, 0x20, 0x21, 0x3e}, // 166 0192 {0x28, 0x28, 0x7f, 0x28, 0x28}, // 167 0193 {0x08, 0x31, 0x21, 0x22, 0x3c}, // 168 0194 {0x10, 0x60, 0x21, 0x3e, 0x20}, // 169 0195 {0x21, 0x21, 0x21, 0x21, 0x3f}, // 170 0196 {0x20, 0x79, 0x22, 0x7c, 0x20}, // 171 0197 {0x29, 0x29, 0x01, 0x02, 0x1c}, // 172 0198 {0x21, 0x22, 0x24, 0x2a, 0x31}, // 173 0199 {0x20, 0x7e, 0x21, 0x29, 0x31}, // 174 0200 {0x30, 0x09, 0x01, 0x02, 0x3c}, // 175 0201 {0x08, 0x31, 0x29, 0x26, 0x3c}, // 176 0202 {0x28, 0x29, 0x3e, 0x48, 0x08}, // 177 0203 {0x30, 0x00, 0x31, 0x02, 0x3c}, // 178 0204 {0x10, 0x51, 0x5e, 0x50, 0x10}, // 179 0205 {0x00, 0x7f, 0x08, 0x04, 0x00}, // 180 0206 {0x11, 0x12, 0x7c, 0x10, 0x10}, // 181 0207 {0x01, 0x21, 0x21, 0x21, 0x01}, // 182 0208 {0x21, 0x2a, 0x24, 0x2a, 0x30}, // 183 0209 {0x22, 0x24, 0x6f, 0x34, 0x22}, // 184 0210 {0x00, 0x01, 0x02, 0x7c, 0x00}, // 185 0211 {0x0f, 0x00, 0x20, 0x10, 0x0f}, // 186 0212 {0x7e, 0x11, 0x11, 0x11, 0x11}, // 187 0213 {0x20, 0x21, 0x21, 0x22, 0x3c}, // 188 0214 {0x10, 0x20, 0x10, 0x08, 0x06}, // 189 0215 {0x26, 0x20, 0x7f, 0x20, 0x26}, // 190 0216 {0x20, 0x24, 0x22, 0x25, 0x38}, // 191 0217 {0x00, 0x2a, 0x2a, 0x2a, 0x01}, // 192 0218 {0x0e, 0x12, 0x22, 0x02, 0x07}, // 193 0219 {0x01, 0x0a, 0x04, 0x0a, 0x30}, // 194 0220 {0x28, 0x3e, 0x29, 0x29, 0x29}, // 195 0221 {0x10, 0x7f, 0x10, 0x14, 0x18}, // 196 0222 {0x01, 0x21, 0x21, 0x3f, 0x01}, // 197 0223 {0x29, 0x29, 0x29, 0x29, 0x3f}, // 198 0224 {0x10, 0x50, 0x51, 0x52, 0x1c}, // 199 0225 {0x78, 0x01, 0x02, 0x7c, 0x00}, // 200 0226 {0x1f, 0x00, 0x3f, 0x01, 0x06}, // 201 0227 {0x3f, 0x01, 0x02, 0x04, 0x08}, // 202 0228 {0x3f, 0x21, 0x21, 0x21, 0x3f}, // 203 0229 {0x38, 0x20, 0x21, 0x22, 0x3c}, // 204 0230 {0x21, 0x21, 0x01, 0x02, 0x0c}, // 205 0231 {0x20, 0x10, 0x40, 0x20, 0x00}, // 206 0232 {0x70, 0x50, 0x70, 0x00, 0x00}, // 207 0233 {0x0e, 0x11, 0x09, 0x06, 0x19}, // 208 0234 {0x02, 0x55, 0x15, 0x55, 0x0f}, // 209 0235 {0x1f, 0x2a, 0x2a, 0x2a, 0x14}, // 210 0236 {0x0a, 0x15, 0x15, 0x11, 0x02}, // 211 0237 {0x3f, 0x02, 0x02, 0x04, 0x3e}, // 212 0238 {0x0e, 0x11, 0x19, 0x15, 0x12}, // 213 0239 {0x0f, 0x12, 0x22, 0x22, 0x1c}, // 214 0240 {0x1c, 0x22, 0x22, 0x22, 0x3f}, // 215 0241 {0x02, 0x01, 0x1e, 0x10, 0x10}, // 216 0242 {0x20, 0x20, 0x00, 0x70, 0x00}, // 217 0243 {0x00, 0x00, 0x10, 0x5f, 0x00}, // 218 0244 {0x28, 0x10, 0x28, 0x00, 0x00}, // 219 0245 {0x18, 0x24, 0x7e, 0x24, 0x08}, // 220 0246 {0x14, 0x7f, 0x15, 0x01, 0x01}, // 221 0247 {0x1f, 0x48, 0x50, 0x50, 0x0f}, // 222 0248 {0x0e, 0x51, 0x11, 0x51, 0x0e}, // 223 0249 {0x3f, 0x12, 0x22, 0x22, 0x1c}, // 224 0250 {0x1c, 0x22, 0x22, 0x12, 0x3f}, // 225 0251 {0x3c, 0x52, 0x52, 0x52, 0x3c}, // 226 0252 {0x03, 0x05, 0x02, 0x05, 0x06}, // 227 0253 {0x1a, 0x26, 0x20, 0x26, 0x1a}, // 228 0254 {0x1e, 0x41, 0x01, 0x42, 0x1f}, // 229 0255 {0x63, 0x55, 0x49, 0x41, 0x41}, // 230 0256 {0x22, 0x3c, 0x20, 0x3e, 0x22}, // 231 0257 {0x51, 0x4a, 0x44, 0x4a, 0x51}, // 232 0258 {0x3c, 0x02, 0x02, 0x02, 0x3f}, // 233 0259 {0x28, 0x28, 0x3e, 0x28, 0x48}, // 234 0260 {0x22, 0x3c, 0x28, 0x28, 0x2e}, // 235 0261 {0x3e, 0x28, 0x38, 0x28, 0x3e}, // 236 0262 {0x04, 0x04, 0x15, 0x04, 0x04}, // 237 0263 {0x00, 0x00, 0x00, 0x00, 0x00}, // 238 0264 {0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, // 239 0265 {0x00, 0x00, 0x00, 0x00, 0x00}, // 240 0266 {0x00, 0x00, 0x00, 0x00, 0x00}, // 241 0267 {0x00, 0x00, 0x00, 0x00, 0x00}, // 242 0268 {0x00, 0x00, 0x00, 0x00, 0x00}, // 243 0269 {0x00, 0x00, 0x00, 0x00, 0x00}, // 244 0270 {0x00, 0x00, 0x00, 0x00, 0x00}, // 245 0271 {0x00, 0x00, 0x00, 0x00, 0x00}, // 246 0272 {0x00, 0x00, 0x00, 0x00, 0x00}, // 247 0273 {0x00, 0x00, 0x00, 0x00, 0x00}, // 248 0274 {0x00, 0x00, 0x00, 0x00, 0x00}, // 249 0275 {0x00, 0x00, 0x00, 0x00, 0x00}, // 250 0276 {0x00, 0x00, 0x00, 0x00, 0x00}, // 251 0277 {0x00, 0x00, 0x00, 0x00, 0x00}, // 252 0278 {0x00, 0x00, 0x00, 0x00, 0x00}, // 253 0279 {0x00, 0x00, 0x00, 0x00, 0x00}, // 254 0280 {0x00, 0x00, 0x00, 0x00, 0x00}, // 255 0281 }; 0282 0283 inline static bool displayBit(unsigned value, unsigned row, unsigned column) 0284 { 0285 assert(value < 256); 0286 assert(row < 7); 0287 assert(column < 5); 0288 return characterMap[value][column] & (1 << row); 0289 } 0290 0291 Item *MatrixDisplayDriver::construct(ItemDocument *itemDocument, bool newItem, const char *id) 0292 { 0293 return new MatrixDisplayDriver(static_cast<ICNDocument *>(itemDocument), newItem, id); 0294 } 0295 0296 LibraryItem *MatrixDisplayDriver::libraryItem() 0297 { 0298 return new LibraryItem(QStringList(QString("ec/matrix_display_driver")), i18n("Matrix Display Driver"), i18n("Integrated Circuits"), "ic2.png", LibraryItem::lit_component, MatrixDisplayDriver::construct); 0299 } 0300 0301 MatrixDisplayDriver::MatrixDisplayDriver(ICNDocument *icnDocument, bool newItem, const char *id) 0302 : Component(icnDocument, newItem, id ? id : "Matrix Display Driver") 0303 { 0304 m_name = i18n("Matrix Display Driver"); 0305 0306 m_prevCol = 0; 0307 m_nextCol = 0; 0308 m_scanCount = 2; 0309 0310 createProperty("diode-configuration", Variant::Type::Select); 0311 property("diode-configuration")->setCaption(i18n("Configuration")); 0312 QStringMap allowed; 0313 allowed["Row Cathode"] = i18n("Row Cathode"); 0314 allowed["Column Cathode"] = i18n("Column Cathode"); 0315 property("diode-configuration")->setAllowed(allowed); 0316 property("diode-configuration")->setValue("Row Cathode"); 0317 property("diode-configuration")->setAdvanced(true); 0318 0319 // QStringList pins = QStringList::split( ',', "D0,D1,D2,D3,D4,D5,D6,D7,,,,,,C4,C3,C2,C1,C0,,R0,R1,R2,R3,R4,R5,R6", true ); 0320 QStringList pins = QString("D0,D1,D2,D3,D4,D5,D6,D7,,,,,,C4,C3,C2,C1,C0,,R0,R1,R2,R3,R4,R5,R6").split(',', Qt::KeepEmptyParts); 0321 initDIPSymbol(pins, 64); 0322 initDIP(pins); 0323 0324 m_pValueLogic.resize(8 /*, nullptr - 2018.06.02 - initialized below */); 0325 for (unsigned i = 0; i < 8; ++i) 0326 m_pValueLogic[i] = createLogicIn(ecNodeWithID("D" + QString::number(i))); 0327 0328 m_pRowLogic.resize(7 /*, nullptr - 2018.06.02 - initialized below */); 0329 for (unsigned i = 0; i < 7; ++i) { 0330 m_pRowLogic[i] = createLogicOut(ecNodeWithID("R" + QString::number(i)), false); 0331 m_pRowLogic[i]->setOutputLowConductance(1.0); 0332 m_pRowLogic[i]->setOutputHighVoltage(5.0); 0333 } 0334 0335 m_pColLogic.resize(5 /*, nullptr - 2018.06.02 - initialized below */); 0336 for (unsigned i = 0; i < 5; ++i) { 0337 m_pColLogic[i] = createLogicOut(ecNodeWithID("C" + QString::number(i)), false); 0338 m_pColLogic[i]->setOutputHighVoltage(5.0); 0339 } 0340 } 0341 0342 MatrixDisplayDriver::~MatrixDisplayDriver() 0343 { 0344 } 0345 0346 void MatrixDisplayDriver::stepNonLogic() 0347 { 0348 if (++m_scanCount < 5) 0349 return; 0350 m_scanCount = 0; 0351 0352 m_pColLogic[m_prevCol]->setHigh(false); 0353 m_pColLogic[m_nextCol]->setHigh(true); 0354 0355 unsigned value = 0; 0356 for (unsigned i = 0; i < 8; ++i) 0357 value |= (m_pValueLogic[i]->isHigh()) ? (1 << i) : 0; 0358 0359 for (unsigned row = 0; row < 7; row++) { 0360 m_pRowLogic[row]->setHigh(!displayBit(value, row, m_nextCol)); 0361 } 0362 0363 m_prevCol = m_nextCol; 0364 0365 m_nextCol++; 0366 if (m_nextCol >= 5) 0367 m_nextCol = 0; 0368 }