Is your enhancement proposal related to a problem? Please describe.
When using the cfb subsystem there is no way to rotate everything (if the user chooses to use the screen upside down).
Describe the solution you'd like
Some way to achieve this.
Describe alternatives you've considered
I have not considered any alternatives; please let me know if there is anything.My screen has no hardware support (more info listed below).
Additional context
I've written this so far, but it isn't working. I think I misunderstood how the framebuffer is kept in RAM. If anyone has information as to how this is done, I should be able to whip something up. I am using the ssd1306 display. Maybe this should be done in? drivers/display/ssd1306.c? I don't think there is hardware support for this, so maybe it makes sense to do it like below; this way all the small screens like this will get this support.
diff --git a/subsys/fb/Kconfig b/subsys/fb/Kconfig
index 00be2ab08c..ace0ec9e99 100644
--- a/subsys/fb/Kconfig
+++ b/subsys/fb/Kconfig
@@ -31,6 +31,13 @@ config CHARACTER_FRAMEBUFFER_SHELL_DRIVER_NAME
help
Character Framebuffer Display Driver Name
+config CHARACTER_FRAMEBUFFER_ROTATE
+ bool "Rotate the frambuffer"
+ default n
+ help
+ Rotate the Framebuffer by 180deg. Used if the screen is up side
+ down.
+
module = CFB
module-str = cfb
source "subsys/logging/Kconfig.template.log_config"
diff --git a/subsys/fb/cfb.c b/subsys/fb/cfb.c
index 52b406827f..edafc2b5e2 100644
--- a/subsys/fb/cfb.c
+++ b/subsys/fb/cfb.c
@@ -447,10 +447,22 @@ int cfb_framebuffer_finalize(const struct device *dev)
struct display_buffer_descriptor desc;
int err;
+
if (!fb || !fb->buf) {
return -ENODEV;
}
+#if defined(CONFIG_CHARACTER_FRAMEBUFFER_ROTATE)
+ uint8_t temp = 0;
+ uint16_t end = ((fb->x_res * fb->y_res) / 8U);
+ for (size_t i = 0; i < fb->x_res * fb->y_res / 8U; i++) {
+ temp = byte_reverse(fb->buf[end]);
+ fb->buf[end] = byte_reverse(fb->buf[i]);
+ fb->buf[i] = temp;
+ end--;
+ }
+#endif
+
desc.buf_size = fb->size;
desc.width = fb->x_res;
desc.height = fb->y_res;
Is your enhancement proposal related to a problem? Please describe. When using the cfb subsystem there is no way to rotate everything (if the user chooses to use the screen upside down).
Describe the solution you'd like Some way to achieve this.
Describe alternatives you've considered I have not considered any alternatives; please let me know if there is anything.My screen has no hardware support (more info listed below).
Additional context I've written this so far, but it isn't working. I think I misunderstood how the framebuffer is kept in RAM. If anyone has information as to how this is done, I should be able to whip something up. I am using the ssd1306 display. Maybe this should be done in? drivers/display/ssd1306.c? I don't think there is hardware support for this, so maybe it makes sense to do it like below; this way all the small screens like this will get this support.