Merge branch 'master' into feature/st7789_soft_reset

This commit is contained in:
Carlos Diaz 2021-02-13 18:50:51 -06:00 committed by GitHub
commit ee13a029c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 144 additions and 107 deletions

29
.editorconfig Normal file
View file

@ -0,0 +1,29 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{*.md,*.rst}]
trim_trailing_whitespace = false
[{Makefile,*.mk,*.bat}]
indent_style = tab
indent_size = 2
[{*.cmake,CMakeLists.txt}]
indent_style = space
indent_size = 4
max_line_length = 120
[{*.sh,*.yml}]
indent_style = space
indent_size = 2

View file

@ -61,7 +61,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#include <stdarg.h>
#endif
#define TAG "FT81X"
#define TAG_LOG "FT81X"
/* data structure for SPI reading that has (optional) space for inserted dummy byte */
typedef struct _spi_read_data {
@ -274,7 +274,7 @@ void EVE_memWrite_buffer(uint32_t ftAddress, const uint8_t *data, uint32_t len,
while(bytes_left > 0)
{
uint32_t block_len = (bytes_left > SPI_TRANSER_SIZE ? SPI_TRANSER_SIZE : bytes_left);
// only send flush on last chunk
disp_spi_send_flag_t flush_flag = 0;
if(LvGL_Flush && bytes_left - block_len == 0)
@ -282,7 +282,7 @@ void EVE_memWrite_buffer(uint32_t ftAddress, const uint8_t *data, uint32_t len,
flush_flag = DISP_SPI_SIGNAL_FLUSH;
}
disp_spi_transaction(data, block_len, (disp_spi_send_flag_t)(DISP_SPI_SEND_QUEUED | DISP_SPI_ADDRESS_24 | SPIInherentSendFlags | flush_flag), NULL, (ftAddress | MEM_WRITE_24), 0);
disp_spi_transaction(data, block_len, (disp_spi_send_flag_t)(DISP_SPI_SEND_QUEUED | DISP_SPI_ADDRESS_24 | SPIInherentSendFlags | flush_flag), NULL, (ftAddress | MEM_WRITE_24), 0);
data += block_len;
ftAddress += block_len;
bytes_left -= block_len;
@ -409,7 +409,7 @@ void EVE_cmd_memzero(uint32_t ptr, uint32_t num)
EVE_begin_cmd(CMD_MEMZERO);
BUFFER_SPI_DWORD(ptr)
BUFFER_SPI_DWORD(num)
EVE_inc_cmdoffset(8);
SEND_SPI_BUFFER()
@ -438,11 +438,11 @@ void EVE_cmd_memwrite(uint32_t dest, uint32_t num, const uint8_t *data)
EVE_begin_cmd(CMD_MEMWRITE);
BUFFER_SPI_DWORD(dest)
BUFFER_SPI_DWORD(num)
EVE_inc_cmdoffset(8);
SEND_SPI_BUFFER()
block_transfer(data, num); // block_transfer is immediate - make sure CMD buffer is prepared!
}
@ -468,7 +468,7 @@ void EVE_cmd_memcpy(uint32_t dest, uint32_t src, uint32_t num)
void eve_spi_CMD_write(uint64_t addr, const uint8_t *data, uint16_t len)
{
// we can use a direct transaction because it is already chunked
disp_spi_transaction(data, len, (disp_spi_send_flag_t)(DISP_SPI_SEND_QUEUED | DISP_SPI_ADDRESS_24 | SPIInherentSendFlags), NULL, (addr | MEM_WRITE_24), 0);
disp_spi_transaction(data, len, (disp_spi_send_flag_t)(DISP_SPI_SEND_QUEUED | DISP_SPI_ADDRESS_24 | SPIInherentSendFlags), NULL, (addr | MEM_WRITE_24), 0);
uint8_t padding = len & 0x03; /* 0, 1, 2 or 3 */
padding = 4 - padding; /* 4, 3, 2 or 1 */
@ -478,9 +478,9 @@ void eve_spi_CMD_write(uint64_t addr, const uint8_t *data, uint16_t len)
if(padding)
{
addr += len;
uint8_t padData[4] = {0};
disp_spi_transaction(padData, padding, (disp_spi_send_flag_t)(DISP_SPI_SEND_QUEUED | DISP_SPI_ADDRESS_24 | SPIInherentSendFlags), NULL, (addr | MEM_WRITE_24), 0);
disp_spi_transaction(padData, padding, (disp_spi_send_flag_t)(DISP_SPI_SEND_QUEUED | DISP_SPI_ADDRESS_24 | SPIInherentSendFlags), NULL, (addr | MEM_WRITE_24), 0);
len += padding;
}
@ -521,7 +521,7 @@ void EVE_cmd_inflate(uint32_t ptr, const uint8_t *data, uint16_t len)
EVE_inc_cmdoffset(4);
SEND_SPI_BUFFER()
block_transfer(data, len); // block_transfer is immediate - make sure CMD buffer is prepared!
}
@ -707,7 +707,7 @@ uint32_t EVE_cmd_memcrc(uint32_t ptr, uint32_t num)
EVE_inc_cmdoffset(4);
SEND_SPI_BUFFER()
EVE_cmd_execute();
return (EVE_memRead32(EVE_RAM_CMD + offset));
@ -722,11 +722,11 @@ uint32_t EVE_cmd_getptr(void)
uint16_t offset = cmdOffset;
EVE_inc_cmdoffset(4);
SEND_SPI_BUFFER()
EVE_cmd_execute();
return (EVE_memRead32(EVE_RAM_CMD + offset));
}
@ -743,7 +743,7 @@ uint32_t EVE_cmd_regread(uint32_t ptr)
BUFFER_SPI_DWORD(ptr)
EVE_inc_cmdoffset(4);
offset = cmdOffset;
EVE_inc_cmdoffset(4);
@ -873,16 +873,16 @@ uint8_t EVE_init(void)
/* The most reliable DIO/QIO switching point is after EVE start up but before reading the ChipID. */
#if defined(DISP_SPI_TRANS_MODE_DIO)
ESP_LOGI(TAG, "Switching to DIO mode");
ESP_LOGI(TAG_LOG, "Switching to DIO mode");
DELAY_MS(20); /* different boards may take a different delay but this generally seems to work */
EVE_memWrite16(REG_SPI_WIDTH, SPI_WIDTH_DIO);
SPIInherentSendFlags = DISP_SPI_MODE_DIO | DISP_SPI_MODE_DIOQIO_ADDR;
SPIInherentSendFlags = DISP_SPI_MODE_DIO | DISP_SPI_MODE_DIOQIO_ADDR;
SPIDummyReadBits = 4; /* Esp32 DMA SPI transaction dummy_bits works more like clock cycles, so in DIO 4 dummy_bits == 8 total bits */
#elif defined(DISP_SPI_TRANS_MODE_QIO)
ESP_LOGI(TAG, "Switching to QIO mode");
ESP_LOGI(TAG_LOG, "Switching to QIO mode");
DELAY_MS(20); /* different boards may take a different delay but this generally seems to work */
EVE_memWrite16(REG_SPI_WIDTH, SPI_WIDTH_QIO);
SPIInherentSendFlags = DISP_SPI_MODE_QIO | DISP_SPI_MODE_DIOQIO_ADDR;
SPIInherentSendFlags = DISP_SPI_MODE_QIO | DISP_SPI_MODE_DIOQIO_ADDR;
SPIDummyReadBits = 2; /* Esp32 DMA SPI transaction dummy_bits works more like clock cycles, so in QIO 2 dummy_bits == 8 total bits */
#elif defined(DISP_SPI_HALF_DUPLEX)
SPIDummyReadBits = 8; /* SIO half-duplex mode */
@ -895,7 +895,7 @@ uint8_t EVE_init(void)
timeout++;
if(timeout > 400)
{
ESP_LOGI(TAG, "Failed to read ChipID...aborting initialization.");
ESP_LOGI(TAG_LOG, "Failed to read ChipID...aborting initialization.");
return 0;
}
}
@ -907,7 +907,7 @@ uint8_t EVE_init(void)
timeout++;
if(timeout > 50) /* experimental, 10 was the lowest value to get the BT815 started with, the touch-controller was the last to get out of reset */
{
ESP_LOGI(TAG, "Failed to read CPU status...aborting initialization.");
ESP_LOGI(TAG_LOG, "Failed to read CPU status...aborting initialization.");
return 0;
}
}
@ -1068,7 +1068,7 @@ void EVE_cmd_dl(uint32_t command)
if(cmd_burst)
{
BUFFER_SPI_DWORD(command)
EVE_inc_cmdoffset(4); /* update the command-ram pointer */
}
else
@ -1126,7 +1126,7 @@ void EVE_cmd_flashwrite(uint32_t ptr, uint32_t num, const uint8_t *data)
EVE_begin_cmd(CMD_FLASHWRITE);
BUFFER_SPI_DWORD(ptr)
BUFFER_SPI_DWORD(num)
EVE_inc_cmdoffset(8);
SEND_SPI_BUFFER()
@ -1147,11 +1147,11 @@ void EVE_cmd_flashread(uint32_t dest, uint32_t src, uint32_t num)
BUFFER_SPI_DWORD(dest)
BUFFER_SPI_DWORD(src)
BUFFER_SPI_DWORD(num)
EVE_inc_cmdoffset(12);
SEND_SPI_BUFFER()
EVE_cmd_execute();
}
@ -1167,11 +1167,11 @@ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num)
BUFFER_SPI_DWORD(dest)
BUFFER_SPI_DWORD(src)
BUFFER_SPI_DWORD(num)
EVE_inc_cmdoffset(12);
SEND_SPI_BUFFER()
EVE_cmd_execute();
}
@ -1181,7 +1181,7 @@ void EVE_cmd_flashupdate(uint32_t dest, uint32_t src, uint32_t num)
void EVE_cmd_flasherase(void)
{
EVE_begin_cmd(CMD_FLASHERASE);
SEND_SPI_BUFFER()
EVE_cmd_execute();
@ -1193,7 +1193,7 @@ void EVE_cmd_flasherase(void)
void EVE_cmd_flashattach(void)
{
EVE_begin_cmd(CMD_FLASHATTACH);
SEND_SPI_BUFFER()
EVE_cmd_execute();
@ -1205,7 +1205,7 @@ void EVE_cmd_flashattach(void)
void EVE_cmd_flashdetach(void)
{
EVE_begin_cmd(CMD_FLASHDETACH);
SEND_SPI_BUFFER()
EVE_cmd_execute();
@ -1217,7 +1217,7 @@ void EVE_cmd_flashdetach(void)
void EVE_cmd_flashspidesel(void)
{
EVE_begin_cmd(CMD_FLASHSPIDESEL);
SEND_SPI_BUFFER()
EVE_cmd_execute();
@ -1238,7 +1238,7 @@ uint32_t EVE_cmd_flashfast(void)
SEND_SPI_BUFFER()
EVE_cmd_execute();
return EVE_memRead32(EVE_RAM_CMD + offset);
}
@ -1254,7 +1254,7 @@ void EVE_cmd_flashspitx(uint32_t num, const uint8_t *data)
EVE_inc_cmdoffset(4);
SEND_SPI_BUFFER()
WAIT_SPI()
block_transfer(data, num);
}
@ -1401,7 +1401,7 @@ void EVE_cmd_text(int16_t x0, int16_t y0, int16_t font, uint16_t options, const
EVE_inc_cmdoffset(8);
EVE_write_string(text);
if(!cmd_burst)
{
SEND_SPI_BUFFER()
@ -1440,7 +1440,7 @@ void EVE_cmd_button_var(int16_t x0, int16_t y0, int16_t w0, int16_t h0, int16_t
EVE_inc_cmdoffset(4);
}
}
if(!cmd_burst)
{
SEND_SPI_BUFFER()
@ -1500,7 +1500,7 @@ void EVE_color_rgb(uint8_t red, uint8_t green, uint8_t blue)
BUFFER_SPI_BYTE(blue)
BUFFER_SPI_BYTE(red)
BUFFER_SPI_BYTE(0x04) /* encoding for COLOR_RGB */
EVE_inc_cmdoffset(4);
if(!cmd_burst)
@ -1516,7 +1516,7 @@ void EVE_cmd_bgcolor(uint32_t color)
BUFFER_SPI_DWORD(color & 0x00ffffff)
EVE_inc_cmdoffset(4);
if(!cmd_burst)
{
SEND_SPI_BUFFER()
@ -1530,7 +1530,7 @@ void EVE_cmd_fgcolor(uint32_t color)
BUFFER_SPI_DWORD(color & 0x00ffffff)
EVE_inc_cmdoffset(4);
if(!cmd_burst)
{
SEND_SPI_BUFFER()
@ -1544,7 +1544,7 @@ void EVE_cmd_gradcolor(uint32_t color)
BUFFER_SPI_DWORD(color & 0x00ffffff)
EVE_inc_cmdoffset(4);
if(!cmd_burst)
{
SEND_SPI_BUFFER()
@ -1624,7 +1624,7 @@ void EVE_cmd_progress(int16_t x0, int16_t y0, int16_t w0, int16_t h0, uint16_t o
BUFFER_SPI_WORD(val)
BUFFER_SPI_WORD(range)
BUFFER_SPI_WORD(0) /* dummy word for 4-byte alignment */
EVE_inc_cmdoffset(16);
if(!cmd_burst)
@ -1726,7 +1726,7 @@ void EVE_cmd_toggle_var(int16_t x0, int16_t y0, int16_t w0, int16_t font, uint16
EVE_inc_cmdoffset(4);
}
}
if(!cmd_burst)
{
SEND_SPI_BUFFER()
@ -1747,7 +1747,7 @@ void EVE_cmd_toggle(int16_t x0, int16_t y0, int16_t w0, int16_t font, uint16_t o
BUFFER_SPI_WORD(state)
EVE_inc_cmdoffset(12);
EVE_write_string(text);
if(!cmd_burst)
@ -1783,9 +1783,9 @@ void EVE_cmd_setbitmap(uint32_t addr, uint16_t fmt, uint16_t width, uint16_t hei
BUFFER_SPI_WORD(width)
BUFFER_SPI_WORD(height)
BUFFER_SPI_WORD(0)
EVE_inc_cmdoffset(12);
if(!cmd_burst)
{
SEND_SPI_BUFFER()
@ -2139,13 +2139,13 @@ void EVE_cmd_appendf(uint32_t ptr, uint32_t num)
void EVE_cmd_point(int16_t x0, int16_t y0, uint16_t size)
{
EVE_start_cmd((DL_BEGIN | EVE_POINTS));
uint32_t calc = POINT_SIZE(size*16);
BUFFER_SPI_DWORD(calc)
calc = VERTEX2F(x0 * 16, y0 * 16);
BUFFER_SPI_DWORD(calc)
BUFFER_SPI_DWORD(DL_END)
EVE_inc_cmdoffset(12);
@ -2164,13 +2164,13 @@ void EVE_cmd_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t width
uint32_t calc = LINE_WIDTH(width * 16);
BUFFER_SPI_DWORD(calc)
calc = VERTEX2F(x0 * 16, y0 * 16);
BUFFER_SPI_DWORD(calc)
calc = VERTEX2F(x1 * 16, y1 * 16);
BUFFER_SPI_DWORD(calc)
BUFFER_SPI_DWORD(DL_END)
EVE_inc_cmdoffset(16);
@ -2189,13 +2189,13 @@ void EVE_cmd_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t corne
uint32_t calc = LINE_WIDTH(corner * 16);
BUFFER_SPI_DWORD(calc)
calc = VERTEX2F(x0 * 16, y0 * 16);
BUFFER_SPI_DWORD(calc)
calc = VERTEX2F(x1 * 16, y1 * 16);
BUFFER_SPI_DWORD(calc)
BUFFER_SPI_DWORD(DL_END)
EVE_inc_cmdoffset(16);

View file

@ -35,7 +35,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#ifndef EVE_CONFIG_H_
#define EVE_CONFIG_H_
#ifdef LV_CONFIG_INCLUDE_SIMPLE
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"

View file

@ -109,7 +109,7 @@ menu "LVGL TFT Display controller"
bool
help
ST7789 display controller.
config LV_TFT_DISPLAY_CONTROLLER_GC9A01
bool
help
@ -211,14 +211,14 @@ menu "LVGL TFT Display controller"
config LV_TFT_DISPLAY_X_OFFSET
depends on LV_TFT_DISPLAY_OFFSETS
int
int
default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
default 0
config LV_TFT_DISPLAY_Y_OFFSET
depends on LV_TFT_DISPLAY_OFFSETS
int
int
default 53 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_LANDSCAPE || LV_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
default 40 if LV_PREDEFINED_DISPLAY_TTGO && (LV_DISPLAY_ORIENTATION_PORTRAIT || LV_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
default 0
@ -284,7 +284,7 @@ menu "LVGL TFT Display controller"
config LV_TFT_DISPLAY_USER_CONTROLLER_GC9A01
bool "GC9A01"
select LV_TFT_DISPLAY_CONTROLLER_GC9A01
select LV_TFT_DISPLAY_PROTOCOL_SPI
select LV_TFT_DISPLAY_PROTOCOL_SPI
config LV_TFT_DISPLAY_USER_CONTROLLER_ST7735S
bool "ST7735S"
select LV_TFT_DISPLAY_CONTROLLER_ST7735S
@ -441,7 +441,7 @@ menu "LVGL TFT Display controller"
config LV_FT81X_CONFIG_EVE_SUNFLOWER
bool "EVE_SUNFLOWER"
config LV_FT81X_CONFIG_EVE_CONNECTEVE
bool "EVE_CONNECTEVE"
bool "EVE_CONNECTEVE"
endchoice
choice
@ -579,16 +579,17 @@ menu "LVGL TFT Display controller"
default 2
config LV_INVERT_DISPLAY
bool "IN DEPRECATION - Invert display."
default y if LV_PREDEFINED_DISPLAY_M5STACK
bool "IN DEPRECATION - Invert display." if LV_TFT_DISPLAY_CONTROLLER_RA8875
default n
help
If text is backwards on your display, try enabling this.
config LV_INVERT_COLORS
bool "Invert colors in display" if LV_TFT_DISPLAY_CONTROLLER_ILI9341 || LV_TFT_DISPLAY_CONTROLLER_ST7735S || LV_TFT_DISPLAY_CONTROLLER_ILI9481
bool "Invert colors in display" if LV_TFT_DISPLAY_CONTROLLER_ILI9341 || LV_TFT_DISPLAY_CONTROLLER_ST7735S || LV_TFT_DISPLAY_CONTROLLER_ILI9481 || LV_TFT_DISPLAY_CONTROLLER_ST7789 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 || LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_HX8357
default y if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICKC
help
If the colors look inverted on your display, try enabling this.
If it didn't help try LVGL configuration -> Swap the 2 bytes of RGB565 color.
config LV_M5STICKC_HANDLE_AXP192
bool "Handle Backlight and TFT power for M5StickC using AXP192." if LV_PREDEFINED_DISPLAY_M5STICKC || LV_TFT_DISPLAY_CONTROLLER_ST7735S
@ -782,7 +783,7 @@ menu "LVGL TFT Display controller"
depends on LV_DISPLAY_USE_SPI_MISO
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 19 if LV_PREDEFINED_PINS_TKOALA
default 0
@ -803,7 +804,7 @@ menu "LVGL TFT Display controller"
depends on LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
range -1 39 if IDF_TARGET_ESP32
range -1 43 if IDF_TARGET_ESP32S2
default 22 if LV_PREDEFINED_PINS_TKOALA && LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
default -1
help
@ -814,7 +815,7 @@ menu "LVGL TFT Display controller"
depends on LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
range -1 39 if IDF_TARGET_ESP32
range -1 43 if IDF_TARGET_ESP32S2
default 21 if LV_PREDEFINED_PINS_TKOALA && LV_TFT_DISPLAY_SPI_TRANS_MODE_QIO
default -1
help
@ -824,7 +825,7 @@ menu "LVGL TFT Display controller"
int "GPIO for CLK (SCK / Serial Clock)" if LV_TFT_DISPLAY_PROTOCOL_SPI
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 18 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 13 if LV_PREDEFINED_DISPLAY_M5STICKC
default 18 if LV_PREDEFINED_DISPLAY_ATAG
@ -851,7 +852,7 @@ menu "LVGL TFT Display controller"
depends on LV_DISPLAY_USE_SPI_CS
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 5 if LV_PREDEFINED_PINS_38V1
default 14 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
default 5 if LV_PREDEFINED_DISPLAY_M5STICKC
@ -878,7 +879,7 @@ menu "LVGL TFT Display controller"
int "GPIO for DC (Data / Command)" if LV_TFT_DISPLAY_PROTOCOL_SPI
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
depends on LV_DISPLAY_USE_DC
default 19 if LV_PREDEFINED_PINS_38V1
default 17 if LV_PREDEFINED_PINS_38V4
@ -900,7 +901,7 @@ menu "LVGL TFT Display controller"
int "GPIO for Reset" if LV_TFT_DISPLAY_PROTOCOL_SPI && !LV_DISP_ST7789_SOFT_RESET
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 18 if LV_PREDEFINED_PINS_38V1
default 25 if LV_PREDEFINED_PINS_38V4
default 33 if LV_PREDEFINED_DISPLAY_M5STACK || LV_PREDEFINED_DISPLAY_M5STICK
@ -921,7 +922,7 @@ menu "LVGL TFT Display controller"
int "GPIO for Busy" if LV_TFT_DISPLAY_CONTROLLER_IL3820 || LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 35 if LV_TFT_DISPLAY_CONTROLLER_IL3820 || LV_TFT_DISPLAY_CONTROLLER_JD79653A || LV_TFT_DISPLAY_CONTROLLER_UC8151D
default 35
@ -959,7 +960,7 @@ menu "LVGL TFT Display controller"
depends on LV_ENABLE_BACKLIGHT_CONTROL
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 23 if LV_PREDEFINED_PINS_38V1
default 26 if LV_PREDEFINED_PINS_38V4
default 32 if LV_PREDEFINED_DISPLAY_M5STACK
@ -979,7 +980,7 @@ menu "LVGL TFT Display controller"
int "GPIO for I2C SDA" if LV_TFT_DISPLAY_PROTOCOL_I2C
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 5 if LV_PREDEFINED_DISPLAY_WEMOS_LOLIN
default 5
@ -990,7 +991,7 @@ menu "LVGL TFT Display controller"
int "GPIO for I2C SCL" if LV_TFT_DISPLAY_PROTOCOL_I2C
range 0 39 if IDF_TARGET_ESP32
range 0 43 if IDF_TARGET_ESP32S2
default 4 if LV_PREDEFINED_DISPLAY_WEMOS_LOLIN
default 4

View file

@ -7,7 +7,7 @@
* Adafruit 3.5" TFT 320x480 + Touchscreen Breakout
* http://www.adafruit.com/products/2050
*
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* https://www.adafruit.com/product/3651
*
*/
@ -177,7 +177,7 @@ void hx8357_init(void)
vTaskDelay(120 / portTICK_RATE_MS);
ESP_LOGI(TAG, "Initialization.");
//Send all the commands
const uint8_t *addr = (displayType == HX8357B) ? initb : initd;
uint8_t cmd, x, numArgs;
@ -199,9 +199,11 @@ void hx8357_init(void)
}
hx8357_set_rotation(1);
#if HX8357_INVERT_DISPLAY
hx8357_send_cmd(HX8357_INVON);;
#if HX8357_INVERT_COLORS
hx8357_send_cmd(HX8357_INVON);
#else
hx8357_send_cmd(HX8357_INVOFF);
#endif
hx8357_enable_backlight(true);
@ -211,7 +213,7 @@ void hx8357_init(void)
void hx8357_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
/* Column addresses */
uint8_t xb[] = {
(uint8_t) (area->x1 >> 8) & 0xFF,
@ -219,7 +221,7 @@ void hx8357_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
(uint8_t) (area->x2 >> 8) & 0xFF,
(uint8_t) (area->x2) & 0xFF,
};
/* Page addresses */
uint8_t yb[] = {
(uint8_t) (area->y1 >> 8) & 0xFF,
@ -261,7 +263,7 @@ void hx8357_enable_backlight(bool backlight)
void hx8357_set_rotation(uint8_t r)
{
r = r & 3; // can't be higher than 3
switch(r) {
case 0:
r = MADCTL_MX | MADCTL_MY | MADCTL_RGB;
@ -276,7 +278,7 @@ void hx8357_set_rotation(uint8_t r)
r = MADCTL_MX | MADCTL_MV | MADCTL_RGB;
break;
}
hx8357_send_cmd(HX8357_MADCTL);
hx8357_send_data(&r, 1);
}

View file

@ -7,7 +7,7 @@
* Adafruit 3.5" TFT 320x480 + Touchscreen Breakout
* http://www.adafruit.com/products/2050
*
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen for Feathers
* https://www.adafruit.com/product/3651
*
*/
@ -40,6 +40,7 @@ extern "C" {
#define HX8357_BCKL CONFIG_LV_DISP_PIN_BCKL
#define HX8357_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
#define HX8357_BCKL_ACTIVE_LVL 1
@ -47,9 +48,6 @@ extern "C" {
#define HX8357_BCKL_ACTIVE_LVL 0
#endif
// if text/images are backwards, try setting this to 1
#define HX8357_INVERT_DISPLAY CONFIG_LV_INVERT_DISPLAY
/*******************
* HX8357B/D REGS

View file

@ -62,8 +62,8 @@ void sh1107_init(void)
{0x81, {0}, 0}, // Set display contrast
{0x2F, {0}, 0}, // ...value
{0x20, {0}, 0}, // Set memory mode
{0xA0, {0}, 0}, // Non-rotated display
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
{0xA0, {0}, 0}, // Non-rotated display
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
{0xC8, {0}, 0}, // flipped vertical
#elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT
{0xC7, {0}, 0}, // flipped vertical
@ -82,11 +82,11 @@ void sh1107_init(void)
{0xDA, {0}, 0}, // Set com pins
{0x12, {0}, 0}, // ...value
{0xA4, {0}, 0}, // output ram to display
#if defined CONFIG_LV_INVERT_DISPLAY
#if defined CONFIG_LV_INVERT_COLORS
{0xA7, {0}, 0}, // inverted display
#else
{0xA6, {0}, 0}, // Non-inverted display
#endif
#endif
{0xAF, {0}, 0}, // Turn display on
{0, {0}, 0xff},
};
@ -116,14 +116,14 @@ void sh1107_init(void)
}
void sh1107_set_px_cb(struct _disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
lv_color_t color, lv_opa_t opa)
lv_color_t color, lv_opa_t opa)
{
/* buf_w will be ignored, the configured CONFIG_LV_DISPLAY_HEIGHT and _WIDTH,
and CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE and _PORTRAIT will be used. */
and CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE and _PORTRAIT will be used. */
uint16_t byte_index = 0;
uint8_t bit_index = 0;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
byte_index = y + (( x>>3 ) * LV_VER_RES_MAX);
bit_index = x & 0x7;
#elif defined CONFIG_LV_DISPLAY_ORIENTATION_PORTRAIT
@ -146,10 +146,10 @@ void sh1107_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
uint32_t size = 0;
void *ptr;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
row1 = area->x1>>3;
row2 = area->x2>>3;
#else
#else
row1 = area->y1>>3;
row2 = area->y2>>3;
#endif
@ -158,9 +158,9 @@ void sh1107_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
sh1107_send_cmd(0x00 | columnLow); // Set Lower Column Start Address for Page Addressing Mode
sh1107_send_cmd(0xB0 | i); // Set Page Start Address for Page Addressing Mode
size = area->y2 - area->y1 + 1;
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
#if defined CONFIG_LV_DISPLAY_ORIENTATION_LANDSCAPE
ptr = color_map + i * LV_VER_RES_MAX;
#else
#else
ptr = color_map + i * LV_HOR_RES_MAX;
#endif
if(i != row2){

View file

@ -3,10 +3,10 @@
*
* Code from https://github.com/yanbe/ssd1306-esp-idf-i2c.git is used as a starting point,
* in addition to code from https://github.com/espressif/esp-iot-solution.
*
*
* Definitions are borrowed from:
* http://robotcantalk.blogspot.com/2015/03/interfacing-arduino-with-ssd1306-driven.html
*
*
* For LVGL the forum has been used, in particular: https://blog.littlevgl.com/2019-05-06/oled
*/
@ -113,7 +113,7 @@ void ssd1306_init(void)
uint8_t display_mode = 0;
#if defined CONFIG_LV_INVERT_DISPLAY
#if defined CONFIG_LV_INVERT_COLORS
display_mode = OLED_CMD_DISPLAY_INVERTED;
#else
display_mode = OLED_CMD_DISPLAY_NORMAL;
@ -130,7 +130,7 @@ void ssd1306_init(void)
0xFF,
OLED_CMD_DISPLAY_ON
};
uint8_t err = send_data(NULL, conf, sizeof(conf));
assert(0 == err);
}
@ -213,7 +213,7 @@ static uint8_t send_data(lv_disp_drv_t *disp_drv, void *bytes, size_t bytes_len)
uint8_t *data = (uint8_t *) bytes;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (OLED_I2C_ADDRESS << 1) | I2C_MASTER_WRITE, true);
@ -222,7 +222,7 @@ static uint8_t send_data(lv_disp_drv_t *disp_drv, void *bytes, size_t bytes_len)
}
i2c_master_stop(cmd);
/* Send queued commands */
err = i2c_master_cmd_begin(DISP_I2C_PORT, cmd, 10 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
@ -234,7 +234,7 @@ static uint8_t send_pixels(lv_disp_drv_t *disp_drv, void *color_buffer, size_t b
{
(void) disp_drv;
esp_err_t err;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (OLED_I2C_ADDRESS << 1) | I2C_MASTER_WRITE, true);
@ -242,7 +242,7 @@ static uint8_t send_pixels(lv_disp_drv_t *disp_drv, void *color_buffer, size_t b
i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_DATA_STREAM, true);
i2c_master_write(cmd, (uint8_t *) color_buffer, buffer_len, true);
i2c_master_stop(cmd);
/* Send queued commands */
err = i2c_master_cmd_begin(DISP_I2C_PORT, cmd, 10 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);

View file

@ -65,7 +65,13 @@ void st7789_init(void)
{ST7789_CABCCTRL, {0xBE}, 1},
{ST7789_MADCTL, {0x00}, 1}, // Set to 0x28 if your display is flipped
{ST7789_COLMOD, {0x55}, 1},
{ST7789_INVON, {0}, 0},
#if ST7789_INVERT_COLORS == 1
{ST7789_INVON, {0}, 0}, // set inverted mode
#else
{ST7789_INVOFF, {0}, 0}, // set non-inverted mode
#endif
{ST7789_RGBCTRL, {0x00, 0x1B}, 2},
{0xF2, {0x08}, 1},
{ST7789_GAMSET, {0x01}, 1},
@ -89,7 +95,7 @@ void st7789_init(void)
gpio_pad_select_gpio(ST7789_RST);
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
#endif
#if ST7789_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ST7789_BCKL);
gpio_set_direction(ST7789_BCKL, GPIO_MODE_OUTPUT);
@ -226,7 +232,7 @@ static void st7789_set_orientation(uint8_t orientation)
ESP_LOGI(TAG, "Display orientation: %s", orientation_str[orientation]);
uint8_t data[] =
uint8_t data[] =
{
#if CONFIG_LV_PREDEFINED_DISPLAY_TTGO
0x60, 0xA0, 0x00, 0xC0
@ -234,7 +240,7 @@ static void st7789_set_orientation(uint8_t orientation)
0xC0, 0x00, 0x60, 0xA0
#endif
};
ESP_LOGI(TAG, "0x36 command value: 0x%02X", data[orientation]);
st7789_send_cmd(ST7789_MADCTL);

View file

@ -26,6 +26,7 @@ extern "C"
#define ST7789_BCKL CONFIG_LV_DISP_PIN_BCKL
#define ST7789_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
#define ST7789_INVERT_COLORS CONFIG_LV_INVERT_COLORS
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
#define ST7789_BCKL_ACTIVE_LVL 1