diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-11-01 19:41:57 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-11-01 19:41:57 +0100 |
commit | bd2b2541a7b00a2520ea5a3eabcb90a0bbb35b28 (patch) | |
tree | 6729d6528abc4a295531ad304f92bde5a72bb294 /src/app/pervasive-aurora-mb-bad-apple/main.cc | |
parent | 8668036aeab09b580d19b1113c1ba5450637ccfc (diff) |
add pervasive aurora mb bad apple (not really working yet)
Diffstat (limited to 'src/app/pervasive-aurora-mb-bad-apple/main.cc')
-rw-r--r-- | src/app/pervasive-aurora-mb-bad-apple/main.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/app/pervasive-aurora-mb-bad-apple/main.cc b/src/app/pervasive-aurora-mb-bad-apple/main.cc new file mode 100644 index 0000000..a302c33 --- /dev/null +++ b/src/app/pervasive-aurora-mb-bad-apple/main.cc @@ -0,0 +1,67 @@ +/* + * Copyright 2021 Daniel Friesel + * + * SPDX-License-Identifier: BSD-2-Clause + */ +#include "arch.h" +#include "driver/gpio.h" +#include "driver/stdout.h" +#include "driver/spi.h" +#include "driver/pervasive_aurora_mb.h" +#include "object/framebuffer.h" +#include "lib/inflate.h" + +#include "driver/timer.h" +volatile unsigned char timer_done = 0; + +#include "frames.cc" + +__attribute__((section(".leaRAM"))) unsigned char img_buf[160 * 120 / 8]; + +/* + * Flashless Update isn't working properly yet. Black-to-white transitions + * appear to be pretty much broken (or rather, nearly invisible). + * Or I broke my display, who knows. + */ + +int main(void) +{ + unsigned int i = 0; + unsigned char line; + arch.setup(); + gpio.setup(); + kout.setup(); + spi.setup(); + pervasiveAuroraMb.setup(); + + timer.setup_hz_low(frame_rate); + + while (1) { + for (i = 0; i < (sizeof(frames) / sizeof(frames[0])); i++) { + + timer_done = 0; + timer.start(1); + + inflate(frames[i], sizeof(img_buf), img_buf, sizeof(img_buf)); + fb.clear(); + fb.drawAt(0, 0, 160, 120, img_buf); + + pervasiveAuroraMb.powerOn(); + pervasiveAuroraMb.initialize(20, i%20); + pervasiveAuroraMb.sendImage((unsigned char*)fb.data, 0, 0, 160, 120); + pervasiveAuroraMb.sendUpdate(); + pervasiveAuroraMb.powerOff(); + + while (!timer_done) { + arch.idle(); + } + timer.stop(); + } + } + + return 0; +} + +ON_TIMER_INTERRUPT_head + timer_done = 1; +ON_TIMER_INTERRUPT_tail |