Simple single-color 8x8x8 LED Cube with AVRs
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * font.c
  3. *
  4. * Copyright 2012 Thomas Buck <xythobuz@me.com>
  5. *
  6. * This file is part of LED-Cube.
  7. *
  8. * LED-Cube is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * LED-Cube is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with LED-Cube. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #include <stdint.h>
  22. #include <avr/io.h>
  23. #include <avr/pgmspace.h>
  24. uint8_t font[95][8];
  25. uint8_t fontBuff[8];
  26. uint8_t *getFont(char c) {
  27. uint8_t i;
  28. if (!((c >= 0x20) && (c <= 0x7E))) {
  29. c = '?';
  30. }
  31. for (i = 0; i < 8; i++) {
  32. fontBuff[i] = pgm_read_byte(&(font[(uint8_t)(c - 0x20)][i]));
  33. }
  34. return fontBuff;
  35. }
  36. // Source: http://www.mikrocontroller.net/topic/54860
  37. // Author: Benedikt K
  38. // This is a LCD Font originally for Codepage 850.
  39. // Because of size restraints, i cut everything but
  40. // the printable ascii range, 0x20 to 0x7E
  41. // Not really pretty on the cube, but enough for now.
  42. // I already replaced everything but lowercase letters
  43. uint8_t font[95][8] PROGMEM = {
  44. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 20 SPACE
  45. {0x7e, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18}, // 21 !
  46. {0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00}, // 22 "
  47. {0x66, 0xff, 0xff, 0x66, 0x66, 0xff, 0xff, 0x66}, // 23 #
  48. {0x18, 0xff, 0x19, 0x19, 0xfe, 0x98, 0xff, 0x18}, // 24 $
  49. {0x87, 0x45, 0x27, 0x10, 0x08, 0xe4, 0xa2, 0xe1}, // 25 %
  50. {0x1e, 0x33, 0x33, 0xde, 0xee, 0x3b, 0x73, 0xdc}, // 26 &
  51. {0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // 27 '
  52. {0x18, 0x0c, 0x06, 0x03, 0x03, 0x06, 0x0c, 0x18}, // 28 (
  53. {0x18, 0x38, 0x60, 0xc0, 0xc0, 0x60, 0x38, 0x18}, // 29 )
  54. {0x99, 0x5a, 0x3c, 0xff, 0xff, 0x3c, 0x5a, 0x99}, // 2A *
  55. {0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18}, // 2B +
  56. {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x0c}, // 2C ,
  57. {0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00}, // 2D -
  58. {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00}, // 2E .
  59. {0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x03}, // 2F /
  60. {0x7e, 0xff, 0xe3, 0xd3, 0xcb, 0xc7, 0xff, 0x7e}, // 30 0
  61. {0x38, 0x3c, 0x36, 0x33, 0x31, 0x30, 0x30, 0x30}, // 31 1
  62. {0x7c, 0x7e, 0x62, 0x30, 0x18, 0x0c, 0x7e, 0x7e}, // 32 2
  63. {0x7e, 0xff, 0xc0, 0x78, 0x78, 0xc0, 0xff, 0x7e}, // 33 3
  64. {0xc3, 0xc3, 0xc3, 0xff, 0xff, 0xc0, 0xc0, 0xc0}, // 34 4
  65. {0xff, 0xff, 0x03, 0x3f, 0x7e, 0xc0, 0x7f, 0x3f}, // 35 5
  66. {0xfe, 0xff, 0x03, 0x7f, 0xff, 0xc3, 0xff, 0x7e}, // 36 6
  67. {0x7e, 0xff, 0xe0, 0x70, 0xfe, 0x1c, 0x0e, 0x07}, // 37 7
  68. {0x3c, 0x7e, 0xc3, 0x7e, 0x7e, 0xc3, 0x7e, 0x3c}, // 38 8
  69. {0x7e, 0xff, 0xc3, 0xff, 0xbe, 0x80, 0xff, 0x7e}, // 39 9
  70. {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00}, // 3A :
  71. {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x0c}, // 3B ;
  72. {0xe0, 0x38, 0x0e, 0x03, 0x03, 0x0e, 0x38, 0xe0}, // 3C <
  73. {0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00}, // 3D =
  74. {0x07, 0x1c, 0x70, 0xc0, 0xc0, 0x70, 0x1c, 0x07}, // 3E >
  75. {0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}, // 3F ?
  76. {0x7e, 0xff, 0xc3, 0x3b, 0x3b, 0x03, 0xff, 0x7e}, // 40 @
  77. {0x7e, 0xff, 0xc3, 0xc3, 0xff, 0xff, 0xc3, 0xc3}, // 41 A
  78. {0x7f, 0x83, 0x83, 0x83, 0x7f, 0x83, 0x83, 0x7f}, // 42 B
  79. {0x7e, 0xff, 0x03, 0x03, 0x03, 0x03, 0xff, 0x7e}, // 43 C
  80. {0x1e, 0x3f, 0x63, 0xc3, 0xc3, 0x63, 0x3f, 0x1e}, // 44 D
  81. {0xfe, 0xff, 0x03, 0x3f, 0x3f, 0x03, 0xff, 0xfe}, // 45 E
  82. {0xfe, 0xff, 0x03, 0x3f, 0x3f, 0x03, 0x03, 0x03}, // 46 F
  83. {0xfe, 0xff, 0x03, 0x63, 0xf3, 0xc3, 0xff, 0x7e}, // 47 G
  84. {0xc3, 0xc3, 0xc3, 0xff, 0xff, 0xc3, 0xc3, 0xc3}, // 48 H
  85. {0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c}, // 49 I
  86. {0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc6, 0x66, 0x3c}, // 4A J
  87. {0xc3, 0x63, 0x33, 0x1f, 0x1f, 0x33, 0x63, 0xc3}, // 4B K
  88. {0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff}, // 4C L
  89. {0x66, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xc3, 0xc3}, // 4D M
  90. {0xc7, 0xcf, 0xcf, 0xdb, 0xdb, 0xf3, 0xf3, 0xe3}, // 4E N
  91. {0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e}, // 4F O
  92. {0x3e, 0x7f, 0xc3, 0xc3, 0x7f, 0x3f, 0x03, 0x03}, // 50 P
  93. {0x3c, 0x7e, 0xc3, 0xc3, 0xd3, 0xe3, 0x7e, 0xbc}, // 51 Q
  94. {0x3e, 0x7f, 0xc3, 0x7f, 0x3f, 0x1f, 0x3b, 0x73}, // 52 R
  95. {0xfe, 0xff, 0x03, 0x7f, 0xfe, 0x80, 0xff, 0x7f}, // 53 S
  96. {0xff, 0xff, 0x99, 0x18, 0x18, 0x18, 0x18, 0x3c}, // 54 T
  97. {0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e}, // 55 U
  98. {0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18}, // 56 V
  99. {0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xdb, 0xff, 0x7e}, // 57 W
  100. {0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3}, // 58 X
  101. {0x81, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18}, // 59 Y
  102. {0xfe, 0xff, 0x70, 0x38, 0x1c, 0x0e, 0xff, 0x7f}, // 5A Z
  103. {0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff}, // 5B [
  104. {0x03, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc0}, // 5C Backslash
  105. {0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff}, // 5D ]
  106. {0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00}, // 5E ^
  107. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff}, // 5F _
  108. {0x0e, 0x1c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00}, // 60 `
  109. {0x00,0x00,0x1E,0x30,0x3E,0x33,0x6E,0x00}, // 61 a
  110. {0x07,0x06,0x3E,0x66,0x66,0x66,0x3D,0x00}, // 62 b
  111. {0x00,0x00,0x1E,0x33,0x03,0x33,0x1E,0x00}, // 63 c
  112. {0x38,0x30,0x30,0x3E,0x33,0x33,0x6E,0x00}, // 64 d
  113. {0x00,0x00,0x1E,0x33,0x3F,0x03,0x1E,0x00}, // 65 e
  114. {0x1C,0x36,0x06,0x0F,0x06,0x06,0x0F,0x00}, // 66 f
  115. {0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x1F}, // 67 g
  116. {0x07,0x06,0x36,0x6E,0x66,0x66,0x67,0x00}, // 68 h
  117. {0x0C,0x00,0x0E,0x0C,0x0C,0x0C,0x1E,0x00}, // 69 i
  118. {0x18,0x00,0x1E,0x18,0x18,0x18,0x1B,0x0E}, // 6A j
  119. {0x07,0x06,0x66,0x36,0x1E,0x36,0x67,0x00}, // 6B k
  120. {0x0E,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00}, // 6C l
  121. {0x00,0x00,0x37,0x7F,0x6B,0x63,0x63,0x00}, // 6D m
  122. {0x00,0x00,0x1F,0x33,0x33,0x33,0x33,0x00}, // 6E n
  123. {0x00,0x00,0x1E,0x33,0x33,0x33,0x1E,0x00}, // 6F o
  124. {0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x0F}, // 70 p
  125. {0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x78}, // 71 q
  126. {0x00,0x00,0x1B,0x36,0x36,0x06,0x0F,0x00}, // 72 r
  127. {0x00,0x00,0x3E,0x03,0x1E,0x30,0x1F,0x00}, // 73 s
  128. {0x08,0x0C,0x3E,0x0C,0x0C,0x2C,0x18,0x00}, // 74 t
  129. {0x00,0x00,0x33,0x33,0x33,0x33,0x6E,0x00}, // 75 u
  130. {0x00,0x00,0x33,0x33,0x33,0x1E,0x0C,0x00}, // 76 v
  131. {0x00,0x00,0x63,0x63,0x6B,0x7F,0x36,0x00}, // 77 w
  132. {0x00,0x00,0x63,0x36,0x1C,0x36,0x63,0x00}, // 78 x
  133. {0x00,0x00,0x33,0x33,0x33,0x3E,0x30,0x1F}, // 79 y
  134. {0x00,0x00,0x3F,0x19,0x0C,0x26,0x3F,0x00}, // 7A z
  135. {0xf8, 0xfc, 0x0c, 0x07, 0x07, 0x0c, 0xfc, 0xf8}, // 7B {
  136. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, // 7C |
  137. {0x1f, 0x3f, 0x30, 0xe0, 0xe0, 0x30, 0x3f, 0x1f}, // 7D }
  138. {0x00, 0x04, 0x0e, 0x0b, 0x99, 0xd0, 0x70, 0x20}, // 7E ~
  139. };