diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-02-12 17:32:48 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-02-12 17:32:48 +0100 |
commit | 5db1ecd3fc2ab0c7942476bae07e57be66e7689c (patch) | |
tree | 30a0a75949c9dd27992f84da481be5d7d35d0fd0 /src/app/bad-apple-stm32f4-ssd1306-128x64/main.cc | |
parent | 3fffef85de0b780eb26beef5625242355053e872 (diff) |
Add Bad Apple on STM32F4 (WiP; timer is still missing)
Diffstat (limited to 'src/app/bad-apple-stm32f4-ssd1306-128x64/main.cc')
-rw-r--r-- | src/app/bad-apple-stm32f4-ssd1306-128x64/main.cc | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/app/bad-apple-stm32f4-ssd1306-128x64/main.cc b/src/app/bad-apple-stm32f4-ssd1306-128x64/main.cc new file mode 100644 index 0000000..7e26dd6 --- /dev/null +++ b/src/app/bad-apple-stm32f4-ssd1306-128x64/main.cc @@ -0,0 +1,85 @@ +/* + * Copyright 2024 Birte Kristina Friesel + * + * SPDX-License-Identifier: BSD-2-Clause + */ +#include "arch.h" +#include "driver/gpio.h" +#include "driver/stdout.h" + +#if defined(CONFIG_meta_driver_hardware_i2c) +#include "driver/i2c.h" +#elif defined(CONFIG_driver_softi2c) +#include "driver/soft_i2c.h" +#endif + +#include "driver/ssd1306.h" +#include "lib/inflate.h" + +//#include "driver/timer.h" +//volatile unsigned char timer_done = 0; + +#include "frames.cc" + +unsigned char img_buf[(SSD1306_WIDTH * SSD1306_HEIGHT / 8) * 3]; + +int main(void) +{ + unsigned int i = 0; + unsigned char line; + arch.setup(); + gpio.setup(); + kout.setup(); + i2c.setup(); + ssd1306.init(); + + //timer.setup_hz(frame_rate); + + while (1) { + for (i = 0; i < (sizeof(frames) / sizeof(frames[0])); i++) { + + //timer_done = 0; + //timer.start(1); + + ssd1306.showImage(img_buf + (SSD1306_WIDTH * SSD1306_HEIGHT / 8 * 2), SSD1306_WIDTH * SSD1306_HEIGHT / 8); + arch.delay_ms(15); + + gpio.led_on(0); + inflate(frames[i], sizeof(img_buf), img_buf, sizeof(img_buf)); + gpio.led_off(0); + + //while (!timer_done) { + // arch.idle(); + // } + // timer.stop(); + + // timer_done = 0; + // timer.start(1); + + ssd1306.showImage(img_buf + (SSD1306_WIDTH * SSD1306_HEIGHT / 8 * 0), SSD1306_WIDTH * SSD1306_HEIGHT / 8); + arch.delay_ms(20); + + // while (!timer_done) { + // arch.idle(); + // } + // timer.stop(); + + // timer_done = 0; + // timer.start(1); + + ssd1306.showImage(img_buf + (SSD1306_WIDTH * SSD1306_HEIGHT / 8 * 1), SSD1306_WIDTH * SSD1306_HEIGHT / 8); + arch.delay_ms(20); + + // while (!timer_done) { + // arch.idle(); + // } + // timer.stop(); + } + } + + return 0; +} + +//ON_TIMER_INTERRUPT_head +// timer_done = 1; +//ON_TIMER_INTERRUPT_tail |