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

78 add gdew0102I4FC GOODISPLAY small epapers and rebase master #79

Merged
merged 54 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9d566dc
Prepare for IDF version 5
martinberlin Aug 23, 2022
dc55948
IDF v5 did not like that we use IoInterface
martinberlin Aug 23, 2022
6f07690
BLE first try with 4 grays
martinberlin Sep 2, 2022
2c5aaeb
BLE correct nibbles
martinberlin Sep 2, 2022
f761ed0
Remove epdiy as REQUIRES component
martinberlin Oct 21, 2022
360534c
IDF v5 painful corrections. Also do not extend IoInterface otherwise:…
martinberlin Oct 21, 2022
83cb418
Add demo IOs for https://www.tindie.com/stores/fasani/ CINWRITE
martinberlin Oct 23, 2022
8181796
CalEPD add new printerf
martinberlin Oct 25, 2022
84694c1
#66 gdey073d46 Class working
martinberlin Oct 27, 2022
2aa9668
#66 Correct 7 color wifi download
martinberlin Oct 27, 2022
6826b34
Merge pull request #67 from martinberlin/66/gdey073d46
martinberlin Oct 27, 2022
4bef0e4
#62 IDF ver. 5 corrections
martinberlin Oct 27, 2022
3b0a6be
#68 Start adding gdey0213b74
martinberlin Oct 28, 2022
cdcee22
#68 Optimize SPI sending whole row
martinberlin Oct 28, 2022
6b075eb
#68 Partial out but 50 pix y shifted
martinberlin Oct 28, 2022
9f51ed6
#68 Start with 4 grays mode
martinberlin Oct 28, 2022
a8ae801
#68 GDEY0213 still searching for gray
martinberlin Oct 29, 2022
bcd9897
#68 gdey0213b74 0x22 Modes for gray
martinberlin Oct 29, 2022
6403911
#68 Add provisionary LUT for 4 gray mode in gdey0213b74
martinberlin Oct 30, 2022
51b899f
New gdey0154d67 display implemented
martinberlin Oct 30, 2022
be0e9ad
Add gdey0154d67 class
martinberlin Oct 30, 2022
87a03b0
gdey0154d67 remove full update LUT
martinberlin Oct 30, 2022
757f87b
gdey0154d67 demo with SPI optimization (is 100ms faster)
martinberlin Oct 31, 2022
c91c07f
gdey0154d67 4 gray mode implemented
martinberlin Oct 31, 2022
b46eacd
#68 Add working 4 gray mode
martinberlin Oct 31, 2022
d77c9c8
#68 Closer to get updateWindow working, my lord?
martinberlin Oct 31, 2022
1c2f599
#68 No way to fix updateWindow in 2nd get wrong Y
martinberlin Oct 31, 2022
674c18c
Add new method available to all display.printerf("%x", args)
martinberlin Nov 2, 2022
ff1446b
#69 Add new class gdeq042Z21 based on gdew04Z21
martinberlin Nov 3, 2022
fd75b0e
#70 gdey029T94 mono & 4 gray added
martinberlin Nov 6, 2022
7e72de8
#70 Getting better partial update
martinberlin Nov 8, 2022
235a2d6
#70 Get rotation right!
martinberlin Nov 8, 2022
91a8f59
#70 Fix also 4 gray mode
martinberlin Nov 8, 2022
06c6dd7
#68 Fixes partial update for gdey0213b74
martinberlin Nov 8, 2022
87feb15
gdey0154d67 partialWindow corrections but still comes out darkgray
martinberlin Nov 8, 2022
6e0248f
gdey0154d67 partialWindow fix gray update
martinberlin Nov 8, 2022
bd05d15
#71 Add goodisplay/gdey029T94
martinberlin Nov 10, 2022
cd4518e
Merge branch 'develop' into idf_v5
martinberlin Nov 10, 2022
27c2faa
Merge pull request #62 from martinberlin/idf_v5
martinberlin Nov 10, 2022
62a23b5
Fixes after idf_v5 merge
martinberlin Nov 10, 2022
14cc534
#66 Switch GDEY073D46 to use PSRAM
martinberlin Nov 11, 2022
c4d07e3
Exclude parallel CPP classes if CALEPD_EXCLUDE_PARALLEL is defined
martinberlin Nov 15, 2022
b455e4d
Update new models removing rtc_wdt_feed
martinberlin Nov 17, 2022
27ff4a9
Fix touch for IDF>=4.4
martinberlin Nov 17, 2022
042c0a5
#72 Get rid of Printable dependency
martinberlin Nov 18, 2022
c349d86
#71 goodisplay/touch/gdey027T91T class
martinberlin Nov 19, 2022
3742950
Cleanup GDEW042T2, needs further Partial update corrections
martinberlin Nov 21, 2022
6026e8f
GDEW042T2 best waveform for partial update could find
martinberlin Nov 21, 2022
89ed7b0
Merge branch 'master' into develop
martinberlin Nov 22, 2022
8330f9b
Update fontconvert to latest version
martinberlin Dec 2, 2022
4ebbbff
Simple ON/OFF switch with touch
martinberlin Dec 16, 2022
d4fad9e
Add more tinypico example configs
martinberlin Jan 1, 2023
dcf8e0b
#78 gdew0102I4FC added
martinberlin Jan 11, 2023
27ea2bd
Merge branch 'master' into 78/small
martinberlin Jan 11, 2023
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
Binary file modified components/Adafruit-GFX/fontconvert/fontconvert
Binary file not shown.
419 changes: 216 additions & 203 deletions components/Adafruit-GFX/fontconvert/fontconvert.c

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions components/CalEPD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ set(srcs
"models/gdeh0154d67.cpp"
"models/heltec0151.cpp"

# SMALL epapers
"models/small/gdew0102I4FC.cpp"

# 3 colors Goodisplay
"models/color/gdeh0154z90.cpp"
"models/color/gdew0583z21.cpp"
Expand Down
51 changes: 51 additions & 0 deletions components/CalEPD/include/small/gdew0102I4FC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Product page: https://www.good-display.com/product/341.html
// 1.02 mono Controller: UC8175
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "esp_system.h"
#include <stdint.h>
#include <math.h>
#include "sdkconfig.h"
#include "esp_log.h"
#include <string>
#include <epd.h>
#include <Adafruit_GFX.h>
#include <epdspi.h>
#include <gdew_4grays.h>
#include <esp_timer.h>

#define GDEW0102I4FC_WIDTH 80
#define GDEW0102I4FC_HEIGHT 128
#define GDEW0102I4FC_BUFFER_SIZE (uint32_t(GDEW0102I4FC_WIDTH) * uint32_t(GDEW0102I4FC_HEIGHT) / 8)

#define GDEW0102I4FC_8PIX_BLACK 0x00
#define GDEW0102I4FC_8PIX_WHITE 0xFF

class Gdew0102I4FC : public Epd
{
public:
// & Copy contructor: Copying the injected IO into our class so we can access IO methods
Gdew0102I4FC(EpdSpi& IO);
uint8_t colors_supported = 1;

// EPD tests
void init(bool debug = false);
void drawPixel(int16_t x, int16_t y, uint16_t color); // Override GFX own drawPixel method

void fillScreen(uint16_t color);
void update();

private:
EpdSpi& IO;

uint8_t _black_buffer[GDEW0102I4FC_BUFFER_SIZE];

bool _initial = true;

void _wakeUp();
void _sleep();
void _waitBusy(const char* message);
void _rotate(uint16_t& x, uint16_t& y, uint16_t& w, uint16_t& h);
};
188 changes: 188 additions & 0 deletions components/CalEPD/models/small/gdew0102I4FC.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
#include "small/gdew0102I4FC.h"
#include <stdio.h>
#include <stdlib.h>
#include "esp_log.h"
#include "freertos/task.h"
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>

// Constructor
Gdew0102I4FC::Gdew0102I4FC(EpdSpi& dio):
Adafruit_GFX(GDEW0102I4FC_WIDTH, GDEW0102I4FC_HEIGHT),
Epd(GDEW0102I4FC_WIDTH, GDEW0102I4FC_HEIGHT), IO(dio)
{
printf("Gdew0102I4FC() constructor injects IO and extends Adafruit_GFX(%d,%d)\n",
GDEW0102I4FC_WIDTH, GDEW0102I4FC_HEIGHT);
}

//Initialize the display
void Gdew0102I4FC::init(bool debug)
{
debug_enabled = debug;
if (debug_enabled) printf("Gdew0102I4FC::init(%d) and reset EPD\n", debug);
//Initialize the Epaper and reset it
IO.init(4, debug); // 4MHz frequency, debug

//Reset the display
IO.reset(20);
//setModel("GDEW042C37"); // Can be commented and set from your app_main()
fillScreen(EPD_WHITE);
}


void Gdew0102I4FC::_wakeUp(){

IO.reset(10);

IO.cmd(0x00); // Panel setting
IO.data(0x5f); // OTP

IO.cmd(0x2A);
IO.data(0x00);
IO.data(0x00);

IO.cmd(0x04); //Power on
_waitBusy("epd_wakeup");; //waiting for the electronic paper IC to release the idle signal

IO.cmd(0x50); //Solve some black paper black border problems
IO.data(0x97);
}

void Gdew0102I4FC::_waitBusy(const char* message){
if (debug_enabled) {
ESP_LOGI(TAG, "_waitBusy for %s", message);
}
int64_t time_since_boot = esp_timer_get_time();

while (1){
if (gpio_get_level((gpio_num_t)CONFIG_EINK_BUSY) == 1) break;
vTaskDelay(1);
if (esp_timer_get_time()-time_since_boot>2000000)
{
if (debug_enabled) ESP_LOGI(TAG, "Busy Timeout");
break;
}
}
}

void Gdew0102I4FC::_sleep(){
IO.cmd(0X50); //VCOM AND DATA INTERVAL SETTING
IO.data(0xf7);

IO.cmd(0X02); //power off
_waitBusy("power off");
IO.cmd(0X07); //deep sleep
IO.data(0xA5);
}

void Gdew0102I4FC::_rotate(uint16_t& x, uint16_t& y, uint16_t& w, uint16_t& h)
{
switch (getRotation())
{
case 1:
swap(x, y);
swap(w, h);
x = GDEW0102I4FC_WIDTH - x - w - 1;
break;
case 2:
x = GDEW0102I4FC_WIDTH - x - w - 1;
y = GDEW0102I4FC_HEIGHT - y - h - 1;
break;
case 3:
swap(x, y);
swap(w, h);
y = GDEW0102I4FC_HEIGHT - y - h - 1;
break;
}
}

void Gdew0102I4FC::update()
{
uint64_t startTime = esp_timer_get_time();
_using_partial_mode = false;
_wakeUp();


// BLACK: Write RAM for black(0)/white (1)
// v2 SPI optimizing. Check: https://github.com/martinberlin/cale-idf/wiki/About-SPI-optimization
uint16_t i = 0;
uint8_t xLineBytes = GDEW0102I4FC_WIDTH/8;
uint8_t x1buf[xLineBytes];

// Note that in IC specs is 0x10 old data (?) and 0x13 new
IO.cmd(0x10);
uint8_t full_buff[GDEW0102I4FC_BUFFER_SIZE];
for(uint16_t y = 0; y < GDEW0102I4FC_BUFFER_SIZE; y++) {
full_buff[y] = 0xFF;
}
IO.data(full_buff, GDEW0102I4FC_BUFFER_SIZE);

// BLACK new data: Write RAM
IO.cmd(0x13);
for(uint16_t y = 1; y <= GDEW0102I4FC_HEIGHT; y++) {
for(uint16_t x = 1; x <= xLineBytes; x++) {
uint8_t data = i < sizeof(_black_buffer) ? _black_buffer[i] : GDEW0102I4FC_8PIX_WHITE;
x1buf[x-1] = data;
if (x==xLineBytes) { // Flush the X line buffer to SPI
IO.data(x1buf,sizeof(x1buf));
}
++i;
}
}

uint64_t endTime = esp_timer_get_time();
IO.cmd(0x12); //DISPLAY REFRESH

_waitBusy("epaper refresh");
uint64_t powerOnTime = esp_timer_get_time();

printf("\n\nSTATS (ms)\n%llu _wakeUp settings+send Buffer\n%llu _powerOn\n%llu total time in millis\n",
(endTime-startTime)/1000, (powerOnTime-endTime)/1000, (powerOnTime-startTime)/1000);

_sleep();
}

void Gdew0102I4FC::drawPixel(int16_t x, int16_t y, uint16_t color) {
if ((x < 0) || (x >= width()) || (y < 0) || (y >= height())) return;
switch (getRotation())
{
case 1:
swap(x, y);
x = GDEW0102I4FC_WIDTH - x - 1;
break;
case 2:
x = GDEW0102I4FC_WIDTH - x - 1;
y = GDEW0102I4FC_HEIGHT - y - 1;
break;
case 3:
swap(x, y);
y = GDEW0102I4FC_HEIGHT - y - 1;
break;
}
uint16_t i = x / 8 + y * GDEW0102I4FC_WIDTH / 8;

if (!color) {
_black_buffer[i] = (_black_buffer[i] & (0xFF ^ (1 << (7 - x % 8))));
} else {
_black_buffer[i] = (_black_buffer[i] | (1 << (7 - x % 8)));
}
}


void Gdew0102I4FC::fillScreen(uint16_t color)
{
// Fill screen will be inverted with the way is done NOW
uint8_t fill = GDEW0102I4FC_8PIX_WHITE;

if (color == EPD_BLACK) {
fill = GDEW0102I4FC_8PIX_BLACK;
}

for (uint16_t x = 0; x < sizeof(_black_buffer); x++)
{
_black_buffer[x] = fill;
}

if (debug_enabled) printf("fillScreen(%x) black len:%d\n", fill, sizeof(_black_buffer));
}
Loading