subsys/fb/cfb: Introduce cfb_framebuffer_invert function
Adds the cfb_framebuffer_invert function to invert Pixels in the Character Framebuffer Signed-off-by: Diego Sueiro <diego.sueiro@gmail.com>
This commit is contained in:
parent
a24770bd12
commit
0ab9c46d86
2 changed files with 23 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue