dot Matrix Led Clock with TLC5940

Dependencies:   Kc_TLC5940 mbed

Committer:
kohacraft
Date:
Wed Jul 29 06:45:25 2015 +0000
Revision:
4:a7ed06634621
Parent:
0:c61e5f0d54c1
dot Matrix Led Clock

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kohacraft 4:a7ed06634621 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
kohacraft 0:c61e5f0d54c1 103 unsigned char font[11][8];
kohacraft 0:c61e5f0d54c1 104
kohacraft 4:a7ed06634621 105 //ここにコードを書いてすみません
kohacraft 4:a7ed06634621 106 //フォントは別にしたかったのですが、面倒なのでここに書かせてもらいました
kohacraft 0:c61e5f0d54c1 107 //数字の01とした2進数を16進数として数値に変換する
kohacraft 0:c61e5f0d54c1 108 unsigned char makeOneFont( int inData )
kohacraft 0:c61e5f0d54c1 109 {
kohacraft 0:c61e5f0d54c1 110 int temp = inData;
kohacraft 0:c61e5f0d54c1 111 unsigned char outData = 0;
kohacraft 0:c61e5f0d54c1 112
kohacraft 0:c61e5f0d54c1 113 if( temp >= 10000000 )
kohacraft 0:c61e5f0d54c1 114 {
kohacraft 0:c61e5f0d54c1 115 outData = outData | 0x80;
kohacraft 0:c61e5f0d54c1 116 temp -= 10000000;
kohacraft 0:c61e5f0d54c1 117 }
kohacraft 0:c61e5f0d54c1 118 if( temp >= 01000000 )
kohacraft 0:c61e5f0d54c1 119 {
kohacraft 0:c61e5f0d54c1 120 outData = outData | 0x40;
kohacraft 0:c61e5f0d54c1 121 temp -= 01000000;
kohacraft 0:c61e5f0d54c1 122 }
kohacraft 0:c61e5f0d54c1 123 if( temp >= 00100000 )
kohacraft 0:c61e5f0d54c1 124 {
kohacraft 0:c61e5f0d54c1 125 outData = outData | 0x20;
kohacraft 0:c61e5f0d54c1 126 temp -= 00100000;
kohacraft 0:c61e5f0d54c1 127 }
kohacraft 0:c61e5f0d54c1 128 if( temp >= 00010000 )
kohacraft 0:c61e5f0d54c1 129 {
kohacraft 0:c61e5f0d54c1 130 outData = outData | 0x10;
kohacraft 0:c61e5f0d54c1 131 temp -= 00010000;
kohacraft 0:c61e5f0d54c1 132 }
kohacraft 0:c61e5f0d54c1 133 if( temp >= 00001000 )
kohacraft 0:c61e5f0d54c1 134 {
kohacraft 0:c61e5f0d54c1 135 outData = outData | 0x08;
kohacraft 0:c61e5f0d54c1 136 temp -= 00001000;
kohacraft 0:c61e5f0d54c1 137 }
kohacraft 0:c61e5f0d54c1 138 if( temp >= 00000100 )
kohacraft 0:c61e5f0d54c1 139 {
kohacraft 0:c61e5f0d54c1 140 outData = outData | 0x04;
kohacraft 0:c61e5f0d54c1 141 temp -= 00000100;
kohacraft 0:c61e5f0d54c1 142 }
kohacraft 0:c61e5f0d54c1 143 if( temp >= 00000010 )
kohacraft 0:c61e5f0d54c1 144 {
kohacraft 0:c61e5f0d54c1 145 outData = outData | 0x02;
kohacraft 0:c61e5f0d54c1 146 temp -= 00000010;
kohacraft 0:c61e5f0d54c1 147 }
kohacraft 0:c61e5f0d54c1 148 if( temp == 1 )
kohacraft 0:c61e5f0d54c1 149 {
kohacraft 0:c61e5f0d54c1 150 outData = outData | 0x01;
kohacraft 0:c61e5f0d54c1 151 }
kohacraft 0:c61e5f0d54c1 152 return outData;
kohacraft 0:c61e5f0d54c1 153 }
kohacraft 0:c61e5f0d54c1 154
kohacraft 0:c61e5f0d54c1 155 //全てフォントを文字列から数字に変換する
kohacraft 0:c61e5f0d54c1 156 void initFont()
kohacraft 0:c61e5f0d54c1 157 {
kohacraft 0:c61e5f0d54c1 158 font[0][0] = makeOneFont( font001);
kohacraft 0:c61e5f0d54c1 159 font[0][1] = makeOneFont( font002);
kohacraft 0:c61e5f0d54c1 160 font[0][2] = makeOneFont( font003);
kohacraft 0:c61e5f0d54c1 161 font[0][3] = makeOneFont( font004);
kohacraft 0:c61e5f0d54c1 162 font[0][4] = makeOneFont( font005);
kohacraft 0:c61e5f0d54c1 163 font[0][5] = makeOneFont( font006);
kohacraft 0:c61e5f0d54c1 164 font[0][6] = makeOneFont( font007);
kohacraft 0:c61e5f0d54c1 165 font[0][7] = makeOneFont( font008);
kohacraft 0:c61e5f0d54c1 166
kohacraft 0:c61e5f0d54c1 167 font[1][0] = makeOneFont( font011);
kohacraft 0:c61e5f0d54c1 168 font[1][1] = makeOneFont( font012);
kohacraft 0:c61e5f0d54c1 169 font[1][2] = makeOneFont( font013);
kohacraft 0:c61e5f0d54c1 170 font[1][3] = makeOneFont( font014);
kohacraft 0:c61e5f0d54c1 171 font[1][4] = makeOneFont( font015);
kohacraft 0:c61e5f0d54c1 172 font[1][5] = makeOneFont( font016);
kohacraft 0:c61e5f0d54c1 173 font[1][6] = makeOneFont( font017);
kohacraft 0:c61e5f0d54c1 174 font[1][7] = makeOneFont( font018);
kohacraft 0:c61e5f0d54c1 175
kohacraft 0:c61e5f0d54c1 176 font[2][0] = makeOneFont( font021);
kohacraft 0:c61e5f0d54c1 177 font[2][1] = makeOneFont( font022);
kohacraft 0:c61e5f0d54c1 178 font[2][2] = makeOneFont( font023);
kohacraft 0:c61e5f0d54c1 179 font[2][3] = makeOneFont( font024);
kohacraft 0:c61e5f0d54c1 180 font[2][4] = makeOneFont( font025);
kohacraft 0:c61e5f0d54c1 181 font[2][5] = makeOneFont( font026);
kohacraft 0:c61e5f0d54c1 182 font[2][6] = makeOneFont( font027);
kohacraft 0:c61e5f0d54c1 183 font[2][7] = makeOneFont( font028);
kohacraft 0:c61e5f0d54c1 184
kohacraft 0:c61e5f0d54c1 185 font[3][0] = makeOneFont( font031);
kohacraft 0:c61e5f0d54c1 186 font[3][1] = makeOneFont( font032);
kohacraft 0:c61e5f0d54c1 187 font[3][2] = makeOneFont( font033);
kohacraft 0:c61e5f0d54c1 188 font[3][3] = makeOneFont( font034);
kohacraft 0:c61e5f0d54c1 189 font[3][4] = makeOneFont( font035);
kohacraft 0:c61e5f0d54c1 190 font[3][5] = makeOneFont( font036);
kohacraft 0:c61e5f0d54c1 191 font[3][6] = makeOneFont( font037);
kohacraft 0:c61e5f0d54c1 192 font[3][7] = makeOneFont( font038);
kohacraft 0:c61e5f0d54c1 193
kohacraft 0:c61e5f0d54c1 194 font[4][0] = makeOneFont( font041);
kohacraft 0:c61e5f0d54c1 195 font[4][1] = makeOneFont( font042);
kohacraft 0:c61e5f0d54c1 196 font[4][2] = makeOneFont( font043);
kohacraft 0:c61e5f0d54c1 197 font[4][3] = makeOneFont( font044);
kohacraft 0:c61e5f0d54c1 198 font[4][4] = makeOneFont( font045);
kohacraft 0:c61e5f0d54c1 199 font[4][5] = makeOneFont( font046);
kohacraft 0:c61e5f0d54c1 200 font[4][6] = makeOneFont( font047);
kohacraft 0:c61e5f0d54c1 201 font[4][7] = makeOneFont( font048);
kohacraft 0:c61e5f0d54c1 202
kohacraft 0:c61e5f0d54c1 203 font[5][0] = makeOneFont( font051);
kohacraft 0:c61e5f0d54c1 204 font[5][1] = makeOneFont( font052);
kohacraft 0:c61e5f0d54c1 205 font[5][2] = makeOneFont( font053);
kohacraft 0:c61e5f0d54c1 206 font[5][3] = makeOneFont( font054);
kohacraft 0:c61e5f0d54c1 207 font[5][4] = makeOneFont( font055);
kohacraft 0:c61e5f0d54c1 208 font[5][5] = makeOneFont( font056);
kohacraft 0:c61e5f0d54c1 209 font[5][6] = makeOneFont( font057);
kohacraft 0:c61e5f0d54c1 210 font[5][7] = makeOneFont( font058);
kohacraft 0:c61e5f0d54c1 211
kohacraft 0:c61e5f0d54c1 212 font[6][0] = makeOneFont( font061);
kohacraft 0:c61e5f0d54c1 213 font[6][1] = makeOneFont( font062);
kohacraft 0:c61e5f0d54c1 214 font[6][2] = makeOneFont( font063);
kohacraft 0:c61e5f0d54c1 215 font[6][3] = makeOneFont( font064);
kohacraft 0:c61e5f0d54c1 216 font[6][4] = makeOneFont( font065);
kohacraft 0:c61e5f0d54c1 217 font[6][5] = makeOneFont( font066);
kohacraft 0:c61e5f0d54c1 218 font[6][6] = makeOneFont( font067);
kohacraft 0:c61e5f0d54c1 219 font[6][7] = makeOneFont( font068);
kohacraft 0:c61e5f0d54c1 220
kohacraft 0:c61e5f0d54c1 221 font[7][0] = makeOneFont( font071);
kohacraft 0:c61e5f0d54c1 222 font[7][1] = makeOneFont( font072);
kohacraft 0:c61e5f0d54c1 223 font[7][2] = makeOneFont( font073);
kohacraft 0:c61e5f0d54c1 224 font[7][3] = makeOneFont( font074);
kohacraft 0:c61e5f0d54c1 225 font[7][4] = makeOneFont( font075);
kohacraft 0:c61e5f0d54c1 226 font[7][5] = makeOneFont( font076);
kohacraft 0:c61e5f0d54c1 227 font[7][6] = makeOneFont( font077);
kohacraft 0:c61e5f0d54c1 228 font[7][7] = makeOneFont( font078);
kohacraft 0:c61e5f0d54c1 229
kohacraft 0:c61e5f0d54c1 230 font[8][0] = makeOneFont( font081);
kohacraft 0:c61e5f0d54c1 231 font[8][1] = makeOneFont( font082);
kohacraft 0:c61e5f0d54c1 232 font[8][2] = makeOneFont( font083);
kohacraft 0:c61e5f0d54c1 233 font[8][3] = makeOneFont( font084);
kohacraft 0:c61e5f0d54c1 234 font[8][4] = makeOneFont( font085);
kohacraft 0:c61e5f0d54c1 235 font[8][5] = makeOneFont( font086);
kohacraft 0:c61e5f0d54c1 236 font[8][6] = makeOneFont( font087);
kohacraft 0:c61e5f0d54c1 237 font[8][7] = makeOneFont( font088);
kohacraft 0:c61e5f0d54c1 238
kohacraft 0:c61e5f0d54c1 239 font[9][0] = makeOneFont( font091);
kohacraft 0:c61e5f0d54c1 240 font[9][1] = makeOneFont( font092);
kohacraft 0:c61e5f0d54c1 241 font[9][2] = makeOneFont( font093);
kohacraft 0:c61e5f0d54c1 242 font[9][3] = makeOneFont( font094);
kohacraft 0:c61e5f0d54c1 243 font[9][4] = makeOneFont( font095);
kohacraft 0:c61e5f0d54c1 244 font[9][5] = makeOneFont( font096);
kohacraft 0:c61e5f0d54c1 245 font[9][6] = makeOneFont( font097);
kohacraft 0:c61e5f0d54c1 246 font[9][7] = makeOneFont( font098);
kohacraft 0:c61e5f0d54c1 247
kohacraft 0:c61e5f0d54c1 248 font[10][0] = makeOneFont( fontc01);
kohacraft 0:c61e5f0d54c1 249 font[10][1] = makeOneFont( fontc02);
kohacraft 0:c61e5f0d54c1 250 font[10][2] = makeOneFont( fontc03);
kohacraft 0:c61e5f0d54c1 251 font[10][3] = makeOneFont( fontc04);
kohacraft 0:c61e5f0d54c1 252 font[10][4] = makeOneFont( fontc05);
kohacraft 0:c61e5f0d54c1 253 font[10][5] = makeOneFont( fontc06);
kohacraft 0:c61e5f0d54c1 254 font[10][6] = makeOneFont( fontc07);
kohacraft 0:c61e5f0d54c1 255 font[10][7] = makeOneFont( fontc08);
kohacraft 0:c61e5f0d54c1 256
kohacraft 0:c61e5f0d54c1 257
kohacraft 0:c61e5f0d54c1 258 }