Comments (6)
It seems that your codes are written for 2.13inch e-Paper (B). However, the 2.13inch e-Paper (B) doesn't support partial refresh.
from e-paper.
@zerulin Okay, tried implementing the full frame refresh method
#include "spi.h"
#include <util/delay.h>
#include <avr/pgmspace.h>
// Display resolution
#define EPDWIDTH 104
#define EPDHEIGHT 212
#define IF_INVERT_COLOR 0
// EPD2IN13B commands
#define PANEL_SETTING 0x00
#define POWER_SETTING 0x01
#define POWER_OFF 0x02
#define POWER_OFF_SEQUENCE_SETTING 0x03
#define POWER_ON 0x04
#define POWER_ON_MEASURE 0x05
#define BOOSTER_SOFT_START 0x06
#define DEEP_SLEEP 0x07
#define DATA_START_TRANSMISSION_1 0x10
#define DATA_STOP 0x11
#define DISPLAY_REFRESH 0x12
#define DATA_START_TRANSMISSION_2 0x13
#define VCOM_LUT 0x20
#define W2W_LUT 0x21
#define B2W_LUT 0x22
#define W2B_LUT 0x23
#define B2B_LUT 0x24
#define PLL_CONTROL 0x30
#define TEMPERATURE_SENSOR_CALIBRATION 0x40
#define TEMPERATURE_SENSOR_SELECTION 0x41
#define TEMPERATURE_SENSOR_WRITE 0x42
#define TEMPERATURE_SENSOR_READ 0x43
#define VCOM_AND_DATA_INTERVAL_SETTING 0x50
#define LOW_POWER_DETECTION 0x51
#define TCON_SETTING 0x60
#define RESOLUTION_SETTING 0x61
#define GET_STATUS 0x71
#define AUTO_MEASURE_VCOM 0x80
#define READ_VCOM_VALUE 0x81
#define VCM_DC_SETTING 0x82
#define PARTIAL_WINDOW 0x90
#define PARTIAL_IN 0x91
#define PARTIAL_OUT 0x92
#define PROGRAM_MODE 0xA0
#define ACTIVE_PROGRAM 0xA1
#define READ_OTP_DATA 0xA2
#define POWER_SAVING 0xE3
/*
unsigned char epaper_get_image(int width) {
return malloc(8*width);
}*/
void epaper_draw_absolute_pixel(unsigned char* image, int x, int y, int colored) {
if (x < 0 || x >= EPDWIDTH || y < 0 || y >= EPDHEIGHT) {
return;
}
if (IF_INVERT_COLOR) {
if (colored) {
image[(x + y * EPDWIDTH) / 8] |= 0x80 >> (x % 8);
} else {
image[(x + y * EPDWIDTH) / 8] &= ~(0x80 >> (x % 8));
}
} else {
if (colored) {
image[(x + y * EPDWIDTH) / 8] &= ~(0x80 >> (x % 8));
} else {
image[(x + y * EPDWIDTH) / 8] |= 0x80 >> (x % 8);
}
}
}
void send_command(unsigned char command) {
PORTB &= ~(1 << PINB1);
send_recieve_spi_byte(command);
}
void send_data(unsigned char data) {
PORTB |= (1 << PINB1);
send_recieve_spi_byte(data);
}
void epaper_clear(unsigned char* image) {
for (int x = 0; x < EPDWIDTH; x++) {
for (int y = 0; y < EPDHEIGHT; y++) {
epaper_draw_absolute_pixel(image,x, y, 0);
}
}
}
void epaper_init() {
DDRD &= ~(1 << DDD1);
DDRB |= (1 << DDB1);
send_command(BOOSTER_SOFT_START);
send_data(0x17);
send_data(0x17);
send_data(0x17);
send_command(POWER_ON);
while(!(PIND &&(1<<PD1)));
send_command(PANEL_SETTING);
send_data(0x8F);
send_data(0x8F);
send_command(VCOM_AND_DATA_INTERVAL_SETTING);
send_data(0x37);
send_command(RESOLUTION_SETTING);
send_data(0x68);
send_data(0x00);
send_data(0xD4);
}
void epaper_display() {
send_command(DISPLAY_REFRESH);
while(!(PIND &&(1<<PD1)));
}
void epaper_display_frame(unsigned char* frame_buffer_black, unsigned char* frame_buffer_red) {
if (frame_buffer_black != NULL) {
send_command(DATA_START_TRANSMISSION_1);
_delay_ms(2);
for (int i = 0; i < EPDWIDTH * EPDHEIGHT / 8; i++) {
send_data(pgm_read_byte(&frame_buffer_black[i]));
}
_delay_ms(2);
}
if (frame_buffer_red != NULL) {
send_command(DATA_START_TRANSMISSION_2);
_delay_ms(2);
for (int i = 0; i < EPDWIDTH* EPDHEIGHT / 8; i++) {
send_data(pgm_read_byte(&frame_buffer_red[i]));
}
_delay_ms(2);
}
}
and
unsigned char image[2048];
epaper_init();
epaper_clear(image);
epaper_display_frame(image, image);
epaper_display();
This seems like it should clear the whole display, no? Nothing happens for me, the display does not refresh :(
from e-paper.
Any ideas @zerulin? I'm also not exactly sure how big the image array should be? The code here seems to suggest 8*width?
from e-paper.
Please run the demo we provided directly, do not make any changes and try again.
from e-paper.
The image array size = (image width / 8) * image height
from e-paper.
The image array size = (image width / 8) * image height
That works! No longer does weird stuff, except if I try to epaper_display_frame, then it is mostly garbage, when setting the two partials separately, all works 😄
from e-paper.
Related Issues (20)
- “sudo ./epd” terminated by signal SIGSEGV (Address boundary error) HOT 1
- e-Paper 4.2 inch with Python not working on Raspberry Pi 3B+ HOT 1
- Add font tables for bigger sizes HOT 1
- Debug: e-Paper busy Raspberry PI Zero HOT 4
- Print numbers on screen? HOT 1
- EPD_7in5b_V2 shows everything mirror
- Segmentation fault on Raspberry Zero w and EPD4in01f HOT 4
- example code not works HOT 1
- Example code for STM32 does not work, due to wrong SPI initialization.
- Partial update over white background? It's possible? HOT 2
- Error showing "e-Paper busy" "e-Paper busy release" HOT 3
- [Errno 2] No such file or directory when trying to use rc.local or cronjob to run on start up.
- GUI Paint HardFault
- division issue under lib HOT 1
- How to detect if faulty device? V4 - 2.13inches HAT
- Displaying Image HOT 1
- Wrong Elf Class error when trying example python on raspberry pi 4 HOT 15
- ModuleNotFoundError: No module named 'Jetson' HOT 4
- epd2in13 stays in e-Paper busy with Pythondemo, C demo working fine. HOT 1
- e-ink 2.13 V4 rotate string / landscape
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from e-paper.