diff --git a/include/display/cfb.h b/include/display/cfb.h index 2ce79e9b652..6de9bdc5f0a 100644 --- a/include/display/cfb.h +++ b/include/display/cfb.h @@ -100,6 +100,15 @@ int cfb_print(struct device *dev, char *str, u16_t x, u16_t y); */ int cfb_framebuffer_clear(struct device *dev, bool clear_display); +/** + * @brief Invert Pixels. + * + * @param dev Pointer to device structure for driver instance + * + * @return 0 on success, negative value otherwise + */ +int cfb_framebuffer_invert(struct device *dev); + /** * @brief Finalize framebuffer and write it to display RAM, * invert or reorder pixels if necessary. diff --git a/subsys/fb/cfb.c b/subsys/fb/cfb.c index d0ef674bd22..9e86e528f0f 100644 --- a/subsys/fb/cfb.c +++ b/subsys/fb/cfb.c @@ -185,6 +185,20 @@ int cfb_framebuffer_clear(struct device *dev, bool clear_display) return 0; } + +int cfb_framebuffer_invert(struct device *dev) +{ + struct char_framebuffer *fb = &char_fb; + + if (!fb || !fb->buf) { + return -1; + } + + fb->inverted = !fb->inverted; + + return 0; +} + int cfb_framebuffer_finalize(struct device *dev) { const struct display_driver_api *api = dev->driver_api;