Merge pull request #127 from lvgl/fix/dont_use_rst_when_not_defined

Fix compilation break when hardware reset is not enabled
This commit is contained in:
Carlos Diaz 2021-10-13 19:16:37 -05:00 committed by GitHub
commit 3d775fadd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 43 deletions

View file

@ -69,7 +69,7 @@
#define ST77XX_MADCTL_MY 0x80
#define ST77XX_MADCTL_MX 0x40
#define ST77XX_MADCTL_MV 0x20 #define
#define ST77XX_MADCTL_MV 0x20
#define ST77XX_MADCTL_ML 0x10
#define ST77XX_MADCTL_RGB 0x00
#define ST77XX_MADCTL_BGR 0x08
@ -94,7 +94,7 @@ static void ili9163c_set_orientation(uint8_t orientation);
static void ili9163c_send_cmd(uint8_t cmd);
static void ili9163c_send_data(void *data, uint16_t length);
static void ili9163c_send_color(void *data, uint16_t length);
static void ili9163c_reset(void);
/**********************
* STATIC VARIABLES
**********************/
@ -136,18 +136,8 @@ void ili9163c_init(void)
{ILI9163C_DISPON, {0}, 0x80}, // Main screen turn on, no args w/delay 100 ms delay
{0, {0}, 0xff}
};
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9163C_DC);
gpio_set_direction(ILI9163C_DC, GPIO_MODE_OUTPUT);
gpio_pad_select_gpio(ILI9163C_RST);
gpio_set_direction(ILI9163C_RST, GPIO_MODE_OUTPUT);
//Reset the display
gpio_set_level(ILI9163C_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9163C_RST, 1);
vTaskDelay(150 / portTICK_RATE_MS);
ili9163c_reset();
//Send all the commands
uint16_t cmd = 0;
@ -246,3 +236,14 @@ static void ili9163c_set_orientation(uint8_t orientation)
ili9163c_send_cmd(ILI9163C_MADCTL);
ili9163c_send_data((void *)&data[orientation], 1);
}
static void ili9163c_reset(void)
{
#if CONFIG_LV_DISP_USE_RST
gpio_set_level(ILI9163C_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
gpio_set_level(ILI9163C_RST, 1);
vTaskDelay(150 / portTICK_RATE_MS);
#else
#endif
}

View file

@ -38,8 +38,12 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#define PIN_DC CONFIG_LV_DISP_PIN_DC
#define PIN_DC_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_DC)))
#if defined CONFIG_LV_DISP_PIN_RST
#define PIN_RST CONFIG_LV_DISP_PIN_RST
#define PIN_RST_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_RST)))
#endif
#define PIN_BUSY CONFIG_LV_DISP_PIN_BUSY
#define PIN_BUSY_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY)))
#define EVT_BUSY (1UL << 0UL)
@ -324,6 +328,8 @@ static void jd79653a_update_partial(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t
jd79653a_power_off();
}
static void jd79653a_reset(void);
void jd79653a_fb_set_full_color(uint8_t color)
{
jd79653a_power_on();
@ -444,16 +450,6 @@ void jd79653a_init()
return;
}
// Setup output pins, output (PP)
gpio_config_t out_io_conf = {
.intr_type = GPIO_INTR_DISABLE,
.mode = GPIO_MODE_OUTPUT,
.pin_bit_mask = PIN_DC_BIT | PIN_RST_BIT,
.pull_down_en = 0,
.pull_up_en = 0,
};
ESP_ERROR_CHECK(gpio_config(&out_io_conf));
// Setup input pin, pull-up, input
gpio_config_t in_io_conf = {
.intr_type = GPIO_INTR_POSEDGE,
@ -466,11 +462,7 @@ void jd79653a_init()
gpio_install_isr_service(0);
gpio_isr_handler_add(PIN_BUSY, jd79653a_busy_intr, (void *) PIN_BUSY);
// Hardware reset
gpio_set_level(PIN_RST, 0);
vTaskDelay(pdMS_TO_TICKS(15)); // At least 10ms, leave 15ms for now just in case...
gpio_set_level(PIN_RST, 1);
vTaskDelay(pdMS_TO_TICKS(120));
jd79653a_reset();
// Dump in initialise sequence
jd79653a_spi_send_seq(init_seq, EPD_SEQ_LEN(init_seq));
@ -481,3 +473,14 @@ void jd79653a_init()
ESP_LOGI(TAG, "Panel is up!");
}
static void jd79653a_reset(void)
{
#if defined CONFIG_LV_DISP_PIN_RST
gpio_set_level(PIN_RST, 0);
// At least 10ms, leave 15ms for now just in case...
vTaskDelay(pdMS_TO_TICKS(15));
gpio_set_level(PIN_RST, 1);
vTaskDelay(pdMS_TO_TICKS(120));
#endif
}

View file

@ -39,8 +39,12 @@
#define PIN_DC CONFIG_LV_DISP_PIN_DC
#define PIN_DC_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_DC)))
#if defined CONFIG_LV_DISP_PIN_RST
#define PIN_RST CONFIG_LV_DISP_PIN_RST
#define PIN_RST_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_RST)))
#endif
#define PIN_BUSY CONFIG_LV_DISP_PIN_BUSY
#define PIN_BUSY_BIT ((1ULL << (uint8_t)(CONFIG_LV_DISP_PIN_BUSY)))
#define EVT_BUSY (1UL << 0UL)
@ -139,14 +143,13 @@ static void uc8151d_sleep()
uc8151d_spi_send_data_byte(0xa5);
}
static void uc8151d_reset(void);
static void uc8151d_panel_init()
{
// Hardware reset for 3 times - not sure why but it's from official demo code
for (uint8_t cnt = 0; cnt < 3; cnt++) {
gpio_set_level(PIN_RST, 0);
vTaskDelay(pdMS_TO_TICKS(10)); // At least 10ms, leave 20ms for now just in case...
gpio_set_level(PIN_RST, 1);
vTaskDelay(pdMS_TO_TICKS(10));
uc8151d_reset();
}
// Power up
@ -240,16 +243,6 @@ void uc8151d_init()
return;
}
// Setup output pins, output (PP)
gpio_config_t out_io_conf = {
.intr_type = GPIO_INTR_DISABLE,
.mode = GPIO_MODE_OUTPUT,
.pin_bit_mask = PIN_DC_BIT | PIN_RST_BIT,
.pull_down_en = 0,
.pull_up_en = 0,
};
ESP_ERROR_CHECK(gpio_config(&out_io_conf));
// Setup input pin, pull-up, input
gpio_config_t in_io_conf = {
.intr_type = GPIO_INTR_POSEDGE,
@ -266,3 +259,14 @@ void uc8151d_init()
uc8151d_panel_init();
ESP_LOGI(TAG, "Panel initialised");
}
static void uc8151d_reset(void)
{
#if defined CONFIG_LV_DISP_USE_RST
gpio_set_level(PIN_RST, 0);
// At least 10ms, leave 20ms for now just in case...
vTaskDelay(pdMS_TO_TICKS(20));
gpio_set_level(PIN_RST, 1);
vTaskDelay(pdMS_TO_TICKS(10));
#endif
}