Skip to content

Commit

Permalink
Read vcom voltage from epd_board_vcom_v6()
Browse files Browse the repository at this point in the history
This makes vcom voltage available at runtime and not at compile time
  • Loading branch information
mickeprag committed May 22, 2022
1 parent f4ea87e commit 9ee422d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/epd_driver/board/epd_board_v6.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "epd_board.h"
#include "board/epd_board_v6.h"

#include "esp_log.h"
#include "../display_ops.h"
Expand Down Expand Up @@ -206,13 +207,7 @@ static void epd_board_poweron(epd_ctrl_state_t *state) {

ESP_ERROR_CHECK(tps_write_register(config_reg.port, TPS_REG_ENABLE, 0x3F));

#ifdef CONFIG_EPD_DRIVER_V6_VCOM
tps_set_vcom(config_reg.port, CONFIG_EPD_DRIVER_V6_VCOM);
// Arduino IDE...
#else
extern int epd_driver_v6_vcom;
tps_set_vcom(config_reg.port, epd_driver_v6_vcom);
#endif
tps_set_vcom(config_reg.port, epd_board_vcom_v6());

state->ep_sth = true;
mask = (const epd_ctrl_state_t){
Expand Down Expand Up @@ -277,6 +272,16 @@ esp_err_t epd_gpio_set_value_v6(uint8_t value) {
return pca9555_set_value(EPDIY_I2C_PORT, value, 0);
}

uint16_t __attribute__((weak)) epd_board_vcom_v6() {
#ifdef CONFIG_EPD_DRIVER_V6_VCOM
return CONFIG_EPD_DRIVER_V6_VCOM;
#else
// Arduino IDE...
extern int epd_driver_v6_vcom;
return epd_driver_v6_vcom;
#endif
}

const EpdBoardDefinition epd_board_v6 = {
.init = epd_board_init,
.deinit = epd_board_deinit,
Expand Down
10 changes: 10 additions & 0 deletions src/epd_driver/include/board/epd_board_v6.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @file "epd_board_v6.h"
* @brief Board-specific functions for v6.
*/

#pragma once

#include <stdint.h>

uint16_t epd_board_vcom_v6();

0 comments on commit 9ee422d

Please sign in to comment.