@@ -52,10 +52,10 @@ struct st7789v_data {
52
52
uint16_t y_offset ;
53
53
};
54
54
55
- #ifdef CONFIG_ST7789V_RGB565
56
- #define ST7789V_PIXEL_SIZE 2u
57
- #else
55
+ #ifdef CONFIG_ST7789V_RGB888
58
56
#define ST7789V_PIXEL_SIZE 3u
57
+ #else
58
+ #define ST7789V_PIXEL_SIZE 2u
59
59
#endif
60
60
61
61
static void st7789v_set_lcd_margins (const struct device * dev ,
@@ -164,6 +164,8 @@ static int st7789v_write(const struct device *dev,
164
164
}
165
165
if (IS_ENABLED (CONFIG_ST7789V_RGB565 )) {
166
166
pixfmt = PIXEL_FORMAT_RGB_565 ;
167
+ } else if (IS_ENABLED (CONFIG_ST7789V_BGR565 )) {
168
+ pixfmt = PIXEL_FORMAT_BGR_565 ;
167
169
} else {
168
170
pixfmt = PIXEL_FORMAT_RGB_888 ;
169
171
}
@@ -197,6 +199,9 @@ static void st7789v_get_capabilities(const struct device *dev,
197
199
#ifdef CONFIG_ST7789V_RGB565
198
200
capabilities -> supported_pixel_formats = PIXEL_FORMAT_RGB_565 ;
199
201
capabilities -> current_pixel_format = PIXEL_FORMAT_RGB_565 ;
202
+ #elif CONFIG_ST7789V_BGR565
203
+ capabilities -> supported_pixel_formats = PIXEL_FORMAT_BGR_565 ;
204
+ capabilities -> current_pixel_format = PIXEL_FORMAT_BGR_565 ;
200
205
#else
201
206
capabilities -> supported_pixel_formats = PIXEL_FORMAT_RGB_888 ;
202
207
capabilities -> current_pixel_format = PIXEL_FORMAT_RGB_888 ;
@@ -209,6 +214,8 @@ static int st7789v_set_pixel_format(const struct device *dev,
209
214
{
210
215
#ifdef CONFIG_ST7789V_RGB565
211
216
if (pixel_format == PIXEL_FORMAT_RGB_565 ) {
217
+ #elif CONFIG_ST7789V_BGR565
218
+ if (pixel_format == PIXEL_FORMAT_BGR_565 ) {
212
219
#else
213
220
if (pixel_format == PIXEL_FORMAT_RGB_888 ) {
214
221
#endif
0 commit comments