Skip to content

Commit

Permalink
#393 start with VCOM measuring example
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Jan 26, 2025
1 parent aad8e95 commit 0c8a4af
Show file tree
Hide file tree
Showing 12 changed files with 32,605 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/vcom-kickback/CMakeLists.txt
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)
7 changes: 7 additions & 0 deletions examples/vcom-kickback/README.md
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
3 changes: 3 additions & 0 deletions examples/vcom-kickback/main/CMakeLists.txt
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)
30,942 changes: 30,942 additions & 0 deletions examples/vcom-kickback/main/dragon.h

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions examples/vcom-kickback/main/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* 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 "dragon.h"
#include "epd_highlevel.h"
#include "epdiy.h"
#include "board/tps65185.h"

EpdiyHighlevelState hl;

// 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
int temperature = 25;
EpdRect dragon_area = { .x = 0, .y = 0, .width = dragon_width, .height = dragon_height };

void idf_loop() {
epd_fullclear(&hl, temperature);
epd_copy_to_framebuffer(dragon_area, dragon_data, epd_hl_get_framebuffer(&hl));
// Supposedly to measure VCOM the display needs to update
// all the time with a NULL waveform (That we don't know how it is)
// MODE_GC16 or MODE_DU ?
//epd_fill_rect(epd_full_screen(), 0, epd_hl_get_framebuffer(&hl));
epd_hl_update_screen(&hl, MODE_DU, temperature);

tps_vcom_kickback_rdy();
vTaskDelay(20);
/*
epd_fill_rect(epd_full_screen(), 255, epd_hl_get_framebuffer(&hl));
epd_hl_update_screen(&hl, MODE_GC16, temperature);
vTaskDelay(100); */
}

void idf_setup() {
epd_init(&DEMO_BOARD, &ED097TC2, EPD_LUT_64K);
hl = epd_hl_init(EPD_BUILTIN_WAVEFORM);


tps_vcom_kickback();
tps_vcom_kickback_start();

while ( 1 ) {
idf_loop();
}
}

#ifndef ARDUINO_ARCH_ESP32
void app_main() {
idf_setup();
}
#endif
30 changes: 30 additions & 0 deletions examples/vcom-kickback/main/main.ino
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.
Loading

0 comments on commit 0c8a4af

Please sign in to comment.