dot Matrix Led Clock with TLC5940

Dependencies:   Kc_TLC5940 mbed

Committer:
kohacraft
Date:
Tue Jul 28 00:21:58 2015 +0000
Revision:
0:c61e5f0d54c1
Child:
4:a7ed06634621
disp hour and add adj sw;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kohacraft 0:c61e5f0d54c1 1
kohacraft 0:c61e5f0d54c1 2
kohacraft 0:c61e5f0d54c1 3 #define font001 00000010
kohacraft 0:c61e5f0d54c1 4 #define font002 00000101
kohacraft 0:c61e5f0d54c1 5 #define font003 00000101
kohacraft 0:c61e5f0d54c1 6 #define font004 00000101
kohacraft 0:c61e5f0d54c1 7 #define font005 00000101
kohacraft 0:c61e5f0d54c1 8 #define font006 00000101
kohacraft 0:c61e5f0d54c1 9 #define font007 00000010
kohacraft 0:c61e5f0d54c1 10 #define font008 00000000
kohacraft 0:c61e5f0d54c1 11
kohacraft 0:c61e5f0d54c1 12 #define font011 00000010
kohacraft 0:c61e5f0d54c1 13 #define font012 00000110
kohacraft 0:c61e5f0d54c1 14 #define font013 00000010
kohacraft 0:c61e5f0d54c1 15 #define font014 00000010
kohacraft 0:c61e5f0d54c1 16 #define font015 00000010
kohacraft 0:c61e5f0d54c1 17 #define font016 00000010
kohacraft 0:c61e5f0d54c1 18 #define font017 00000010
kohacraft 0:c61e5f0d54c1 19 #define font018 00000000
kohacraft 0:c61e5f0d54c1 20
kohacraft 0:c61e5f0d54c1 21 #define font021 00000110
kohacraft 0:c61e5f0d54c1 22 #define font022 00000001
kohacraft 0:c61e5f0d54c1 23 #define font023 00000001
kohacraft 0:c61e5f0d54c1 24 #define font024 00000010
kohacraft 0:c61e5f0d54c1 25 #define font025 00000100
kohacraft 0:c61e5f0d54c1 26 #define font026 00000100
kohacraft 0:c61e5f0d54c1 27 #define font027 00000111
kohacraft 0:c61e5f0d54c1 28 #define font028 00000000
kohacraft 0:c61e5f0d54c1 29
kohacraft 0:c61e5f0d54c1 30 #define font031 00000110
kohacraft 0:c61e5f0d54c1 31 #define font032 00000001
kohacraft 0:c61e5f0d54c1 32 #define font033 00000001
kohacraft 0:c61e5f0d54c1 33 #define font034 00000110
kohacraft 0:c61e5f0d54c1 34 #define font035 00000001
kohacraft 0:c61e5f0d54c1 35 #define font036 00000001
kohacraft 0:c61e5f0d54c1 36 #define font037 00000110
kohacraft 0:c61e5f0d54c1 37 #define font038 00000000
kohacraft 0:c61e5f0d54c1 38
kohacraft 0:c61e5f0d54c1 39 #define font041 00000001
kohacraft 0:c61e5f0d54c1 40 #define font042 00000011
kohacraft 0:c61e5f0d54c1 41 #define font043 00000101
kohacraft 0:c61e5f0d54c1 42 #define font044 00000111
kohacraft 0:c61e5f0d54c1 43 #define font045 00000001
kohacraft 0:c61e5f0d54c1 44 #define font046 00000001
kohacraft 0:c61e5f0d54c1 45 #define font047 00000001
kohacraft 0:c61e5f0d54c1 46 #define font048 00000000
kohacraft 0:c61e5f0d54c1 47
kohacraft 0:c61e5f0d54c1 48 #define font051 00000111
kohacraft 0:c61e5f0d54c1 49 #define font052 00000100
kohacraft 0:c61e5f0d54c1 50 #define font053 00000100
kohacraft 0:c61e5f0d54c1 51 #define font054 00000110
kohacraft 0:c61e5f0d54c1 52 #define font055 00000001
kohacraft 0:c61e5f0d54c1 53 #define font056 00000001
kohacraft 0:c61e5f0d54c1 54 #define font057 00000110
kohacraft 0:c61e5f0d54c1 55 #define font058 00000000
kohacraft 0:c61e5f0d54c1 56
kohacraft 0:c61e5f0d54c1 57 #define font061 00000001
kohacraft 0:c61e5f0d54c1 58 #define font062 00000010
kohacraft 0:c61e5f0d54c1 59 #define font063 00000100
kohacraft 0:c61e5f0d54c1 60 #define font064 00000111
kohacraft 0:c61e5f0d54c1 61 #define font065 00000101
kohacraft 0:c61e5f0d54c1 62 #define font066 00000101
kohacraft 0:c61e5f0d54c1 63 #define font067 00000111
kohacraft 0:c61e5f0d54c1 64 #define font068 00000000
kohacraft 0:c61e5f0d54c1 65
kohacraft 0:c61e5f0d54c1 66 #define font071 00000111
kohacraft 0:c61e5f0d54c1 67 #define font072 00000001
kohacraft 0:c61e5f0d54c1 68 #define font073 00000001
kohacraft 0:c61e5f0d54c1 69 #define font074 00000010
kohacraft 0:c61e5f0d54c1 70 #define font075 00000010
kohacraft 0:c61e5f0d54c1 71 #define font076 00000100
kohacraft 0:c61e5f0d54c1 72 #define font077 00000100
kohacraft 0:c61e5f0d54c1 73 #define font078 00000000
kohacraft 0:c61e5f0d54c1 74
kohacraft 0:c61e5f0d54c1 75 #define font081 00000111
kohacraft 0:c61e5f0d54c1 76 #define font082 00000101
kohacraft 0:c61e5f0d54c1 77 #define font083 00000101
kohacraft 0:c61e5f0d54c1 78 #define font084 00000010
kohacraft 0:c61e5f0d54c1 79 #define font085 00000101
kohacraft 0:c61e5f0d54c1 80 #define font086 00000101
kohacraft 0:c61e5f0d54c1 81 #define font087 00000111
kohacraft 0:c61e5f0d54c1 82 #define font088 00000000
kohacraft 0:c61e5f0d54c1 83
kohacraft 0:c61e5f0d54c1 84 #define font091 00000111
kohacraft 0:c61e5f0d54c1 85 #define font092 00000101
kohacraft 0:c61e5f0d54c1 86 #define font093 00000101
kohacraft 0:c61e5f0d54c1 87 #define font094 00000111
kohacraft 0:c61e5f0d54c1 88 #define font095 00000001
kohacraft 0:c61e5f0d54c1 89 #define font096 00000010
kohacraft 0:c61e5f0d54c1 90 #define font097 00000100
kohacraft 0:c61e5f0d54c1 91 #define font098 00000000
kohacraft 0:c61e5f0d54c1 92
kohacraft 0:c61e5f0d54c1 93 #define fontc01 00000000
kohacraft 0:c61e5f0d54c1 94 #define fontc02 00000000
kohacraft 0:c61e5f0d54c1 95 #define fontc03 00000001
kohacraft 0:c61e5f0d54c1 96 #define fontc04 00000000
kohacraft 0:c61e5f0d54c1 97 #define fontc05 00000001
kohacraft 0:c61e5f0d54c1 98 #define fontc06 00000000
kohacraft 0:c61e5f0d54c1 99 #define fontc07 00000000
kohacraft 0:c61e5f0d54c1 100 #define fontc08 00000000
kohacraft 0:c61e5f0d54c1 101
kohacraft 0:c61e5f0d54c1 102 #define font111 00000000
kohacraft 0:c61e5f0d54c1 103 #define font112 00000000
kohacraft 0:c61e5f0d54c1 104 #define font113 00000000
kohacraft 0:c61e5f0d54c1 105 #define font114 00000000
kohacraft 0:c61e5f0d54c1 106 #define font115 00000000
kohacraft 0:c61e5f0d54c1 107 #define font116 00000000
kohacraft 0:c61e5f0d54c1 108 #define font117 00000000
kohacraft 0:c61e5f0d54c1 109 #define font118 00000000
kohacraft 0:c61e5f0d54c1 110
kohacraft 0:c61e5f0d54c1 111 #define font121 00000000
kohacraft 0:c61e5f0d54c1 112 #define font122 00000000
kohacraft 0:c61e5f0d54c1 113 #define font123 00000000
kohacraft 0:c61e5f0d54c1 114 #define font124 00000000
kohacraft 0:c61e5f0d54c1 115 #define font125 00000000
kohacraft 0:c61e5f0d54c1 116 #define font126 00000000
kohacraft 0:c61e5f0d54c1 117 #define font127 00000000
kohacraft 0:c61e5f0d54c1 118 #define font128 00000000
kohacraft 0:c61e5f0d54c1 119
kohacraft 0:c61e5f0d54c1 120 unsigned char font[11][8];
kohacraft 0:c61e5f0d54c1 121
kohacraft 0:c61e5f0d54c1 122
kohacraft 0:c61e5f0d54c1 123 //数字の01とした2進数を16進数として数値に変換する
kohacraft 0:c61e5f0d54c1 124 unsigned char makeOneFont( int inData )
kohacraft 0:c61e5f0d54c1 125 {
kohacraft 0:c61e5f0d54c1 126 int temp = inData;
kohacraft 0:c61e5f0d54c1 127 unsigned char outData = 0;
kohacraft 0:c61e5f0d54c1 128
kohacraft 0:c61e5f0d54c1 129 if( temp >= 10000000 )
kohacraft 0:c61e5f0d54c1 130 {
kohacraft 0:c61e5f0d54c1 131 outData = outData | 0x80;
kohacraft 0:c61e5f0d54c1 132 temp -= 10000000;
kohacraft 0:c61e5f0d54c1 133 }
kohacraft 0:c61e5f0d54c1 134 if( temp >= 01000000 )
kohacraft 0:c61e5f0d54c1 135 {
kohacraft 0:c61e5f0d54c1 136 outData = outData | 0x40;
kohacraft 0:c61e5f0d54c1 137 temp -= 01000000;
kohacraft 0:c61e5f0d54c1 138 }
kohacraft 0:c61e5f0d54c1 139 if( temp >= 00100000 )
kohacraft 0:c61e5f0d54c1 140 {
kohacraft 0:c61e5f0d54c1 141 outData = outData | 0x20;
kohacraft 0:c61e5f0d54c1 142 temp -= 00100000;
kohacraft 0:c61e5f0d54c1 143 }
kohacraft 0:c61e5f0d54c1 144 if( temp >= 00010000 )
kohacraft 0:c61e5f0d54c1 145 {
kohacraft 0:c61e5f0d54c1 146 outData = outData | 0x10;
kohacraft 0:c61e5f0d54c1 147 temp -= 00010000;
kohacraft 0:c61e5f0d54c1 148 }
kohacraft 0:c61e5f0d54c1 149 if( temp >= 00001000 )
kohacraft 0:c61e5f0d54c1 150 {
kohacraft 0:c61e5f0d54c1 151 outData = outData | 0x08;
kohacraft 0:c61e5f0d54c1 152 temp -= 00001000;
kohacraft 0:c61e5f0d54c1 153 }
kohacraft 0:c61e5f0d54c1 154 if( temp >= 00000100 )
kohacraft 0:c61e5f0d54c1 155 {
kohacraft 0:c61e5f0d54c1 156 outData = outData | 0x04;
kohacraft 0:c61e5f0d54c1 157 temp -= 00000100;
kohacraft 0:c61e5f0d54c1 158 }
kohacraft 0:c61e5f0d54c1 159 if( temp >= 00000010 )
kohacraft 0:c61e5f0d54c1 160 {
kohacraft 0:c61e5f0d54c1 161 outData = outData | 0x02;
kohacraft 0:c61e5f0d54c1 162 temp -= 00000010;
kohacraft 0:c61e5f0d54c1 163 }
kohacraft 0:c61e5f0d54c1 164 if( temp == 1 )
kohacraft 0:c61e5f0d54c1 165 {
kohacraft 0:c61e5f0d54c1 166 outData = outData | 0x01;
kohacraft 0:c61e5f0d54c1 167 }
kohacraft 0:c61e5f0d54c1 168 return outData;
kohacraft 0:c61e5f0d54c1 169 }
kohacraft 0:c61e5f0d54c1 170
kohacraft 0:c61e5f0d54c1 171 //全てフォントを文字列から数字に変換する
kohacraft 0:c61e5f0d54c1 172 void initFont()
kohacraft 0:c61e5f0d54c1 173 {
kohacraft 0:c61e5f0d54c1 174 font[0][0] = makeOneFont( font001);
kohacraft 0:c61e5f0d54c1 175 font[0][1] = makeOneFont( font002);
kohacraft 0:c61e5f0d54c1 176 font[0][2] = makeOneFont( font003);
kohacraft 0:c61e5f0d54c1 177 font[0][3] = makeOneFont( font004);
kohacraft 0:c61e5f0d54c1 178 font[0][4] = makeOneFont( font005);
kohacraft 0:c61e5f0d54c1 179 font[0][5] = makeOneFont( font006);
kohacraft 0:c61e5f0d54c1 180 font[0][6] = makeOneFont( font007);
kohacraft 0:c61e5f0d54c1 181 font[0][7] = makeOneFont( font008);
kohacraft 0:c61e5f0d54c1 182
kohacraft 0:c61e5f0d54c1 183 font[1][0] = makeOneFont( font011);
kohacraft 0:c61e5f0d54c1 184 font[1][1] = makeOneFont( font012);
kohacraft 0:c61e5f0d54c1 185 font[1][2] = makeOneFont( font013);
kohacraft 0:c61e5f0d54c1 186 font[1][3] = makeOneFont( font014);
kohacraft 0:c61e5f0d54c1 187 font[1][4] = makeOneFont( font015);
kohacraft 0:c61e5f0d54c1 188 font[1][5] = makeOneFont( font016);
kohacraft 0:c61e5f0d54c1 189 font[1][6] = makeOneFont( font017);
kohacraft 0:c61e5f0d54c1 190 font[1][7] = makeOneFont( font018);
kohacraft 0:c61e5f0d54c1 191
kohacraft 0:c61e5f0d54c1 192 font[2][0] = makeOneFont( font021);
kohacraft 0:c61e5f0d54c1 193 font[2][1] = makeOneFont( font022);
kohacraft 0:c61e5f0d54c1 194 font[2][2] = makeOneFont( font023);
kohacraft 0:c61e5f0d54c1 195 font[2][3] = makeOneFont( font024);
kohacraft 0:c61e5f0d54c1 196 font[2][4] = makeOneFont( font025);
kohacraft 0:c61e5f0d54c1 197 font[2][5] = makeOneFont( font026);
kohacraft 0:c61e5f0d54c1 198 font[2][6] = makeOneFont( font027);
kohacraft 0:c61e5f0d54c1 199 font[2][7] = makeOneFont( font028);
kohacraft 0:c61e5f0d54c1 200
kohacraft 0:c61e5f0d54c1 201 font[3][0] = makeOneFont( font031);
kohacraft 0:c61e5f0d54c1 202 font[3][1] = makeOneFont( font032);
kohacraft 0:c61e5f0d54c1 203 font[3][2] = makeOneFont( font033);
kohacraft 0:c61e5f0d54c1 204 font[3][3] = makeOneFont( font034);
kohacraft 0:c61e5f0d54c1 205 font[3][4] = makeOneFont( font035);
kohacraft 0:c61e5f0d54c1 206 font[3][5] = makeOneFont( font036);
kohacraft 0:c61e5f0d54c1 207 font[3][6] = makeOneFont( font037);
kohacraft 0:c61e5f0d54c1 208 font[3][7] = makeOneFont( font038);
kohacraft 0:c61e5f0d54c1 209
kohacraft 0:c61e5f0d54c1 210 font[4][0] = makeOneFont( font041);
kohacraft 0:c61e5f0d54c1 211 font[4][1] = makeOneFont( font042);
kohacraft 0:c61e5f0d54c1 212 font[4][2] = makeOneFont( font043);
kohacraft 0:c61e5f0d54c1 213 font[4][3] = makeOneFont( font044);
kohacraft 0:c61e5f0d54c1 214 font[4][4] = makeOneFont( font045);
kohacraft 0:c61e5f0d54c1 215 font[4][5] = makeOneFont( font046);
kohacraft 0:c61e5f0d54c1 216 font[4][6] = makeOneFont( font047);
kohacraft 0:c61e5f0d54c1 217 font[4][7] = makeOneFont( font048);
kohacraft 0:c61e5f0d54c1 218
kohacraft 0:c61e5f0d54c1 219 font[5][0] = makeOneFont( font051);
kohacraft 0:c61e5f0d54c1 220 font[5][1] = makeOneFont( font052);
kohacraft 0:c61e5f0d54c1 221 font[5][2] = makeOneFont( font053);
kohacraft 0:c61e5f0d54c1 222 font[5][3] = makeOneFont( font054);
kohacraft 0:c61e5f0d54c1 223 font[5][4] = makeOneFont( font055);
kohacraft 0:c61e5f0d54c1 224 font[5][5] = makeOneFont( font056);
kohacraft 0:c61e5f0d54c1 225 font[5][6] = makeOneFont( font057);
kohacraft 0:c61e5f0d54c1 226 font[5][7] = makeOneFont( font058);
kohacraft 0:c61e5f0d54c1 227
kohacraft 0:c61e5f0d54c1 228 font[6][0] = makeOneFont( font061);
kohacraft 0:c61e5f0d54c1 229 font[6][1] = makeOneFont( font062);
kohacraft 0:c61e5f0d54c1 230 font[6][2] = makeOneFont( font063);
kohacraft 0:c61e5f0d54c1 231 font[6][3] = makeOneFont( font064);
kohacraft 0:c61e5f0d54c1 232 font[6][4] = makeOneFont( font065);
kohacraft 0:c61e5f0d54c1 233 font[6][5] = makeOneFont( font066);
kohacraft 0:c61e5f0d54c1 234 font[6][6] = makeOneFont( font067);
kohacraft 0:c61e5f0d54c1 235 font[6][7] = makeOneFont( font068);
kohacraft 0:c61e5f0d54c1 236
kohacraft 0:c61e5f0d54c1 237 font[7][0] = makeOneFont( font071);
kohacraft 0:c61e5f0d54c1 238 font[7][1] = makeOneFont( font072);
kohacraft 0:c61e5f0d54c1 239 font[7][2] = makeOneFont( font073);
kohacraft 0:c61e5f0d54c1 240 font[7][3] = makeOneFont( font074);
kohacraft 0:c61e5f0d54c1 241 font[7][4] = makeOneFont( font075);
kohacraft 0:c61e5f0d54c1 242 font[7][5] = makeOneFont( font076);
kohacraft 0:c61e5f0d54c1 243 font[7][6] = makeOneFont( font077);
kohacraft 0:c61e5f0d54c1 244 font[7][7] = makeOneFont( font078);
kohacraft 0:c61e5f0d54c1 245
kohacraft 0:c61e5f0d54c1 246 font[8][0] = makeOneFont( font081);
kohacraft 0:c61e5f0d54c1 247 font[8][1] = makeOneFont( font082);
kohacraft 0:c61e5f0d54c1 248 font[8][2] = makeOneFont( font083);
kohacraft 0:c61e5f0d54c1 249 font[8][3] = makeOneFont( font084);
kohacraft 0:c61e5f0d54c1 250 font[8][4] = makeOneFont( font085);
kohacraft 0:c61e5f0d54c1 251 font[8][5] = makeOneFont( font086);
kohacraft 0:c61e5f0d54c1 252 font[8][6] = makeOneFont( font087);
kohacraft 0:c61e5f0d54c1 253 font[8][7] = makeOneFont( font088);
kohacraft 0:c61e5f0d54c1 254
kohacraft 0:c61e5f0d54c1 255 font[9][0] = makeOneFont( font091);
kohacraft 0:c61e5f0d54c1 256 font[9][1] = makeOneFont( font092);
kohacraft 0:c61e5f0d54c1 257 font[9][2] = makeOneFont( font093);
kohacraft 0:c61e5f0d54c1 258 font[9][3] = makeOneFont( font094);
kohacraft 0:c61e5f0d54c1 259 font[9][4] = makeOneFont( font095);
kohacraft 0:c61e5f0d54c1 260 font[9][5] = makeOneFont( font096);
kohacraft 0:c61e5f0d54c1 261 font[9][6] = makeOneFont( font097);
kohacraft 0:c61e5f0d54c1 262 font[9][7] = makeOneFont( font098);
kohacraft 0:c61e5f0d54c1 263
kohacraft 0:c61e5f0d54c1 264 font[10][0] = makeOneFont( fontc01);
kohacraft 0:c61e5f0d54c1 265 font[10][1] = makeOneFont( fontc02);
kohacraft 0:c61e5f0d54c1 266 font[10][2] = makeOneFont( fontc03);
kohacraft 0:c61e5f0d54c1 267 font[10][3] = makeOneFont( fontc04);
kohacraft 0:c61e5f0d54c1 268 font[10][4] = makeOneFont( fontc05);
kohacraft 0:c61e5f0d54c1 269 font[10][5] = makeOneFont( fontc06);
kohacraft 0:c61e5f0d54c1 270 font[10][6] = makeOneFont( fontc07);
kohacraft 0:c61e5f0d54c1 271 font[10][7] = makeOneFont( fontc08);
kohacraft 0:c61e5f0d54c1 272
kohacraft 0:c61e5f0d54c1 273
kohacraft 0:c61e5f0d54c1 274 }