Added PCD8544 to readme, addressed PR comments

This commit is contained in:
Matthias Ringwald 2021-11-18 08:58:04 +01:00 committed by Carlos Diaz
parent 37a4d3a4e6
commit f3f6ba6470
3 changed files with 27 additions and 24 deletions

View file

@ -30,6 +30,7 @@ swap of RGB565 color on the LVGL configuration menuconfig (it's not handled auto
| RA8875 | TFT | SPI | 16: RGB565 | Yes | | RA8875 | TFT | SPI | 16: RGB565 | Yes |
| SH1107 | Monochrome | SPI | 1: 1byte per pixel | No | | SH1107 | Monochrome | SPI | 1: 1byte per pixel | No |
| SSD1306 | Monochrome | I2C | 1: 1byte per pixel | No | | SSD1306 | Monochrome | I2C | 1: 1byte per pixel | No |
| PCD8544 | Monochrome | SPI | 1: 1byte per pixel | No |
| IL3820 | e-Paper | SPI | 1: 1byte per pixel | No | | IL3820 | e-Paper | SPI | 1: 1byte per pixel | No |
| UC8151D/ GoodDisplay GDEW0154M10 DES | e-Paper | SPI | 1: 1byte per pixel | No | | UC8151D/ GoodDisplay GDEW0154M10 DES | e-Paper | SPI | 1: 1byte per pixel | No |
| FitiPower JD79653A/ GoodDisplay GDEW0154M09 | e-Paper | SPI | 1: 1byte per pixel | No | | FitiPower JD79653A/ GoodDisplay GDEW0154M09 | e-Paper | SPI | 1: 1byte per pixel | No |

View file

@ -116,9 +116,12 @@ void pcd8544_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t
uint8_t * buf = (uint8_t *) color_map; uint8_t * buf = (uint8_t *) color_map;
// Check if the whole frame buffer can be sent in a single SPI transaction
if ((area->x1 == 0) && (area->y1 == 0) && (area->x2 == (disp_drv->hor_res - 1)) && (area->y2 == (disp_drv->ver_res - 1))){ if ((area->x1 == 0) && (area->y1 == 0) && (area->x2 == (disp_drv->hor_res - 1)) && (area->y2 == (disp_drv->ver_res - 1))){
// optimize flush of complete frame buffer in a single SPI transaction // send complete frame buffer at once.
// NOTE: disp_spi_send_colors triggers lv_disp_flush_ready
pcd8544_send_cmd(0x40); /* set Y address */ pcd8544_send_cmd(0x40); /* set Y address */
pcd8544_send_cmd(0x80); /* set X address */ pcd8544_send_cmd(0x80); /* set X address */
@ -134,13 +137,12 @@ void pcd8544_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t
uint16_t bank; uint16_t bank;
uint16_t cols_to_update = area->x2 - area->x1 + 1; uint16_t cols_to_update = area->x2 - area->x1 + 1;
for (bank = bank_start ; bank <= bank_end ; bank++ ){ for (bank = bank_start ; bank <= bank_end ; bank++ ){
pcd8544_send_cmd(0x40 | bank ); /* set Y address */ pcd8544_send_cmd(0x40 | bank ); /* set Y address */
pcd8544_send_cmd(0x80 | area->x1 ); /* set X address */ pcd8544_send_cmd(0x80 | area->x1 ); /* set X address */
uint16_t offset = bank * disp_drv->hor_res + area->x1; uint16_t offset = bank * disp_drv->hor_res + area->x1;
pcd8544_send_data(&buf[offset], cols_to_update); pcd8544_send_data(&buf[offset], cols_to_update);
} }
lv_disp_flush_ready(disp_drv); lv_disp_flush_ready(disp_drv);
} }
} }

View file

@ -11,9 +11,9 @@
extern "C" { extern "C" {
#endif #endif
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h> #include <stdbool.h>
#ifdef LV_LVGL_H_INCLUDE_SIMPLE #ifdef LV_LVGL_H_INCLUDE_SIMPLE
@ -22,32 +22,32 @@ extern "C" {
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#endif #endif
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define PCD8544_DC CONFIG_LV_DISP_PIN_DC #define PCD8544_DC CONFIG_LV_DISP_PIN_DC
#define PCD8544_RST CONFIG_LV_DISP_PIN_RST #define PCD8544_RST CONFIG_LV_DISP_PIN_RST
#define PCD8544_BCKL CONFIG_LV_DISP_PIN_BCKL #define PCD8544_BCKL CONFIG_LV_DISP_PIN_BCKL
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
void pcd8544_init(void); void pcd8544_init(void);
void pcd8544_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map); void pcd8544_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
void pcd8544_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area); void pcd8544_rounder(lv_disp_drv_t * disp_drv, lv_area_t *area);
void pcd8544_set_px_cb(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, void pcd8544_set_px_cb(lv_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);
void pcd8544_set_contrast(uint8_t contrast); void pcd8544_set_contrast(uint8_t contrast);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/
#ifdef __cplusplus #ifdef __cplusplus