Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#393 Implement kickback voltage readings #395

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Displays
|ED047TC1|4.7"|960 x 540<br>234 PPI|yes, tested|40-pin|40|LILYGO 4.7" EPD|Supported only by 4.7" e-paper board by LILYGO
| ED050SC5 | 5" | 600 x 800<br>200 PPI | yes, tested | THD0510-33CL-GF | 33 | v5 |
| ED050SC3 | 5" | 600 x 800<br>200 PPI | yes (should work) | THD0510-33CL-GF | 33 | v5 |
| ED052TC4 | 5.2" | 1280 x 780<br>??? PPI | yes (should work) | WP27D-P050VA3 | 50 | v5 |
| ED133UT2 | 13.3" | 1600 x 1200<br>150 PPI | yes, tested | adapter board | 39 | v2 | Adapter Board required, also PENG133D
| ED060XC3 | 6" | 758 x 1024<br>212 PPI | yes, tested | THD0515-34CL-SN | 34 | v5 | Cheapest, good contrast and resolution
| ED060XD4 | 6" | 758 x 1024<br>212 PPI | yes, tested | THD0515-34CL-SN | 34 | v5 |
Expand Down
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.

68 changes: 68 additions & 0 deletions examples/vcom-kickback/main/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* 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 "esp_log.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;

void draw_dragon() {
EpdRect dragon_area = { .x = 0, .y = 0, .width = dragon_width, .height = dragon_height };
epd_poweron();
epd_fullclear(&hl, temperature);
epd_copy_to_framebuffer(dragon_area, dragon_data, epd_hl_get_framebuffer(&hl));
enum EpdDrawError _err = epd_hl_update_screen(&hl, MODE_GC16, temperature);
epd_poweroff();
}

void idf_loop() {
// make a full black | white print to force epdiy to send the update
epd_fill_rect(epd_full_screen(), 0, epd_hl_get_framebuffer(&hl));
epd_hl_update_screen(&hl, MODE_DU, temperature);
vTaskDelay(pdMS_TO_TICKS(1));
epd_fill_rect(epd_full_screen(), 255, epd_hl_get_framebuffer(&hl));
epd_hl_update_screen(&hl, MODE_DU, temperature);
}

void idf_setup() {
epd_init(&DEMO_BOARD, &ED097TC2, EPD_LUT_64K);
hl = epd_hl_init(&epdiy_NULL);
// starts the board in kickback more
tps_vcom_kickback();

// display starts to pass BLACK to WHITE but doing nothing+
// dince the NULL waveform is full of 0 "Do nothing for each pixel"
idf_loop();
// start measure and set ACQ bit:
tps_vcom_kickback_start();
int isrdy = 1;
int kickback_volt = 0;
while (kickback_volt == 0) {
idf_loop();
isrdy++;
kickback_volt = tps_vcom_kickback_rdy();
}
ESP_LOGI("vcom", "readings are of %d mV. It was ready in %d refreshes", kickback_volt, isrdy);

vTaskDelay(pdMS_TO_TICKS(2000));
esp_restart();
}

#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