fixes for idf 5.x
This commit is contained in:
parent
bc57b32d87
commit
f8b0f34a59
18 changed files with 84 additions and 83 deletions
|
@ -263,7 +263,7 @@ void TFT_bitmap_display(void)
|
||||||
void FT81x_init(void)
|
void FT81x_init(void)
|
||||||
{
|
{
|
||||||
#if EVE_USE_PDN
|
#if EVE_USE_PDN
|
||||||
gpio_pad_select_gpio(EVE_PDN);
|
gpio_reset_pin(EVE_PDN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gpio_set_level(EVE_CS, 1);
|
gpio_set_level(EVE_CS, 1);
|
||||||
|
|
|
@ -112,18 +112,18 @@ void GC9A01_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(GC9A01_DC);
|
gpio_reset_pin(GC9A01_DC);
|
||||||
gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if GC9A01_USE_RST
|
#if GC9A01_USE_RST
|
||||||
gpio_pad_select_gpio(GC9A01_RST);
|
gpio_reset_pin(GC9A01_RST);
|
||||||
gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(GC9A01_RST, 0);
|
gpio_set_level(GC9A01_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(GC9A01_RST, 1);
|
gpio_set_level(GC9A01_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initialization.");
|
ESP_LOGI(TAG, "Initialization.");
|
||||||
|
@ -134,7 +134,7 @@ void GC9A01_init(void)
|
||||||
GC9A01_send_cmd(GC_init_cmds[cmd].cmd);
|
GC9A01_send_cmd(GC_init_cmds[cmd].cmd);
|
||||||
GC9A01_send_data(GC_init_cmds[cmd].data, GC_init_cmds[cmd].databytes&0x1F);
|
GC9A01_send_data(GC_init_cmds[cmd].data, GC_init_cmds[cmd].databytes&0x1F);
|
||||||
if (GC_init_cmds[cmd].databytes & 0x80) {
|
if (GC_init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
/*********************
|
/*********************
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
|
#include <soc/gpio_sig_map.h>
|
||||||
#include "esp_lcd_backlight.h"
|
#include "esp_lcd_backlight.h"
|
||||||
#include "driver/ledc.h"
|
#include "driver/ledc.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
|
@ -49,22 +50,22 @@ disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config)
|
||||||
};
|
};
|
||||||
const ledc_timer_config_t LCD_backlight_timer = {
|
const ledc_timer_config_t LCD_backlight_timer = {
|
||||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||||
.bit_num = LEDC_TIMER_10_BIT,
|
.duty_resolution = LEDC_TIMER_10_BIT,
|
||||||
.timer_num = config->timer_idx,
|
.timer_num = config->timer_idx,
|
||||||
.freq_hz = 5000,
|
.freq_hz = 5000,
|
||||||
.clk_cfg = LEDC_AUTO_CLK};
|
.clk_cfg = LEDC_AUTO_CLK};
|
||||||
|
|
||||||
ESP_ERROR_CHECK(ledc_timer_config(&LCD_backlight_timer));
|
ESP_ERROR_CHECK(ledc_timer_config(&LCD_backlight_timer));
|
||||||
ESP_ERROR_CHECK(ledc_channel_config(&LCD_backlight_channel));
|
ESP_ERROR_CHECK(ledc_channel_config(&LCD_backlight_channel));
|
||||||
gpio_matrix_out(config->gpio_num, ledc_periph_signal[LEDC_LOW_SPEED_MODE].sig_out0_idx + config->channel_idx, config->output_invert, 0);
|
gpio_iomux_out(config->gpio_num, ledc_periph_signal[LEDC_LOW_SPEED_MODE].sig_out0_idx + config->channel_idx, config->output_invert);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Configure GPIO for output
|
// Configure GPIO for output
|
||||||
bckl_dev->index = config->gpio_num;
|
bckl_dev->index = config->gpio_num;
|
||||||
gpio_pad_select_gpio(config->gpio_num);
|
gpio_reset_pin(config->gpio_num);
|
||||||
ESP_ERROR_CHECK(gpio_set_direction(config->gpio_num, GPIO_MODE_OUTPUT));
|
ESP_ERROR_CHECK(gpio_set_direction(config->gpio_num, GPIO_MODE_OUTPUT));
|
||||||
gpio_matrix_out(config->gpio_num, SIG_GPIO_OUT_IDX, config->output_invert, false);
|
gpio_iomux_out(config->gpio_num, SIG_GPIO_OUT_IDX, config->output_invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (disp_backlight_h)bckl_dev;
|
return (disp_backlight_h)bckl_dev;
|
||||||
|
|
|
@ -160,18 +160,18 @@ static uint8_t displayType = HX8357D;
|
||||||
void hx8357_init(void)
|
void hx8357_init(void)
|
||||||
{
|
{
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(HX8357_DC);
|
gpio_reset_pin(HX8357_DC);
|
||||||
gpio_set_direction(HX8357_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(HX8357_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if HX8357_USE_RST
|
#if HX8357_USE_RST
|
||||||
gpio_pad_select_gpio(HX8357_RST);
|
gpio_reset_pin(HX8357_RST);
|
||||||
gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(HX8357_RST, 0);
|
gpio_set_level(HX8357_RST, 0);
|
||||||
vTaskDelay(10 / portTICK_RATE_MS);
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(HX8357_RST, 1);
|
gpio_set_level(HX8357_RST, 1);
|
||||||
vTaskDelay(120 / portTICK_RATE_MS);
|
vTaskDelay(120 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initialization.");
|
ESP_LOGI(TAG, "Initialization.");
|
||||||
|
@ -192,7 +192,7 @@ void hx8357_init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (x & 0x80) { // If high bit set...
|
if (x & 0x80) { // If high bit set...
|
||||||
vTaskDelay(numArgs * 5 / portTICK_RATE_MS); // numArgs is actually a delay time (5ms units)
|
vTaskDelay(numArgs * 5 / portTICK_PERIOD_MS); // numArgs is actually a delay time (5ms units)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,21 +196,21 @@ void il3820_init(void)
|
||||||
uint8_t tmp[3] = {0};
|
uint8_t tmp[3] = {0};
|
||||||
|
|
||||||
/* Initialize non-SPI GPIOs */
|
/* Initialize non-SPI GPIOs */
|
||||||
gpio_pad_select_gpio(IL3820_DC_PIN);
|
gpio_reset_pin(IL3820_DC_PIN);
|
||||||
gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT);
|
gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
gpio_pad_select_gpio(IL3820_BUSY_PIN);
|
gpio_reset_pin(IL3820_BUSY_PIN);
|
||||||
gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT);
|
gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT);
|
||||||
|
|
||||||
#if IL3820_USE_RST
|
#if IL3820_USE_RST
|
||||||
gpio_pad_select_gpio(IL3820_RST_PIN);
|
gpio_reset_pin(IL3820_RST_PIN);
|
||||||
gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT);
|
gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
/* Harware reset */
|
/* Harware reset */
|
||||||
gpio_set_level( IL3820_RST_PIN, 0);
|
gpio_set_level( IL3820_RST_PIN, 0);
|
||||||
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
|
vTaskDelay(IL3820_RESET_DELAY / portTICK_PERIOD_MS);
|
||||||
gpio_set_level( IL3820_RST_PIN, 1);
|
gpio_set_level( IL3820_RST_PIN, 1);
|
||||||
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
|
vTaskDelay(IL3820_RESET_DELAY / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Software reset */
|
/* Software reset */
|
||||||
|
@ -267,14 +267,14 @@ static void il3820_waitbusy(int wait_ms)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
vTaskDelay(10 / portTICK_RATE_MS); // 10ms delay
|
vTaskDelay(10 / portTICK_PERIOD_MS); // 10ms delay
|
||||||
|
|
||||||
for(i = 0; i < (wait_ms * 10); i++) {
|
for(i = 0; i < (wait_ms * 10); i++) {
|
||||||
if(gpio_get_level(IL3820_BUSY_PIN) != IL3820_BUSY_LEVEL) {
|
if(gpio_get_level(IL3820_BUSY_PIN) != IL3820_BUSY_LEVEL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vTaskDelay(10 / portTICK_RATE_MS);
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGE( TAG, "busy exceeded %dms", i*10 );
|
ESP_LOGE( TAG, "busy exceeded %dms", i*10 );
|
||||||
|
|
|
@ -138,16 +138,16 @@ void ili9163c_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ILI9163C_DC);
|
gpio_reset_pin(ILI9163C_DC);
|
||||||
gpio_set_direction(ILI9163C_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9163C_DC, GPIO_MODE_OUTPUT);
|
||||||
gpio_pad_select_gpio(ILI9163C_RST);
|
gpio_reset_pin(ILI9163C_RST);
|
||||||
gpio_set_direction(ILI9163C_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9163C_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9163C_RST, 0);
|
gpio_set_level(ILI9163C_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ILI9163C_RST, 1);
|
gpio_set_level(ILI9163C_RST, 1);
|
||||||
vTaskDelay(150 / portTICK_RATE_MS);
|
vTaskDelay(150 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
//Send all the commands
|
//Send all the commands
|
||||||
uint16_t cmd = 0;
|
uint16_t cmd = 0;
|
||||||
|
@ -157,7 +157,7 @@ void ili9163c_init(void)
|
||||||
ili9163c_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes & 0x1F);
|
ili9163c_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes & 0x1F);
|
||||||
if (ili_init_cmds[cmd].databytes & 0x80)
|
if (ili_init_cmds[cmd].databytes & 0x80)
|
||||||
{
|
{
|
||||||
vTaskDelay(150 / portTICK_RATE_MS);
|
vTaskDelay(150 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,18 +81,18 @@ void ili9341_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ILI9341_DC);
|
gpio_reset_pin(ILI9341_DC);
|
||||||
gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ILI9341_USE_RST
|
#if ILI9341_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9341_RST);
|
gpio_reset_pin(ILI9341_RST);
|
||||||
gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9341_RST, 0);
|
gpio_set_level(ILI9341_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ILI9341_RST, 1);
|
gpio_set_level(ILI9341_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initialization.");
|
ESP_LOGI(TAG, "Initialization.");
|
||||||
|
@ -103,7 +103,7 @@ void ili9341_init(void)
|
||||||
ili9341_send_cmd(ili_init_cmds[cmd].cmd);
|
ili9341_send_cmd(ili_init_cmds[cmd].cmd);
|
||||||
ili9341_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
ili9341_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
||||||
if (ili_init_cmds[cmd].databytes & 0x80) {
|
if (ili_init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,25 +74,25 @@ void ili9481_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ILI9481_DC);
|
gpio_reset_pin(ILI9481_DC);
|
||||||
gpio_set_direction(ILI9481_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9481_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ILI9481_USE_RST
|
#if ILI9481_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9481_RST);
|
gpio_reset_pin(ILI9481_RST);
|
||||||
gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9481_RST, 0);
|
gpio_set_level(ILI9481_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ILI9481_RST, 1);
|
gpio_set_level(ILI9481_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "ILI9481 initialization.");
|
ESP_LOGI(TAG, "ILI9481 initialization.");
|
||||||
|
|
||||||
// Exit sleep
|
// Exit sleep
|
||||||
ili9481_send_cmd(0x01); /* Software reset */
|
ili9481_send_cmd(0x01); /* Software reset */
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
//Send all the commands
|
//Send all the commands
|
||||||
uint16_t cmd = 0;
|
uint16_t cmd = 0;
|
||||||
|
@ -100,7 +100,7 @@ void ili9481_init(void)
|
||||||
ili9481_send_cmd(ili_init_cmds[cmd].cmd);
|
ili9481_send_cmd(ili_init_cmds[cmd].cmd);
|
||||||
ili9481_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
ili9481_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
||||||
if (ili_init_cmds[cmd].databytes & 0x80) {
|
if (ili_init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,18 +66,18 @@ void ili9486_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ILI9486_DC);
|
gpio_reset_pin(ILI9486_DC);
|
||||||
gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ILI9486_USE_RST
|
#if ILI9486_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9486_RST);
|
gpio_reset_pin(ILI9486_RST);
|
||||||
gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9486_RST, 0);
|
gpio_set_level(ILI9486_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ILI9486_RST, 1);
|
gpio_set_level(ILI9486_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "ILI9486 Initialization.");
|
ESP_LOGI(TAG, "ILI9486 Initialization.");
|
||||||
|
@ -88,7 +88,7 @@ void ili9486_init(void)
|
||||||
ili9486_send_cmd(ili_init_cmds[cmd].cmd);
|
ili9486_send_cmd(ili_init_cmds[cmd].cmd);
|
||||||
ili9486_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
ili9486_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
||||||
if (ili_init_cmds[cmd].databytes & 0x80) {
|
if (ili_init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,25 +76,25 @@ void ili9488_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ILI9488_DC);
|
gpio_reset_pin(ILI9488_DC);
|
||||||
gpio_set_direction(ILI9488_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9488_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ILI9488_USE_RST
|
#if ILI9488_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9488_RST);
|
gpio_reset_pin(ILI9488_RST);
|
||||||
gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9488_RST, 0);
|
gpio_set_level(ILI9488_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ILI9488_RST, 1);
|
gpio_set_level(ILI9488_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "ILI9488 initialization.");
|
ESP_LOGI(TAG, "ILI9488 initialization.");
|
||||||
|
|
||||||
// Exit sleep
|
// Exit sleep
|
||||||
ili9488_send_cmd(0x01); /* Software reset */
|
ili9488_send_cmd(0x01); /* Software reset */
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
//Send all the commands
|
//Send all the commands
|
||||||
uint16_t cmd = 0;
|
uint16_t cmd = 0;
|
||||||
|
@ -102,7 +102,7 @@ void ili9488_init(void)
|
||||||
ili9488_send_cmd(ili_init_cmds[cmd].cmd);
|
ili9488_send_cmd(ili_init_cmds[cmd].cmd);
|
||||||
ili9488_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
ili9488_send_data(ili_init_cmds[cmd].data, ili_init_cmds[cmd].databytes&0x1F);
|
||||||
if (ili_init_cmds[cmd].databytes & 0x80) {
|
if (ili_init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,16 +57,16 @@ void pcd8544_init(void){
|
||||||
// TODO: orientation
|
// TODO: orientation
|
||||||
|
|
||||||
// Initialize non-SPI GPIOs
|
// Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(PCD8544_DC);
|
gpio_reset_pin(PCD8544_DC);
|
||||||
gpio_set_direction(PCD8544_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(PCD8544_DC, GPIO_MODE_OUTPUT);
|
||||||
gpio_pad_select_gpio(PCD8544_RST);
|
gpio_reset_pin(PCD8544_RST);
|
||||||
gpio_set_direction(PCD8544_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(PCD8544_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
// Reset the display
|
// Reset the display
|
||||||
gpio_set_level(PCD8544_RST, 0);
|
gpio_set_level(PCD8544_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(PCD8544_RST, 1);
|
gpio_set_level(PCD8544_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
pcd8544_send_cmd(0x21); /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */
|
pcd8544_send_cmd(0x21); /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */
|
||||||
pcd8544_send_cmd(0x06); /* temp. control: b10 = 2 */
|
pcd8544_send_cmd(0x06); /* temp. control: b10 = 2 */
|
||||||
|
|
|
@ -151,14 +151,14 @@ void ra8875_init(void)
|
||||||
// Initialize non-SPI GPIOs
|
// Initialize non-SPI GPIOs
|
||||||
|
|
||||||
#if RA8875_USE_RST
|
#if RA8875_USE_RST
|
||||||
gpio_pad_select_gpio(RA8875_RST);
|
gpio_reset_pin(RA8875_RST);
|
||||||
gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
// Reset the RA8875
|
// Reset the RA8875
|
||||||
gpio_set_level(RA8875_RST, 0);
|
gpio_set_level(RA8875_RST, 0);
|
||||||
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
|
vTaskDelay(DIV_ROUND_UP(100, portTICK_PERIOD_MS));
|
||||||
gpio_set_level(RA8875_RST, 1);
|
gpio_set_level(RA8875_RST, 1);
|
||||||
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
|
vTaskDelay(DIV_ROUND_UP(100, portTICK_PERIOD_MS));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initalize RA8875 clocks (SPI must be decelerated before initializing clocks)
|
// Initalize RA8875 clocks (SPI must be decelerated before initializing clocks)
|
||||||
|
@ -251,21 +251,21 @@ void ra8875_sleep_in(void)
|
||||||
ra8875_configure_clocks(false);
|
ra8875_configure_clocks(false);
|
||||||
|
|
||||||
ra8875_write_cmd(RA8875_REG_PWRR, 0x00); // Power and Display Control Register (PWRR)
|
ra8875_write_cmd(RA8875_REG_PWRR, 0x00); // Power and Display Control Register (PWRR)
|
||||||
vTaskDelay(DIV_ROUND_UP(20, portTICK_RATE_MS));
|
vTaskDelay(DIV_ROUND_UP(20, portTICK_PERIOD_MS));
|
||||||
ra8875_write_cmd(RA8875_REG_PWRR, 0x02); // Power and Display Control Register (PWRR)
|
ra8875_write_cmd(RA8875_REG_PWRR, 0x02); // Power and Display Control Register (PWRR)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ra8875_sleep_out(void)
|
void ra8875_sleep_out(void)
|
||||||
{
|
{
|
||||||
ra8875_write_cmd(RA8875_REG_PWRR, 0x00); // Power and Display Control Register (PWRR)
|
ra8875_write_cmd(RA8875_REG_PWRR, 0x00); // Power and Display Control Register (PWRR)
|
||||||
vTaskDelay(DIV_ROUND_UP(20, portTICK_RATE_MS));
|
vTaskDelay(DIV_ROUND_UP(20, portTICK_PERIOD_MS));
|
||||||
|
|
||||||
ra8875_configure_clocks(true);
|
ra8875_configure_clocks(true);
|
||||||
|
|
||||||
disp_spi_change_device_speed(-1);
|
disp_spi_change_device_speed(-1);
|
||||||
|
|
||||||
ra8875_write_cmd(RA8875_REG_PWRR, 0x80); // Power and Display Control Register (PWRR)
|
ra8875_write_cmd(RA8875_REG_PWRR, 0x80); // Power and Display Control Register (PWRR)
|
||||||
vTaskDelay(DIV_ROUND_UP(20, portTICK_RATE_MS));
|
vTaskDelay(DIV_ROUND_UP(20, portTICK_PERIOD_MS));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ra8875_read_cmd(uint8_t cmd)
|
uint8_t ra8875_read_cmd(uint8_t cmd)
|
||||||
|
@ -298,7 +298,7 @@ void ra8875_configure_clocks(bool high_speed)
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
|
|
||||||
ra8875_write_cmd(RA8875_REG_PCSR, PCSR_VAL); // Pixel Clock Setting Register (PCSR)
|
ra8875_write_cmd(RA8875_REG_PCSR, PCSR_VAL); // Pixel Clock Setting Register (PCSR)
|
||||||
vTaskDelay(DIV_ROUND_UP(20, portTICK_RATE_MS));
|
vTaskDelay(DIV_ROUND_UP(20, portTICK_PERIOD_MS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ra8875_set_window(unsigned int xs, unsigned int xe, unsigned int ys, unsigned int ye)
|
static void ra8875_set_window(unsigned int xs, unsigned int xe, unsigned int ys, unsigned int ye)
|
||||||
|
|
|
@ -92,18 +92,18 @@ void sh1107_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(SH1107_DC);
|
gpio_reset_pin(SH1107_DC);
|
||||||
gpio_set_direction(SH1107_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(SH1107_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if SH1107_USE_RST
|
#if SH1107_USE_RST
|
||||||
gpio_pad_select_gpio(SH1107_RST);
|
gpio_reset_pin(SH1107_RST);
|
||||||
gpio_set_direction(SH1107_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(SH1107_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(SH1107_RST, 0);
|
gpio_set_level(SH1107_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(SH1107_RST, 1);
|
gpio_set_level(SH1107_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Send all the commands
|
//Send all the commands
|
||||||
|
@ -112,7 +112,7 @@ void sh1107_init(void)
|
||||||
sh1107_send_cmd(init_cmds[cmd].cmd);
|
sh1107_send_cmd(init_cmds[cmd].cmd);
|
||||||
sh1107_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes&0x1F);
|
sh1107_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes&0x1F);
|
||||||
if (init_cmds[cmd].databytes & 0x80) {
|
if (init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,18 +98,18 @@ void st7735s_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ST7735S_DC);
|
gpio_reset_pin(ST7735S_DC);
|
||||||
gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7735S_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ST7735S_USE_RST
|
#if ST7735S_USE_RST
|
||||||
gpio_pad_select_gpio(ST7735S_RST);
|
gpio_reset_pin(ST7735S_RST);
|
||||||
gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7735S_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ST7735S_RST, 0);
|
gpio_set_level(ST7735S_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ST7735S_RST, 1);
|
gpio_set_level(ST7735S_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "ST7735S initialization.");
|
ESP_LOGI(TAG, "ST7735S initialization.");
|
||||||
|
@ -120,7 +120,7 @@ void st7735s_init(void)
|
||||||
st7735s_send_cmd(init_cmds[cmd].cmd);
|
st7735s_send_cmd(init_cmds[cmd].cmd);
|
||||||
st7735s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes&0x1F);
|
st7735s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes&0x1F);
|
||||||
if (init_cmds[cmd].databytes & 0x80) {
|
if (init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,20 +86,20 @@ void st7789_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ST7789_DC);
|
gpio_reset_pin(ST7789_DC);
|
||||||
gpio_set_direction(ST7789_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7789_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if !defined(ST7789_SOFT_RST)
|
#if !defined(ST7789_SOFT_RST)
|
||||||
gpio_pad_select_gpio(ST7789_RST);
|
gpio_reset_pin(ST7789_RST);
|
||||||
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
#if !defined(ST7789_SOFT_RST)
|
#if !defined(ST7789_SOFT_RST)
|
||||||
gpio_set_level(ST7789_RST, 0);
|
gpio_set_level(ST7789_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ST7789_RST, 1);
|
gpio_set_level(ST7789_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#else
|
#else
|
||||||
st7789_send_cmd(ST7789_SWRESET);
|
st7789_send_cmd(ST7789_SWRESET);
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,7 +112,7 @@ void st7789_init(void)
|
||||||
st7789_send_cmd(st7789_init_cmds[cmd].cmd);
|
st7789_send_cmd(st7789_init_cmds[cmd].cmd);
|
||||||
st7789_send_data(st7789_init_cmds[cmd].data, st7789_init_cmds[cmd].databytes&0x1F);
|
st7789_send_data(st7789_init_cmds[cmd].data, st7789_init_cmds[cmd].databytes&0x1F);
|
||||||
if (st7789_init_cmds[cmd].databytes & 0x80) {
|
if (st7789_init_cmds[cmd].databytes & 0x80) {
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,18 +82,18 @@ void st7796s_init(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ST7796S_DC);
|
gpio_reset_pin(ST7796S_DC);
|
||||||
gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ST7796S_USE_RST
|
#if ST7796S_USE_RST
|
||||||
gpio_pad_select_gpio(ST7796S_RST);
|
gpio_reset_pin(ST7796S_RST);
|
||||||
gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ST7796S_RST, 0);
|
gpio_set_level(ST7796S_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
gpio_set_level(ST7796S_RST, 1);
|
gpio_set_level(ST7796S_RST, 1);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initialization.");
|
ESP_LOGI(TAG, "Initialization.");
|
||||||
|
@ -106,7 +106,7 @@ void st7796s_init(void)
|
||||||
st7796s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes & 0x1F);
|
st7796s_send_data(init_cmds[cmd].data, init_cmds[cmd].databytes & 0x1F);
|
||||||
if (init_cmds[cmd].databytes & 0x80)
|
if (init_cmds[cmd].databytes & 0x80)
|
||||||
{
|
{
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,10 +139,10 @@ static void setup_axis(gpio_num_t plus, gpio_num_t minus, gpio_num_t measure, gp
|
||||||
{
|
{
|
||||||
// Set GPIOs:
|
// Set GPIOs:
|
||||||
// - Float "ignore" and "measure"
|
// - Float "ignore" and "measure"
|
||||||
gpio_pad_select_gpio(ignore);
|
gpio_reset_pin(ignore);
|
||||||
gpio_set_direction(ignore, GPIO_MODE_DISABLE);
|
gpio_set_direction(ignore, GPIO_MODE_DISABLE);
|
||||||
gpio_set_pull_mode(ignore, GPIO_FLOATING);
|
gpio_set_pull_mode(ignore, GPIO_FLOATING);
|
||||||
gpio_pad_select_gpio(measure);
|
gpio_reset_pin(measure);
|
||||||
gpio_set_direction(measure, GPIO_MODE_DISABLE);
|
gpio_set_direction(measure, GPIO_MODE_DISABLE);
|
||||||
gpio_set_pull_mode(measure, GPIO_FLOATING);
|
gpio_set_pull_mode(measure, GPIO_FLOATING);
|
||||||
// - Set "plus" to 1, "minus" to 0
|
// - Set "plus" to 1, "minus" to 0
|
||||||
|
|
|
@ -63,7 +63,7 @@ void stmpe610_init(void)
|
||||||
|
|
||||||
// Attempt a software reset
|
// Attempt a software reset
|
||||||
write_8bit_reg(STMPE_SYS_CTRL1, STMPE_SYS_CTRL1_RESET);
|
write_8bit_reg(STMPE_SYS_CTRL1, STMPE_SYS_CTRL1_RESET);
|
||||||
vTaskDelay(10 / portTICK_RATE_MS);
|
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
// Reset the SPI configuration, making sure auto-increment is set
|
// Reset the SPI configuration, making sure auto-increment is set
|
||||||
u8 = read_8bit_reg(STMPE_SPI_CFG);
|
u8 = read_8bit_reg(STMPE_SPI_CFG);
|
||||||
|
|
Loading…
Reference in a new issue