-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
22,477 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.16.0) | ||
set(EXTRA_COMPONENT_DIRS "../../components/") | ||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
project(dragon_example) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
A demo showing a Full-Screen Image | ||
================================== | ||
|
||
*The image size is chosen to fit a 1200 * 825 display!* | ||
|
||
Image by David REVOY / CC BY (https://creativecommons.org/licenses/by/3.0) | ||
https://commons.wikimedia.org/wiki/File:Durian_-_Sintel-wallpaper-dragon.jpg |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set(app_sources "main.c") | ||
|
||
idf_component_register(SRCS ${app_sources} REQUIRES epd_driver) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* Simple firmware for a ESP32 displaying a static image on an EPaper Screen. | ||
* | ||
* Write an image into a header file using a 3...2...1...0 format per pixel, | ||
* for 4 bits color (16 colors - well, greys.) MSB first. At 80 MHz, screen | ||
* clears execute in 1.075 seconds and images are drawn in 1.531 seconds. | ||
*/ | ||
|
||
#include "esp_heap_caps.h" | ||
#include "esp_log.h" | ||
#include "esp_timer.h" | ||
#include "esp_types.h" | ||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/task.h" | ||
#include "sdkconfig.h" | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include "epd_driver.h" | ||
#include "dragon.h" | ||
|
||
uint8_t *img_buf; | ||
|
||
void delay(uint32_t millis) { vTaskDelay(millis / portTICK_PERIOD_MS); } | ||
|
||
uint32_t millis() { return esp_timer_get_time() / 1000; } | ||
|
||
void loop() { | ||
epd_poweron(); | ||
epd_clear(); | ||
volatile uint32_t t1 = millis(); | ||
epd_draw_grayscale_image(epd_full_screen(), img_buf); | ||
volatile uint32_t t2 = millis(); | ||
printf("EPD draw took %dms.\n", t2 - t1); | ||
|
||
epd_poweroff(); | ||
|
||
delay(5000); | ||
} | ||
|
||
void epd_task() { | ||
epd_init(); | ||
|
||
while (1) { | ||
loop(); | ||
}; | ||
} | ||
|
||
void app_main() { | ||
// copy the image data to SRAM for faster display time | ||
img_buf = (uint8_t *)heap_caps_malloc(EPD_WIDTH * EPD_HEIGHT / 2, MALLOC_CAP_SPIRAM); | ||
if (img_buf == NULL) { | ||
ESP_LOGE("epd_task", "Could not allocate framebuffer in PSRAM!"); | ||
} | ||
|
||
memcpy(img_buf, dragon_data, EPD_WIDTH * EPD_HEIGHT / 2); | ||
heap_caps_print_heap_info(MALLOC_CAP_INTERNAL); | ||
heap_caps_print_heap_info(MALLOC_CAP_SPIRAM); | ||
|
||
xTaskCreatePinnedToCore(&epd_task, "epd task", 10000, NULL, 2, NULL, 1); | ||
} |
Oops, something went wrong.