Skip to content

Commit

Permalink
adjust ed097tc2 grayscale
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed May 4, 2020
1 parent b1df166 commit f8bdeb3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions components/epd_driver/ed097oc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ static inline void latch_row() {
push_cfg(&config_reg);
}

void IRAM_ATTR epd_skip() { pulse_ckv_ticks(240, 1, true); }
void IRAM_ATTR epd_skip() { pulse_ckv_ticks(30, 1, true); }

void IRAM_ATTR epd_output_row(uint32_t output_time_us) {
void IRAM_ATTR epd_output_row(uint32_t output_time_dus) {

while (i2s_is_busy() || rmt_busy()) {
};

latch_row();

pulse_ckv_us(output_time_us, 5, false);
pulse_ckv_ticks(output_time_dus, 50, false);

i2s_start_line_output();
i2s_switch_buffer();
Expand Down
4 changes: 2 additions & 2 deletions components/epd_driver/ed097oc4.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ void epd_end_frame();
*
* - Previously submitted data is latched to the output register.
* - The RMT peripheral is set up to pulse the vertical (gate) driver for
* `output_time_us` microseconds.
* `output_time_dus` / 10 microseconds.
* - The I2S peripheral starts transmission of the current buffer to
* the source driver.
* - The line buffers are switched.
*
* This sequence of operations allows for pipelining data preparation and
* transfer, reducing total refresh times.
*/
void IRAM_ATTR epd_output_row(uint32_t output_time_us);
void IRAM_ATTR epd_output_row(uint32_t output_time_dus);

/** Skip a row without writing to it. */
void IRAM_ATTR epd_skip();
Expand Down
20 changes: 10 additions & 10 deletions components/epd_driver/epd_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ uint32_t skipping;

#if defined(CONFIG_EPD_DISPLAY_TYPE_ED097OC4) || defined(CONFIG_EPD_DISPLAY_TYPE_ED060SC4)
/* 4bpp Contrast cycles in order of contrast (Darkest first). */
const uint8_t contrast_cycles_4[15] = {3, 3, 2, 2, 3, 3, 3, 4,
4, 5, 5, 5, 10, 20, 30};
const uint8_t contrast_cycles_4[15] = {30, 30, 20, 20, 30, 30, 30, 40,
40, 50, 50, 50, 100, 200, 300};
#elif defined(CONFIG_EPD_DISPLAY_TYPE_ED097TC2)
const uint8_t contrast_cycles_4[15] = {1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 3, 5, 10, 20};
const uint8_t contrast_cycles_4[15] = {15, 8, 8, 8, 8, 8, 10, 10,
10, 10, 20, 20, 50, 100, 200};
#else
#error "no display type defined!"
#endif
Expand All @@ -33,9 +33,9 @@ const uint8_t contrast_cycles_4[15] = {1, 1, 1, 1, 2, 2, 2, 2,
static uint8_t *conversion_lut;

// output a row to the display.
static void write_row(uint32_t output_time_us) {
static void write_row(uint32_t output_time_dus) {
skipping = 0;
epd_output_row(output_time_us);
epd_output_row(output_time_dus);
}

void reorder_line_buffer(uint32_t *line_data);
Expand Down Expand Up @@ -65,7 +65,7 @@ void skip_row(uint8_t pipeline_finish_time) {
};
};
if (skipping == 1) {
epd_output_row(1);
epd_output_row(10);
}
if (skipping > 1) {
epd_skip();
Expand Down Expand Up @@ -98,17 +98,17 @@ void epd_push_pixels(Rect_t *area, short time, bool color) {
epd_switch_buffer();
memcpy(epd_get_current_buffer(), row, EPD_LINE_BYTES);

write_row(time);
write_row(time * 10);
// load nop row if done with area
} else if (i >= area->y + area->height) {
skip_row(time);
// output the same as before
} else {
write_row(time);
write_row(time * 10);
}
}
// Since we "pipeline" row output, we still have to latch out the last row.
write_row(time);
write_row(time * 10);

epd_end_frame();
}
Expand Down
6 changes: 3 additions & 3 deletions components/epd_driver/rmt_pulse.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ void rmt_pulse_init(gpio_num_t pin) {
row_rmt_config.gpio_num = pin;
row_rmt_config.mem_block_num = 2;

// Divide 80MHz APB Clock by 80 -> 1us resolution delay
row_rmt_config.clk_div = 1;
// Divide 80MHz APB Clock by 8 -> .1us resolution delay
row_rmt_config.clk_div = 8;

row_rmt_config.tx_config.loop_en = false;
row_rmt_config.tx_config.carrier_en = false;
Expand Down Expand Up @@ -70,7 +70,7 @@ void IRAM_ATTR pulse_ckv_ticks(uint16_t high_time_ticks,

void IRAM_ATTR pulse_ckv_us(uint16_t high_time_us, uint16_t low_time_us,
bool wait) {
pulse_ckv_ticks(80 * high_time_us, 80 * low_time_us, wait);
pulse_ckv_ticks(10 * high_time_us, 10 * low_time_us, wait);
}

bool IRAM_ATTR rmt_busy() { return !rmt_tx_done; }

0 comments on commit f8bdeb3

Please sign in to comment.