Merge pull request #26 from lvgl/fix/ssd1306_orientation
Fix/ssd1306 orientation
This commit is contained in:
commit
347aaa68d2
|
@ -55,7 +55,11 @@ extern "C" {
|
|||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * 40)
|
||||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306
|
||||
#if defined (CONFIG_LV_THEME_MONO)
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * (LV_VER_RES_MAX / 8))
|
||||
#else
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX)
|
||||
#endif
|
||||
#elif defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_FT81X)
|
||||
#define DISP_BUF_LINES 40
|
||||
#define DISP_BUF_SIZE (LV_HOR_RES_MAX * DISP_BUF_LINES)
|
||||
|
|
|
@ -186,11 +186,12 @@ menu "LVGL TFT Display controller"
|
|||
# Used in display init function to send display orientation commands
|
||||
choice DISPLAY_ORIENTATION
|
||||
prompt "Display orientation"
|
||||
default DISPLAY_ORIENTATION_PORTRAIT
|
||||
default DISPLAY_ORIENTATION_PORTRAIT if !LV_TFT_DISPLAY_CONTROLLER_SSD1306
|
||||
default DISPLAY_ORIENTATION_LANDSCAPE if LV_TFT_DISPLAY_CONTROLLER_SSD1306
|
||||
config DISPLAY_ORIENTATION_PORTRAIT
|
||||
bool "Portrait"
|
||||
bool "Portrait" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306
|
||||
config DISPLAY_ORIENTATION_PORTRAIT_INVERTED
|
||||
bool "Portrait inverted"
|
||||
bool "Portrait inverted" if !LV_TFT_DISPLAY_CONTROLLER_SSD1306
|
||||
config DISPLAY_ORIENTATION_LANDSCAPE
|
||||
bool "Landscape"
|
||||
config DISPLAY_ORIENTATION_LANDSCAPE_INVERTED
|
||||
|
|
|
@ -101,10 +101,10 @@ void ssd1306_init(void)
|
|||
uint8_t orientation_1 = 0;
|
||||
uint8_t orientation_2 = 0;
|
||||
|
||||
#if defined (CONFIG_DISPLAY_ORIENTATION_PORTRAIT)
|
||||
#if defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE)
|
||||
orientation_1 = OLED_CMD_SET_SEGMENT_REMAP;
|
||||
orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_REMAP;
|
||||
#elif defined (CONFIG_DISPLAY_ORIENTATION_PORTRAIT_INVERTED)
|
||||
#elif defined (CONFIG_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED)
|
||||
orientation_1 = 0xA0;
|
||||
orientation_2 = OLED_CMD_SET_COM_SCAN_MODE_NORMAL;
|
||||
#else
|
||||
|
@ -176,8 +176,13 @@ void ssd1306_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t
|
|||
|
||||
void ssd1306_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area)
|
||||
{
|
||||
area->x1 = area->x1 & ~(0x07);
|
||||
area->x2 = area->x2 | 0x07;
|
||||
uint8_t hor_max = disp_drv->hor_res;
|
||||
uint8_t ver_max = disp_drv->ver_res;
|
||||
|
||||
area->x1 = 0;
|
||||
area->y1 = 0;
|
||||
area->x2 = hor_max - 1;
|
||||
area->y2 = ver_max - 1;
|
||||
}
|
||||
|
||||
void ssd1306_sleep_in(void)
|
||||
|
|
Loading…
Reference in a new issue