summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-01-13 20:55:39 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-01-13 20:55:39 +0100
commitfb3f9e22fa89200d9f540f2417a0ea4277a0fd96 (patch)
tree3f5305f2666f6e283bdb83d9ee7892051086ff4c
parent0e42a6028b7b9330ca69e4fbeeecfa3affa53346 (diff)
font test
-rw-r--r--font.h130
-rw-r--r--main.c16
2 files changed, 142 insertions, 4 deletions
diff --git a/font.h b/font.h
index d823b18..839277b 100644
--- a/font.h
+++ b/font.h
@@ -3,6 +3,8 @@
#include <avr/pgmspace.h>
+typedef const unsigned char* glyph_t;
+
const unsigned char PROGMEM chr_001[] = {0x08, 0x00, 0x20, 0x44, 0x40, 0x44, 0x20, 0x00, 0x00}; // happy smiley
const unsigned char PROGMEM chr_002[] = {0x08, 0x00, 0x40, 0x24, 0x20, 0x24, 0x40, 0x00, 0x00}; // sad smiley
const unsigned char PROGMEM chr_003[] = {0x05, 0x18, 0xEC, 0x5C, 0xEC, 0x18}; // skull
@@ -130,5 +132,133 @@ const unsigned char PROGMEM chr_124[] = {0x01, 0xFF}; // |
const unsigned char PROGMEM chr_125[] = {0x03, 0x82, 0x6C, 0x10}; // }
const unsigned char PROGMEM chr_126[] = {0x05, 0x10, 0x08, 0x10, 0x20, 0x10}; // ~
+const glyph_t font[] PROGMEM = {
+ chr_001,
+ chr_002,
+ chr_003,
+ chr_004,
+ chr_005,
+ chr_006,
+ chr_007,
+ chr_008,
+ chr_009,
+ chr_010,
+ chr_011,
+ chr_012,
+ chr_013,
+ chr_014,
+ chr_015,
+ chr_016,
+ chr_017,
+ chr_018,
+ chr_019,
+ chr_020,
+ chr_021,
+ chr_022,
+ chr_023,
+ chr_024,
+ chr_025,
+ chr_026,
+ chr_027,
+ chr_028,
+ chr_029,
+ chr_030,
+ chr_031,
+ chr_032,
+ chr_033,
+ chr_034,
+ chr_035,
+ chr_036,
+ chr_037,
+ chr_038,
+ chr_039,
+ chr_040,
+ chr_041,
+ chr_042,
+ chr_043,
+ chr_044,
+ chr_045,
+ chr_046,
+ chr_047,
+ chr_048,
+ chr_049,
+ chr_050,
+ chr_051,
+ chr_052,
+ chr_053,
+ chr_054,
+ chr_055,
+ chr_056,
+ chr_057,
+ chr_058,
+ chr_059,
+ chr_060,
+ chr_061,
+ chr_062,
+ chr_063,
+ chr_064,
+ chr_065,
+ chr_066,
+ chr_067,
+ chr_068,
+ chr_069,
+ chr_070,
+ chr_071,
+ chr_072,
+ chr_073,
+ chr_074,
+ chr_075,
+ chr_076,
+ chr_077,
+ chr_078,
+ chr_079,
+ chr_080,
+ chr_081,
+ chr_082,
+ chr_083,
+ chr_084,
+ chr_085,
+ chr_086,
+ chr_087,
+ chr_088,
+ chr_089,
+ chr_090,
+ chr_091,
+ chr_092,
+ chr_093,
+ chr_094,
+ chr_095,
+ chr_096,
+ chr_097,
+ chr_098,
+ chr_099,
+ chr_100,
+ chr_101,
+ chr_102,
+ chr_103,
+ chr_104,
+ chr_105,
+ chr_106,
+ chr_107,
+ chr_108,
+ chr_109,
+ chr_110,
+ chr_111,
+ chr_112,
+ chr_113,
+ chr_114,
+ chr_115,
+ chr_116,
+ chr_117,
+ chr_118,
+ chr_119,
+ chr_120,
+ chr_121,
+ chr_122,
+ chr_123,
+ chr_124,
+ chr_125,
+ chr_126
+};
#endif /* FONT_H_ */
diff --git a/main.c b/main.c
index e1f0fb8..3b8f0ef 100644
--- a/main.c
+++ b/main.c
@@ -8,7 +8,7 @@
#define SHUTDOWN_THRESHOLD 2048
-volatile uint8_t disp[32];
+volatile uint8_t disp[8];
int main (void)
{
@@ -34,8 +34,16 @@ int main (void)
// raise timer interrupt on counter overflow (-> interrupt frequency = ~4kHz)
TIMSK0 = _BV(TOIE0);
- //disp = font[2];
-#if 1
+ disp[0] = font[0][1];
+ disp[1] = font[0][2];
+ disp[2] = font[0][3];
+ disp[3] = font[0][4];
+ disp[4] = font[0][5];
+ disp[5] = font[0][6];
+ disp[6] = font[0][7];
+ disp[7] = font[0][8];
+
+#if 0
// smile!
disp[0] = 0x08;
disp[1] = 0x04;
@@ -139,7 +147,7 @@ ISR(TIMER0_OVF_vect)
uint8_t i;
- if (++scroll == 256) {
+ if (++scroll == 512) {
scroll = 0;
if (++disp_offset == sizeof(disp)) {
disp_offset = 0;