summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-01-13 20:39:04 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-01-13 20:39:04 +0100
commit0e42a6028b7b9330ca69e4fbeeecfa3affa53346 (patch)
tree17adb3434b0b90ed3b08990c39c7599819c2f654
parent06d8fe27274bd4300322d24b4ed87da6f22eafee (diff)
main: prepare for non-static display buffer
-rw-r--r--main.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/main.c b/main.c
index 6bfabe1..e1f0fb8 100644
--- a/main.c
+++ b/main.c
@@ -4,6 +4,8 @@
#include <util/delay.h>
#include <stdlib.h>
+#include "font.h"
+
#define SHUTDOWN_THRESHOLD 2048
volatile uint8_t disp[32];
@@ -32,6 +34,8 @@ int main (void)
// raise timer interrupt on counter overflow (-> interrupt frequency = ~4kHz)
TIMSK0 = _BV(TOIE0);
+ //disp = font[2];
+#if 1
// smile!
disp[0] = 0x08;
disp[1] = 0x04;
@@ -65,6 +69,7 @@ int main (void)
disp[29] = 0x00;
disp[30] = 0x00;
disp[31] = 0x00;
+#endif
sei();
@@ -130,23 +135,27 @@ ISR(TIMER0_OVF_vect)
static uint16_t scroll = 0;
static uint8_t disp_offset = 0;
- uint8_t buffer_col;
+ static uint8_t display[8];
+
+ uint8_t i;
if (++scroll == 256) {
scroll = 0;
if (++disp_offset == sizeof(disp)) {
disp_offset = 0;
}
- }
- buffer_col = (disp_offset + active_col) % sizeof(disp);
+ for (i = 0; i < 8; i++) {
+ display[i] = ~disp[(disp_offset + i) % sizeof(disp)];
+ }
+ }
/*
* To avoid flickering, do not put any code (or expensive index
* calculations) between the following three lines.
*/
PORTB = 0;
- PORTD = ~disp[buffer_col];
+ PORTD = display[active_col];
PORTB = _BV(active_col);
if (++active_col == 8)