-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MODE_PACKING_8PPB example for Discussions
- Loading branch information
1 parent
a63ff7d
commit 69b8063
Showing
10 changed files
with
34,024 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 "../../") | ||
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 |
Loading
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 epdiy) |
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,83 @@ | ||
/* Simple firmware for a ESP32 displaying a static image on an EPaper Screen */ | ||
|
||
#include "esp_heap_caps.h" | ||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/task.h" | ||
|
||
#include <string.h> // memset | ||
#include "dragon.h" | ||
#include "epd_highlevel.h" | ||
#include "epdiy.h" | ||
|
||
EpdiyHighlevelState hl; | ||
// The epdiy framebuffer that is sent to the render engine | ||
uint8_t * framebuffer; | ||
|
||
// MODE_PACKING_8PPB does nothing (Want to intent using 8BPP) | ||
// MODE_DU only monochrome no grays (But still 4BPP) | ||
// MODE_GC16 grays "slow mode" (4BPP) | ||
int draw_mode = MODE_PACKING_8PPB; | ||
|
||
// choose the default demo board depending on the architecture | ||
#ifdef CONFIG_IDF_TARGET_ESP32 | ||
#define DEMO_BOARD epd_board_v6 | ||
#elif defined(CONFIG_IDF_TARGET_ESP32S3) | ||
#define DEMO_BOARD epd_board_v7 | ||
#endif | ||
|
||
void idf_loop() { | ||
EpdRect dragon_area = | ||
{.x = 0, .y = 0, | ||
.width = dragon_width, | ||
.height = dragon_height}; | ||
|
||
int temperature = 25; | ||
|
||
epd_poweron(); | ||
epd_fullclear(&hl, temperature); | ||
framebuffer = epd_hl_get_framebuffer(&hl); | ||
|
||
//epd_copy_to_framebuffer(dragon_area, dragon_data, epd_hl_get_framebuffer(&hl)); | ||
epd_copy_to_framebuffer(dragon_area, dragon_data, framebuffer); | ||
// NOW Let's draw over and on top of Dragon image a full 10x black lines | ||
for (int y = 0; y < 10; y++) { | ||
switch (draw_mode) | ||
{ | ||
case 1: | ||
/* MODE_DU 4PPB */ | ||
memset(&framebuffer[y*epd_width()/2], 0x00, epd_width()/2); | ||
break; | ||
|
||
default: | ||
/* MODE_DU 8PPB */ | ||
memset(&framebuffer[y*epd_width()/8], 0x00, epd_width()/8); | ||
break; | ||
} | ||
} | ||
/** | ||
* @brief EXPECTED: Setting full 3 lines to 0x00 it should draw it on display. | ||
* RESULT : Draws nothing in MODE_PACKING_8PPB | ||
* RESULT : Draws OK 10 black lines in MODE_DU & MODE_GC16 | ||
*/ | ||
|
||
enum EpdDrawError _err = epd_hl_update_screen(&hl, draw_mode, temperature); | ||
epd_poweroff(); | ||
|
||
vTaskDelay(50000); | ||
} | ||
|
||
void idf_setup() { | ||
epd_init(&DEMO_BOARD, &ED060XC3, EPD_LUT_1K); | ||
epd_set_vcom(1560); | ||
hl = epd_hl_init(EPD_BUILTIN_WAVEFORM); | ||
} | ||
|
||
#ifndef ARDUINO_ARCH_ESP32 | ||
void app_main() { | ||
idf_setup(); | ||
|
||
while (1) { | ||
idf_loop(); | ||
}; | ||
} | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* This is the Arduino wrapper for the "Demo" example. | ||
* Please go to the main.c for the main example file. | ||
* | ||
* This example was developed for the ESP IoT Development Framework (IDF). | ||
* You can still use this code in the Arduino IDE, but it may not look | ||
* and feel like a classic Arduino sketch. | ||
* If you are looking for an example with Arduino look-and-feel, | ||
* please check the other examples. | ||
*/ | ||
|
||
// Important: These are C functions, so they must be declared with C linkage! | ||
extern "C" { | ||
void idf_setup(); | ||
void idf_loop(); | ||
} | ||
|
||
void setup() { | ||
if (psramInit()) { | ||
Serial.println("\nThe PSRAM is correctly initialized"); | ||
} else { | ||
Serial.println("\nPSRAM does not work"); | ||
} | ||
|
||
idf_setup(); | ||
} | ||
|
||
void loop() { | ||
idf_loop(); | ||
} |
Empty file.
Oops, something went wrong.