-
Notifications
You must be signed in to change notification settings - Fork 190
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
1 parent
b3a8ffa
commit a7a9cba
Showing
14 changed files
with
2,662 additions
and
44 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 "../../") | ||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
project(color_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 |
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 epdiy) |
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,81 @@ | ||
/* Simple firmware for a ESP32 displaying a Color square in a DES epaper screen with CFA on top */ | ||
#include "esp_heap_caps.h" | ||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/task.h" | ||
|
||
|
||
#include "esp_sleep.h" | ||
#include <epdiy.h> | ||
#include "epd_highlevel.h" | ||
|
||
EpdiyHighlevelState hl; | ||
int temperature = 25; | ||
// Buffers | ||
uint8_t *fb; // EPD 2bpp buffer | ||
|
||
int color_test() { | ||
EpdRect epd_area = { | ||
.x = 0, | ||
.y = 0, | ||
.width = epd_width()/2, | ||
.height = epd_height() | ||
}; | ||
|
||
uint8_t color_of = 0; | ||
/** | ||
* @brief PATTERN | ||
* pix1 2 3 X | ||
* B G R row:1 | ||
* G R B row:2 | ||
* R B G row:3 | ||
*/ | ||
for (uint16_t y=1; y<epd_area.height; y++) { | ||
for (uint16_t x=1; x<epd_area.width; x++) { | ||
// x, y, r, g, b | ||
if (y < 560) { | ||
epd_draw_cpixel(x, y, x/10, color_of, color_of, hl.front_fb); | ||
} else if (y >= 560 && y < 1120) { | ||
epd_draw_cpixel(x, y, color_of, x/10, color_of, hl.front_fb); | ||
} else { | ||
epd_draw_cpixel(x, y, color_of, color_of, x/10, hl.front_fb); | ||
} | ||
} | ||
vTaskDelay(1); | ||
} | ||
|
||
enum EpdDrawError _err = epd_hl_update_screen(&hl, MODE_GC16, temperature); | ||
epd_poweroff(); | ||
return _err; | ||
} | ||
|
||
// Deepsleep | ||
#define DEEP_SLEEP_SECONDS 300 | ||
uint64_t USEC = 1000000; | ||
int getFreePsram(){ | ||
multi_heap_info_t info; | ||
heap_caps_get_info(&info, MALLOC_CAP_SPIRAM); | ||
return info.total_free_bytes; | ||
} | ||
|
||
#ifndef ARDUINO_ARCH_ESP32 | ||
void app_main() { | ||
printf("before epd_init() Free PSRAM: %d\n", getFreePsram()); | ||
|
||
epd_init(&epd_board_v7, &epdiy_GDEW101C01, EPD_LUT_64K); | ||
// Set VCOM for boards that allow to set this in software (in mV). | ||
epd_set_vcom(1560); | ||
hl = epd_hl_init(EPD_BUILTIN_WAVEFORM); | ||
fb = epd_hl_get_framebuffer(&hl); | ||
printf("after epd_hl_init() Free PSRAM: %d\n", getFreePsram()); | ||
|
||
|
||
epd_poweron(); | ||
color_test(); | ||
printf("color example\n"); | ||
|
||
vTaskDelay(pdMS_TO_TICKS(5000)); | ||
esp_sleep_enable_timer_wakeup(DEEP_SLEEP_SECONDS * USEC); | ||
esp_deep_sleep_start(); | ||
} | ||
|
||
#endif |
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
Oops, something went wrong.